From 0e47c265fc4608f95a92442965645ce39fbe6c0d Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Tue, 13 Aug 2024 23:14:54 +0200 Subject: [PATCH] use _root_check --- usr/bin/archboot-clean-blockdevice.sh | 6 +----- usr/bin/archboot-restore-usbstick.sh | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/usr/bin/archboot-clean-blockdevice.sh b/usr/bin/archboot-clean-blockdevice.sh index 473a0f34c..0e420752b 100755 --- a/usr/bin/archboot-clean-blockdevice.sh +++ b/usr/bin/archboot-clean-blockdevice.sh @@ -16,11 +16,7 @@ _usage() } ################################################## [[ -z "${1}" ]] && _usage -### check for root -if ! [[ ${UID} -eq 0 ]]; then - echo "ERROR: Please run as root user!" - exit 1 -fi +_root_check echo -e "\e[1mCleaning blockdevice(s) $*...\e[m" echo -e "\e[91mWARNING: 10 seconds for hitting CTRL+C to stop the process on $* now! \e[m" sleep 10 diff --git a/usr/bin/archboot-restore-usbstick.sh b/usr/bin/archboot-restore-usbstick.sh index 50881d24d..24744fef6 100755 --- a/usr/bin/archboot-restore-usbstick.sh +++ b/usr/bin/archboot-restore-usbstick.sh @@ -14,12 +14,8 @@ _usage() exit 0 } ################################################## -[[ -z "${1}" ]] && _usage "$@" -### check for root -if ! [[ ${UID} -eq 0 ]]; then - echo "ERROR: Please run as root user!" - exit 1 -fi +[[ -z "${1}" ]] && _usage +_root_check echo -e "\e[91mWARNING: 10 seconds for hitting CTRL+C to stop the process on ${1} now! \e[m" sleep 10 # clean partitiontable