Make usage message appear before root user check
This allows joe user to see the usage message without having to specify -h. Trivial. Signed-off-by: Simo Leone <simo@archlinux.org>
This commit is contained in:
parent
9a34024e57
commit
4b62e90475
1 changed files with 5 additions and 5 deletions
10
mkarchiso
10
mkarchiso
|
@ -47,17 +47,17 @@ while getopts 'i:P:p:a:fvh' arg; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
|
echo "ARGS: $@"
|
||||||
|
|
||||||
|
[ $# -le 1 ] && usage 1
|
||||||
|
|
||||||
# do UID checking here so someone can at least get usage instructions
|
# do UID checking here so someone can at least get usage instructions
|
||||||
if [ "$EUID" != "0" ]; then
|
if [ "$EUID" != "0" ]; then
|
||||||
echo "error: This script must be run as root."
|
echo "error: This script must be run as root."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
shift $(($OPTIND - 1))
|
|
||||||
echo "ARGS: $@"
|
|
||||||
|
|
||||||
[ $# -le 1 ] && usage 1
|
|
||||||
|
|
||||||
command_name="${1}"
|
command_name="${1}"
|
||||||
case "${command_name}" in
|
case "${command_name}" in
|
||||||
install) work_dir="${2}" ;;
|
install) work_dir="${2}" ;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue