108 lines
1.7 KiB
Bash
Executable File
108 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# import configs
|
|
. install.cfg
|
|
. install/old.cfg
|
|
|
|
|
|
#stop service
|
|
systemctl stop mc-forge
|
|
|
|
#update system
|
|
apt update
|
|
|
|
if [[ "$autoUpgrade" == "yes" ]]; then
|
|
apt upgrade -y
|
|
fi
|
|
|
|
### Template on chack
|
|
: '
|
|
old=""
|
|
new=""
|
|
|
|
if [[ "$old" == "yes" && "$new" == "yes" ]]; then
|
|
# dubble yes
|
|
echo "check"
|
|
elif [[ "$old" == "no" && "$new" == "yes" ]]; then
|
|
# no > yes
|
|
echo "install"
|
|
elif [[ "$old" == "no" && "$new" == "no" ]]; then
|
|
# dubble no
|
|
echo "report"
|
|
elif [[ "$old" == "yes" && "$new" == "no" ]]; then
|
|
# yes > no
|
|
echo "uninstall"
|
|
else
|
|
#error handeling
|
|
fi
|
|
'
|
|
|
|
### Base dependencies check
|
|
old="oDependenciesInstalled"
|
|
new="dependenciesInstalled"
|
|
|
|
if [[ "$new" == "yes" ]]; then
|
|
BaseDep="install"
|
|
elif [[ "$old" == "no"]]; then
|
|
# dubble no
|
|
BaseDep="report"
|
|
elif [[ "$old" == "yes"]]; then
|
|
# yes > no
|
|
BaseDep="uninstall"
|
|
else
|
|
#error handeling
|
|
fi
|
|
|
|
### Template on chack
|
|
old=""
|
|
new=""
|
|
|
|
if [[ "$old" == "yes" && "$new" == "yes" ]]; then
|
|
# dubble yes
|
|
echo "check"
|
|
elif [[ "$old" == "no" && "$new" == "yes" ]]; then
|
|
# no > yes
|
|
echo "install"
|
|
elif [[ "$old" == "no" && "$new" == "no" ]]; then
|
|
# dubble no
|
|
echo "report"
|
|
elif [[ "$old" == "yes" && "$new" == "no" ]]; then
|
|
# yes > no
|
|
echo "uninstall"
|
|
else
|
|
#error handeling
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
# Differencies betwen install.cfg a install-old.cfg > found what work needs to be done
|
|
#
|
|
# If uninstall check for verification
|
|
#
|
|
# depandencies install
|
|
# files
|
|
# user
|
|
#
|
|
# velocity.toml
|
|
#
|
|
# mods
|
|
#
|
|
# firewall
|
|
#
|
|
# systemD rm script + cp new
|
|
#
|
|
# Tailscale install
|
|
#
|
|
# chown velocity:velocity
|
|
#
|
|
|
|
printf "\n Everythink is now set up. It is good idea to check these:"
|
|
printf "\n systemctl status mc-velocity"
|
|
printf "\n su velocity -s /bin/bash \n"
|
|
|
|
# Update install-old.cfg (date as version number)
|