Check privileges much earlier

This commit is contained in:
Ben Allen
2022-12-02 14:08:22 -05:00
parent f13f05eb94
commit a1b2c28a42

View File

@@ -28,6 +28,11 @@ cat <<HELP_USAGE
HELP_USAGE
}
if ! [ "$(id -u)" = 0 ]; then
echo "${0}: This command must be run as root"
exit 1
fi
# Constants
QUIET=false
EXITCODE=0
@@ -294,11 +299,6 @@ is_tty() {
# {% endraw %}
if ! [ "$(id -u)" = 0 ]; then
echo "${0}: This command must be run as root"
exit 1
fi
while getopts ':hq' OPTION; do
case "$OPTION" in
h)