diff options
author | Yann E. MORIN" <yann.morin.1998@free.fr> | 2013-01-10 21:38:48 (GMT) |
---|---|---|
committer | Yann E. MORIN" <yann.morin.1998@free.fr> | 2013-01-10 21:38:48 (GMT) |
commit | 1cabb74b7d629262319c9e348962088a0697fe33 (patch) | |
tree | a07a24a0e78a8d6ce1180103442d95972651023d /scripts | |
parent | ffe80db73c6b85ea08883fb9f7ca78101431e0a1 (diff) |
scripts: check for running as root
Running as root is really, really dangerous.
Add a runtime-check that refuses to build if running as root.
Can be overriden with a double switch in the menuconfig.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/crosstool-NG.sh.in | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index c15415b..512880e 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -25,6 +25,14 @@ . .config.2 # Yes! We can do full logging from now on! +# Check running as root +if [ -z "${CT_ALLOW_BUILD_AS_ROOT_SURE}" ]; then + if [ $(id -u) -eq 1000 ]; then + CT_DoLog ERROR "You must NOT be root to run crosstool-NG" + exit 1 + fi +fi + # If we want an interactive debug-shell, we must ensure these FDs # are indeed connected to a terminal (and not redirected in any way). if [ "${CT_DEBUG_INTERACTIVE}" = "y" -a ! \( -t 0 -a -t 6 -a -t 2 \) ]; then |