Prevent running as root

This commit is contained in:
dabruh 2022-12-14 11:48:21 +01:00
parent 0adf10cfe9
commit b588774f7e

View file

@ -345,6 +345,11 @@ function setup_debian() {
change_shell || return 13
}
if [ "$EUID" -eq 0 ]; then
echo "Don't run this script as root." 1>&2
exit 2
fi
ID_LIKE="$(grep ID_LIKE= </etc/os-release | cut -d= -f2)"
echo "Setting up ${ID_LIKE^:?}-like OS."
@ -355,7 +360,7 @@ elif [[ "$ID_LIKE" == "debian" ]]; then
setup_debian || echo "Setup failed: $?"
else
echo "ERROR: Unsupported system: ID_LIKE=$ID_LIKE"
exit 2
exit 3
fi
echo "Setup finished."