mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
add root check and output usage if no $1 given
This commit is contained in:
parent
79cb6aafa8
commit
bd3aaa7dc4
1 changed files with 9 additions and 4 deletions
|
@ -147,16 +147,21 @@ preload_builtin_modules() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
usage
|
||||||
|
cleanup 0
|
||||||
|
fi
|
||||||
|
### check for root
|
||||||
|
if ! [[ ${UID} -eq 0 ]]; then
|
||||||
|
echo "ERROR: Please run as root user!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
# shellcheck source=functions
|
# shellcheck source=functions
|
||||||
. "$_f_functions"
|
. "$_f_functions"
|
||||||
_opt_short='c:d:g:hk:'
|
_opt_short='c:d:g:hk:'
|
||||||
parseopts "$_opt_short" -- "$@" || exit 1
|
parseopts "$_opt_short" -- "$@" || exit 1
|
||||||
set -- "${OPTRET[@]}"
|
set -- "${OPTRET[@]}"
|
||||||
unset _opt_short OPTRET
|
unset _opt_short OPTRET
|
||||||
if [[ -z "$1" ]]; then
|
|
||||||
usage
|
|
||||||
cleanup 0
|
|
||||||
fi
|
|
||||||
while :; do
|
while :; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-c|--config)
|
-c|--config)
|
||||||
|
|
Loading…
Reference in a new issue