detecting change in requried dependencies
This commit is contained in:
parent
42986ee5f8
commit
f301c0dd1c
@ -3,10 +3,10 @@
|
|||||||
- [ ] Config requriments
|
- [ ] Config requriments
|
||||||
- [ ] Forwarding secret insert
|
- [ ] Forwarding secret insert
|
||||||
- [ ] Forwarding type insert
|
- [ ] Forwarding type insert
|
||||||
- [ ] Apt installed pakages
|
- [x] Apt installed pakages
|
||||||
- [ ] check on new dependency
|
- [x] check on new dependency
|
||||||
- [x] Detect change and move
|
- [x] Detect change and move
|
||||||
- [ ] Detect status
|
- [x] Detect status
|
||||||
- [x] Iptables add
|
- [x] Iptables add
|
||||||
- [ ] File structure
|
- [ ] File structure
|
||||||
- [ ] Datect change and move
|
- [ ] Datect change and move
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
lastUpdateDate= #to version control
|
lastUpdateDate= #to version control
|
||||||
baseInstallLocation=/opt/velocity/
|
baseInstallLocation=/opt/velocity/
|
||||||
baseUserName=velocity
|
baseUserName=velocity
|
||||||
dependenciesInstalled=('openjdk-17-jre-headless' 'screen')
|
dependenciesInstalled=yes
|
||||||
|
dependencies=('openjdk-17-jre-headless' 'screen')
|
||||||
systemdService=yes #if y > update, n > disable
|
systemdService=yes #if y > update, n > disable
|
||||||
autoUpgrade=yes
|
autoUpgrade=yes
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,6 @@ fi
|
|||||||
'
|
'
|
||||||
|
|
||||||
### Base dependencies check
|
### Base dependencies check
|
||||||
# !TODO it is not bulean
|
|
||||||
old="oDependenciesInstalled"
|
old="oDependenciesInstalled"
|
||||||
new="dependenciesInstalled"
|
new="dependenciesInstalled"
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# TODO! check for new dependency
|
### Checks dependencies arrays ###
|
||||||
|
depDiff=()
|
||||||
|
|
||||||
|
for oPkg in "${oDependencies[@]}"; do
|
||||||
|
skip=
|
||||||
|
for pkg in "${dependencies[@]}"; do
|
||||||
|
[[ $oPkg == $pkg ]] && { skip=1; break; }
|
||||||
|
done
|
||||||
|
[[ -n $skip ]] || depDiff+=("$oPkg")
|
||||||
|
done
|
||||||
|
|
||||||
|
declare -p depDiff
|
||||||
|
|
||||||
|
if [[ ! "${#depDiff[@]}" == 0 ]]; then
|
||||||
|
printf "These dependencies are newly not requred: ${depDiff[@]} \n"
|
||||||
|
printf "Do you wish to uninstall them? [Y/n]: \n"
|
||||||
|
read ansDiff -n 1
|
||||||
|
|
||||||
|
if [[ "$ansDiff" =~ ("y"|"Y") || -z $ansDiff ]]; then
|
||||||
|
|
||||||
|
apt remove ${depDiff[@]}
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
### Checks dependencies ###
|
### Checks dependencies ###
|
||||||
DepNum=0
|
DepNum=0
|
||||||
@ -50,7 +73,7 @@ elif [[ "$BaseDep" == "uninstall" && "$DepStatus" == "none" ]]; then
|
|||||||
|
|
||||||
elif [[ "$BaseDep" == "uninstall" && "$DepStatus" == ("some"|"all") ]]; then
|
elif [[ "$BaseDep" == "uninstall" && "$DepStatus" == ("some"|"all") ]]; then
|
||||||
# uninstall
|
# uninstall
|
||||||
apt remove ${DepMissing[@]}
|
apt remove ${DepInstalled[@]}
|
||||||
|
|
||||||
elif [[ "$BaseDep" == "report" && "$DepStatus" == "none" ]]; then
|
elif [[ "$BaseDep" == "report" && "$DepStatus" == "none" ]]; then
|
||||||
# nothing to do
|
# nothing to do
|
||||||
@ -58,17 +81,17 @@ elif [[ "$BaseDep" == "report" && "$DepStatus" == "none" ]]; then
|
|||||||
elif [[ "$BaseDep" == "report" && "$DepStatus" == ("some"|"all") ]]; then
|
elif [[ "$BaseDep" == "report" && "$DepStatus" == ("some"|"all") ]]; then
|
||||||
printf "Do you want to uinstall these dependencies? [Y/n]
|
printf "Do you want to uinstall these dependencies? [Y/n]
|
||||||
printf "${DepInstalled[@]}
|
printf "${DepInstalled[@]}
|
||||||
read ansReport
|
read ansReport -n 1
|
||||||
|
|
||||||
if [[ "$ansReport" =~ ("y"|"Y"|"yes"|"Yes") || -z $ansReport ]]; then
|
if [[ "$ansReport" =~ ("y"|"Y"|"yes"|"Yes") || -z $ansReport ]]; then
|
||||||
apt remove ${DepMissing[@]}
|
apt remove ${DepInstalled[@]}
|
||||||
else
|
else
|
||||||
printf "Hope you know what you are doing."
|
printf "Hope you know what you are doing."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
# error handeling
|
# error handeling
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
oBaseInstallLocation=no
|
oBaseInstallLocation=no
|
||||||
oBaseUserName=no
|
oBaseUserName=no
|
||||||
oDependenciesInstalled=no #if set to no will do it
|
oDependenciesInstalled=no #if set to no will do it
|
||||||
|
oDependencies=('openjdk-17-jre-headless' 'screen')
|
||||||
oSystemdService=no #if y > update, n > not
|
oSystemdService=no #if y > update, n > not
|
||||||
oautoUpgrade=no #work in progress
|
oautoUpgrade=no #work in progress
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user