Restart with superuser privileges if needed

This commit is contained in:
zador-blood-stained
2015-12-07 16:55:53 +03:00
parent 9ccabdf637
commit ea1f4b877e
2 changed files with 9 additions and 12 deletions

View File

@@ -60,17 +60,22 @@ if [ -d "$DEST/output" ]; then
read
fi
if [ $EUID != 0 ]; then
echo -e "[\e[0;35m warn \x1B[0m] This script requires root privileges"
sudo "$0" "$@"
exit 1
fi
#--------------------------------------------------------------------------------------------------------------------------------
# Get updates of the main build libraries
#--------------------------------------------------------------------------------------------------------------------------------
apt-get -qq -y install git
if [ -d "$SRC/lib" ]; then
cd $SRC/lib
git pull
cd $SRC/lib
git pull
else
# download SDK
git clone --depth 1 https://github.com/igorpecovnik/lib
# download SDK
git clone --depth 1 https://github.com/igorpecovnik/lib
fi

View File

@@ -13,14 +13,6 @@
#
#
# currently there is no option to create an image without root
# you can compile a kernel but you can complete the whole process
# if you find a way, please submit code corrections. Thanks.
if [ "$UID" -ne 0 ]
then echo "Please run as root"; exit
fi
# We'll use this tittle on all menus
backtitle="Armbian building script, http://www.armbian.com | Author: Igor Pecovnik"
mkdir -p $DEST/debug $SRC/userpatches/kernel $SRC/userpatches/u-boot