mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-07 16:54:16 +01:00
1660a915e2
As status command relies on log, we should always use console as output Co-authored-by: mlsmaycon <mlsmaycon@gmail.com>
44 lines
952 B
Bash
44 lines
952 B
Bash
#!/bin/sh
|
|
# decide if we should use systemd or init/upstart
|
|
use_systemctl="True"
|
|
systemd_version=0
|
|
if ! command -V systemctl >/dev/null 2>&1; then
|
|
use_systemctl="False"
|
|
else
|
|
systemd_version=$(systemctl --version | head -1 | sed 's/systemd //g')
|
|
fi
|
|
|
|
remove() {
|
|
printf "\033[32m Pre uninstall\033[0m\n"
|
|
|
|
if [ "${use_systemctl}" = "True" ]; then
|
|
printf "\033[32m Stopping the service\033[0m\n"
|
|
systemctl stop wiretrustee || true
|
|
|
|
if [ -e /lib/systemd/system/wiretrustee.service ]; then
|
|
rm -f /lib/systemd/system/wiretrustee.service
|
|
systemctl daemon-reload || true
|
|
fi
|
|
|
|
fi
|
|
printf "\033[32m Uninstalling the service\033[0m\n"
|
|
/usr/bin/wiretrustee service uninstall || true
|
|
|
|
|
|
if [ "${use_systemctl}" = "True" ]; then
|
|
printf "\n\033[32m running daemon reload\033[0m\n"
|
|
systemctl daemon-reload || true
|
|
fi
|
|
}
|
|
|
|
action="$1"
|
|
|
|
case "$action" in
|
|
"0" | "remove")
|
|
remove
|
|
;;
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|