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