Scripts: Fix error messages in erase-disk.sh

This commit is contained in:
the_4n0nym0u53 2022-02-24 22:08:14 +01:00
parent 7dd2d85547
commit b29b88621c
No known key found for this signature in database
GPG key ID: 35EE09F5481049BB

View file

@ -20,20 +20,24 @@ usage() {
echo "be run as root."
echo
echo "erase-disk.sh is licensed under The Unlicense."
exit 0
}
[ "$1" = "-h" -o "$1" = "--help" ] && usage
[ "$1" = "-h" -o "$1" = "--help" ] && usage && exit 0
if [ $(id -u) -ne 0 ]; then
echo "This script must be run as root. Quitting..."
if [ $# -lt 2 ]; then
echo "ERROR: Not enough options!"
echo
usage
exit 1
elif [ -z "$1" ]; then
echo "Please specify number of passes. Quitting..."
elif [ $# -gt 2 ]; then
echo "ERROR: Too many options!"
echo
usage
exit 1
elif [ -z "$2" ]; then
echo "Please specify device to erase. Quitting..."
elif [ $(id -u) -ne 0 ]; then
echo "ERROR: Must run as root!"
echo
usage
exit 1
fi