mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-12 04:46:46 +02:00
fix: avoid failing and extra error messages (#136)
* avoid failing and extra error messages * avoid extra error messages when executed after pre_remove.sh * remove extra output and avoid failure on minor errors * ensure the steps will run only on remove
This commit is contained in:
parent
74485d3b13
commit
1323a74db0
@ -13,21 +13,23 @@ cleanInstall() {
|
|||||||
printf "\033[32m Post Install of an clean install\033[0m\n"
|
printf "\033[32m Post Install of an clean install\033[0m\n"
|
||||||
# Step 3 (clean install), enable the service in the proper way for this platform
|
# Step 3 (clean install), enable the service in the proper way for this platform
|
||||||
/usr/local/bin/wiretrustee service install
|
/usr/local/bin/wiretrustee service install
|
||||||
|
/usr/local/bin/wiretrustee service start
|
||||||
}
|
}
|
||||||
|
|
||||||
upgrade() {
|
upgrade() {
|
||||||
printf "\033[32m Post Install of an upgrade\033[0m\n"
|
printf "\033[32m Post Install of an upgrade\033[0m\n"
|
||||||
if [ "${use_systemctl}" = "True" ]; then
|
if [ "${use_systemctl}" = "True" ]; then
|
||||||
printf "\033[32m Stopping the service\033[0m\n"
|
printf "\033[32m Stopping the service\033[0m\n"
|
||||||
systemctl stop wiretrustee
|
systemctl stop wiretrustee 2> /dev/null || true
|
||||||
fi
|
fi
|
||||||
if [ -e /lib/systemd/system/wiretrustee.service ]; then
|
if [ -e /lib/systemd/system/wiretrustee.service ]; then
|
||||||
rm -f /lib/systemd/system/wiretrustee.service
|
rm -f /lib/systemd/system/wiretrustee.service
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
fi
|
fi
|
||||||
# will trow an error until everyone upgrade
|
# will trow an error until everyone upgrade
|
||||||
/usr/local/bin/wiretrustee service uninstall
|
/usr/local/bin/wiretrustee service uninstall 2> /dev/null || true
|
||||||
/usr/local/bin/wiretrustee service install
|
/usr/local/bin/wiretrustee service install
|
||||||
|
/usr/local/bin/wiretrustee service start
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if this is a clean install or an upgrade
|
# Check if this is a clean install or an upgrade
|
||||||
@ -45,12 +47,9 @@ case "$action" in
|
|||||||
cleanInstall
|
cleanInstall
|
||||||
;;
|
;;
|
||||||
"2" | "upgrade")
|
"2" | "upgrade")
|
||||||
printf "\033[32m Post Install of an upgrade\033[0m\n"
|
|
||||||
upgrade
|
upgrade
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# $1 == version being installed
|
|
||||||
printf "\033[32m install\033[0m"
|
|
||||||
cleanInstall
|
cleanInstall
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
@ -8,23 +8,36 @@ else
|
|||||||
systemd_version=$(systemctl --version | head -1 | sed 's/systemd //g')
|
systemd_version=$(systemctl --version | head -1 | sed 's/systemd //g')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\033[32m Pre uninstall\033[0m\n"
|
remove() {
|
||||||
|
printf "\033[32m Pre uninstall\033[0m\n"
|
||||||
|
|
||||||
if [ "${use_systemctl}" = "True" ]; then
|
if [ "${use_systemctl}" = "True" ]; then
|
||||||
printf "\033[32m Stopping the service\033[0m\n"
|
printf "\033[32m Stopping the service\033[0m\n"
|
||||||
systemctl stop wiretrustee
|
systemctl stop wiretrustee || true
|
||||||
|
|
||||||
|
if [ -e /lib/systemd/system/wiretrustee.service ]; then
|
||||||
|
rm -f /lib/systemd/system/wiretrustee.service
|
||||||
|
systemctl daemon-reload || true
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -e /lib/systemd/system/wiretrustee.service ]; then
|
|
||||||
rm -f /lib/systemd/system/wiretrustee.service
|
|
||||||
systemctl daemon-reload
|
|
||||||
fi
|
fi
|
||||||
|
printf "\033[32m Uninstalling the service\033[0m\n"
|
||||||
fi
|
/usr/local/bin/wiretrustee service uninstall || true
|
||||||
printf "\033[32m Uninstalling the service\033[0m\n"
|
|
||||||
/usr/local/bin/wiretrustee service uninstall
|
|
||||||
|
|
||||||
|
|
||||||
if [ "${use_systemctl}" = "True" ]; then
|
if [ "${use_systemctl}" = "True" ]; then
|
||||||
printf "\n\033[32m running daemon reload\033[0m\n"
|
printf "\n\033[32m running daemon reload\033[0m\n"
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload || true
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
action="$1"
|
||||||
|
|
||||||
|
case "$action" in
|
||||||
|
"0" | "remove")
|
||||||
|
remove
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user