1.1 --- a/config/global/ct-behave.in Thu Jan 10 21:01:59 2013 +0100
1.2 +++ b/config/global/ct-behave.in Thu Jan 10 22:38:48 2013 +0100
1.3 @@ -29,6 +29,37 @@
1.4 - non-existant, in which case you could also try hacking it in and send me
1.5 the result
1.6
1.7 +config ALLOW_BUILD_AS_ROOT
1.8 + bool
1.9 + prompt "Allow building as root user (READ HELP!)"
1.10 + depends on EXPERIMENTAL
1.11 + help
1.12 + You normally do *not* need to be root to build a toolchain using
1.13 + crosstool-NG. In fact, it is *VERY* dangerous to run as root, as
1.14 + crosstool-NG will, as part of the build process, remove a few
1.15 + directories. If anything goes wrong, running as root can ruin
1.16 + your host distribution.
1.17 +
1.18 + I can't stress it enough: DO NOT RUN AS ROOT !!
1.19 +
1.20 + Do not run as root, you've been warned.
1.21 + Do not come whining, if it nukes your host system.
1.22 + Do not come whining, if you lose any data.
1.23 + Do not run as root.
1.24 +
1.25 + Do not run as root, you've been warned.
1.26 + Do not come whining, if the Earth stops rotating.
1.27 + Do not come whining, if kittens are smashed.
1.28 + Do not run as root.
1.29 +
1.30 + Do not run as root, do not run as root!
1.31 + (ad libitum)
1.32 +
1.33 +config ALLOW_BUILD_AS_ROOT_SURE
1.34 + bool
1.35 + prompt "Are you sure?"
1.36 + depends on ALLOW_BUILD_AS_ROOT
1.37 +
1.38 config DEBUG_CT
1.39 bool
1.40 prompt "Debug crosstool-NG"
2.1 --- a/scripts/crosstool-NG.sh.in Thu Jan 10 21:01:59 2013 +0100
2.2 +++ b/scripts/crosstool-NG.sh.in Thu Jan 10 22:38:48 2013 +0100
2.3 @@ -25,6 +25,14 @@
2.4 . .config.2
2.5 # Yes! We can do full logging from now on!
2.6
2.7 +# Check running as root
2.8 +if [ -z "${CT_ALLOW_BUILD_AS_ROOT_SURE}" ]; then
2.9 + if [ $(id -u) -eq 1000 ]; then
2.10 + CT_DoLog ERROR "You must NOT be root to run crosstool-NG"
2.11 + exit 1
2.12 + fi
2.13 +fi
2.14 +
2.15 # If we want an interactive debug-shell, we must ensure these FDs
2.16 # are indeed connected to a terminal (and not redirected in any way).
2.17 if [ "${CT_DEBUG_INTERACTIVE}" = "y" -a ! \( -t 0 -a -t 6 -a -t 2 \) ]; then