diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-10-24 21:01:29 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-10-24 21:01:29 +0000 |
commit | 64d70cc4b3364691a01fd8f0d4fad9c8974383db (patch) | |
tree | 99969b2c2326ae2e8b4cf44f3e6f8472047826a8 | |
parent | 036557c8c0d4da21fd01aa6d70e782f6934a4071 (diff) | |
download | abuild-64d70cc4b3364691a01fd8f0d4fad9c8974383db.tar.gz abuild-64d70cc4b3364691a01fd8f0d4fad9c8974383db.tar.bz2 abuild-64d70cc4b3364691a01fd8f0d4fad9c8974383db.tar.xz abuild-64d70cc4b3364691a01fd8f0d4fad9c8974383db.zip |
abuild: exit with error if run as root
override with -F
-rwxr-xr-x | abuild.in | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -957,6 +957,7 @@ usage() { echo "Options:" echo " -d Disable dependency checking" echo " -f Force specified cmd, even if they are already done" + echo " -F Force run as root" echo " -h Show this help" echo " -i Install PKG after successul build" echo " -k Keep built packages, even if APKBUILD or sources are newer" @@ -993,10 +994,11 @@ usage() { APKBUILD="${APKBUILD:-./APKBUILD}" unset force unset recursive -while getopts "dfhi:kinp:P:qrRs:u" opt; do +while getopts "dfFhi:kinp:P:qrRs:u" opt; do case $opt in 'd') nodeps=1;; 'f') force=1;; + 'F') forceroot=1;; 'h') usage;; 'i') install_after="$install_after $OPTARG";; 'k') keep=1;; @@ -1013,6 +1015,13 @@ while getopts "dfhi:kinp:P:qrRs:u" opt; do done shift $(( $OPTIND - 1 )) +# check so we are not root +if [ "$(whoami)" = "root" ] && [ -z "$FAKEROOTKEY" ]; then + [ -z "$forceroot" ] && die "Do not run abuild as root" + SUDO= + FAKEROOT= +fi + # find startdir [ -f "$APKBUILD" ] || die "Could not find $APKBUILD (PWD=$PWD)" APKBUILD=$(readlink -f "$APKBUILD") |