From ea1f4b877e11d7eb1bc17d72cc8d1a1fe7ffb354 Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Mon, 7 Dec 2015 16:55:53 +0300 Subject: [PATCH] Restart with superuser privileges if needed --- compile.sh | 13 +++++++++---- main.sh | 8 -------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/compile.sh b/compile.sh index 1bf9a82418..b51f45a48f 100644 --- a/compile.sh +++ b/compile.sh @@ -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 diff --git a/main.sh b/main.sh index e1c430b230..f256145cd2 100644 --- a/main.sh +++ b/main.sh @@ -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