@@ -42,3 +42,4 @@ Error codes:
32 Device is smaller than the manually specified size
40 One of the programs called from the script returned a non 0 value. Check the stderr to get the code
+41 The effective user id of the calling user is not 0. Only root can run this tool
@@ -17,6 +17,7 @@ BESTSIZE_E=31
MANUALSIZE_E=32
PROG_E=40
+NOROOT_E=41
fatal()
{
@@ -8,6 +8,10 @@ PROGRAM_NAME="$0"
. "${DIR}/conversion.sh"
. "${DIR}/check-device.sh"
+if [ ${EUID} -ne 0 ]; then
+ fatal $NOROOT_E "must be root to run this program"
+fi
+
parse_arguments $@
# removing lvm and other filesystem signatures
@@ -121,6 +121,7 @@ help()
+ 41 The effective user id of the calling user is not 0. Only root can run this tool
error-end
fi
}