From b6d3423b7adcf4efde6f7c7d7c4f814916945d77 Mon Sep 17 00:00:00 2001 From: Igor Borisoglebski Date: Thu, 7 Dec 2023 11:26:57 +0000 Subject: [PATCH] include root user check on uninstall script --- scripts/uninstallLobby.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/uninstallLobby.sh b/scripts/uninstallLobby.sh index 2273f9c..2b5c48c 100644 --- a/scripts/uninstallLobby.sh +++ b/scripts/uninstallLobby.sh @@ -5,10 +5,20 @@ LOBBY_BIN_PATH=${LOBBY_BIN_DIR}/${LOBBY_BIN_NAME} LOBBY_CONF_DIR='/etc/lobby' LOBBY_ROOT_SERVICE_PATH='/etc/systemd/system/lobby.service' +RED='\033[0;31m' +NC='\033[0m' # No color + intro() { echo Uninstalling Lobby } +checkDeps() { + if [ "$(id -u)" -ne 0 ]; then + printf '%bThis uninstaller must be run as '\''root'\'' user%b\n\n' "$RED" "$NC" + exit 1 + fi +} + deleteBin() { if [ -f "$LOBBY_BIN_PATH" ]; then rm -rf "$LOBBY_BIN_PATH" @@ -39,6 +49,8 @@ outro() { intro +checkDeps + deleteBin deleteConf