aboutgitcode
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-03-30 05:07:36 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-04-06 12:29:43 +0200
commit6199e368f68dcc9faabb48277c9d014ea0a4f0db (patch)
tree871f0159f72876adea0f8e45f3e181e3078b7742
parent051fd93351848c3aaee158a6d84ba4af1beb584c (diff)
downloadmbuto-6199e368f68dcc9faabb48277c9d014ea0a4f0db.tar
mbuto-6199e368f68dcc9faabb48277c9d014ea0a4f0db.tar.gz
mbuto-6199e368f68dcc9faabb48277c9d014ea0a4f0db.tar.bz2
mbuto-6199e368f68dcc9faabb48277c9d014ea0a4f0db.tar.lz
mbuto-6199e368f68dcc9faabb48277c9d014ea0a4f0db.tar.xz
mbuto-6199e368f68dcc9faabb48277c9d014ea0a4f0db.tar.zst
mbuto-6199e368f68dcc9faabb48277c9d014ea0a4f0db.zip
mbuto: Parse options before fakeroot check
...so that we can display the help message even if fakeroot is not available. Suggested-by: Wainer dos Santos Moschetta <wmoschet@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rwxr-xr-xmbuto19
1 files changed, 10 insertions, 9 deletions
diff --git a/mbuto b/mbuto
index ef5faf7..99b0e2d 100755
--- a/mbuto
+++ b/mbuto
@@ -916,14 +916,7 @@ usage() {
################################################################################
-# Entry point: if we're not running as root, re-run with fakeroot
-if [ "${LD_PRELOAD}" != "libfakeroot-sysv.so" ] && [ "$(id -u)" -ne 0 ]; then
- if ! FAKEROOT="$(command -v fakeroot)"; then
- err "Not root and no fakeroot available, exiting"
- fi
- PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" "$@"
- exit ${?}
-fi
+ARGS=${@}
# Parse options
while getopts c:df:k:m:p:s:vh __opt; do
@@ -940,9 +933,17 @@ while getopts c:df:k:m:p:s:vh __opt; do
esac
done
shift $((OPTIND - 1))
-
[ -z "${PROFILE}" ] && PROFILE="base"
+# If we're not running as root, re-run with fakeroot
+if [ "${LD_PRELOAD}" != "libfakeroot-sysv.so" ] && [ "$(id -u)" -ne 0 ]; then
+ if ! FAKEROOT="$(command -v fakeroot)"; then
+ err "Not root and no fakeroot available, exiting"
+ fi
+ PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" ${ARGS}
+ exit ${?}
+fi
+
# Check needed tools, exit if any is missing
for __l in ${TOOLS}; do
cmd_check "${__l}"