From 127b7a12dbfabfe33b8d3733648c1bec1fa5d323 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 29 Jul 2014 23:21:02 +0200 Subject: Replace login name check with effective UID check. --- scripts/install/install-image-existing | 5 +++-- scripts/install/install-image-new | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/install/install-image-existing b/scripts/install/install-image-existing index 080313bd..ffb5bba3 100755 --- a/scripts/install/install-image-existing +++ b/scripts/install/install-image-existing @@ -54,8 +54,9 @@ is_amazon_ec2_ami () { fi } -if [ `whoami` != 'root' ] ; then - failure_exit 'This script must be run with root privileges.' +if [ $(id -u) != 0 ]; then + echo "Image installation requires root privileges!" + exit 1 fi # On image-installed systems, the image name can be found as the diff --git a/scripts/install/install-image-new b/scripts/install/install-image-new index 5c87c1ea..7965b939 100755 --- a/scripts/install/install-image-new +++ b/scripts/install/install-image-new @@ -1,8 +1,8 @@ #!/bin/bash -if [ `whoami` != 'root' ] ; then - echo "This script must be run with root privileges." - exit 1 +if [ $(id -u) != 0 ]; then + echo "Image installation requires root privileges!" + exit 1 fi # source in the functions -- cgit v1.2.3