mirror of https://gitlab.com/dabruh/dotfiles.git
Prevent running as root
This commit is contained in:
parent
0adf10cfe9
commit
b588774f7e
|
@ -345,6 +345,11 @@ function setup_debian() {
|
||||||
change_shell || return 13
|
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)"
|
ID_LIKE="$(grep ID_LIKE= </etc/os-release | cut -d= -f2)"
|
||||||
|
|
||||||
echo "Setting up ${ID_LIKE^:?}-like OS."
|
echo "Setting up ${ID_LIKE^:?}-like OS."
|
||||||
|
@ -355,7 +360,7 @@ elif [[ "$ID_LIKE" == "debian" ]]; then
|
||||||
setup_debian || echo "Setup failed: $?"
|
setup_debian || echo "Setup failed: $?"
|
||||||
else
|
else
|
||||||
echo "ERROR: Unsupported system: ID_LIKE=$ID_LIKE"
|
echo "ERROR: Unsupported system: ID_LIKE=$ID_LIKE"
|
||||||
exit 2
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Setup finished."
|
echo "Setup finished."
|
||||||
|
|
Loading…
Reference in New Issue