fix(archroot): preserve original args for check_root before discarding
arch-nspawn, mkarchroot, makerepropkg all call "shift" after getopts
processing. Save the original args and pass on to check_root to prevent
options being discarded.
Fixes 41d4624879
Fixes #149
Signed-off-by: Toolybird <toolybird@tuta.io>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
This commit is contained in:
parent
1b808b8e32
commit
71cb9e97bb
|
@ -32,6 +32,9 @@ usage() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
# save all args for check_root
|
||||
orig_args=("$@")
|
||||
|
||||
while getopts 'hC:M:c:f:s' arg; do
|
||||
case "$arg" in
|
||||
C) pac_conf="$OPTARG" ;;
|
||||
|
@ -46,7 +49,7 @@ done
|
|||
shift $((OPTIND - 1))
|
||||
|
||||
(( $# < 1 )) && die 'You must specify a directory.'
|
||||
check_root "" "${BASH_SOURCE[0]}" "$@"
|
||||
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
|
||||
|
||||
working_dir=$(readlink -f "$1")
|
||||
shift 1
|
||||
|
|
|
@ -125,6 +125,9 @@ OPTIONS
|
|||
__EOF__
|
||||
}
|
||||
|
||||
# save all args for check_root
|
||||
orig_args=("$@")
|
||||
|
||||
while getopts 'dM:c:l:h' arg; do
|
||||
case "$arg" in
|
||||
d) diffoscope=1 ;;
|
||||
|
@ -137,7 +140,7 @@ while getopts 'dM:c:l:h' arg; do
|
|||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
check_root "" "${BASH_SOURCE[0]}" "$@"
|
||||
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
|
||||
|
||||
[[ -f PKGBUILD ]] || { error "No PKGBUILD in current directory."; exit 1; }
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@ usage() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
# save all args for check_root
|
||||
orig_args=("$@")
|
||||
|
||||
while getopts 'hUC:M:c:f:s' arg; do
|
||||
case "$arg" in
|
||||
U) umode=U ;;
|
||||
|
@ -52,7 +55,7 @@ shift $((OPTIND - 1))
|
|||
|
||||
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
||||
|
||||
check_root "" "${BASH_SOURCE[0]}" "$@"
|
||||
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
|
||||
|
||||
working_dir="$(readlink -f "$1")"
|
||||
shift 1
|
||||
|
|
Loading…
Reference in New Issue