From 950d0d97ba08584e89c276a8376eac20b4066099 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Fri, 10 Jan 2020 10:06:23 +0300 Subject: mkrootfs.sh: exit if the user doesn't have priviliges --- mkrootfs.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mkrootfs.sh b/mkrootfs.sh index e7f8d95..7b91e61 100755 --- 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" -- cgit v1.2.3