commit 950d0d97ba08584e89c276a8376eac20b4066099
parent 6c0218395b01e77f247bfa9b9ae48d113a5aa627
Author: Cem Keylan <cem@ckyln.com>
Date: Fri, 10 Jan 2020 10:06:23 +0300
mkrootfs.sh: exit if the user doesn't have priviliges
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/mkrootfs.sh b/mkrootfs.sh
@@ -11,6 +11,9 @@ die() { error "$1"; exit 1 ;}
ask() { printf "\033[1;33m== $1 ==\\n(y/N) "; read ans; case "$ans" in [Yy]*) return 0 ;; *) return 1 ;; esac ;}
+# Exit if the user is not root
+! [ "$(id -u)" -eq 0 ] && die "Please run as root"
+
# Let's get current working directory
BASEDIR="$PWD"