aboutgitcode
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-04-22 11:24:45 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-04-22 11:24:45 +0200
commit5a51411e558a0609b5cf22ddbbe3d4a72e655e30 (patch)
tree27be4d2505aa7707409566fe9dc4e94eca2390ac
parentcd7f0e77340f869cb65aa756f9f6f888a3e4d084 (diff)
downloadmbuto-5a51411e558a0609b5cf22ddbbe3d4a72e655e30.tar
mbuto-5a51411e558a0609b5cf22ddbbe3d4a72e655e30.tar.gz
mbuto-5a51411e558a0609b5cf22ddbbe3d4a72e655e30.tar.bz2
mbuto-5a51411e558a0609b5cf22ddbbe3d4a72e655e30.tar.lz
mbuto-5a51411e558a0609b5cf22ddbbe3d4a72e655e30.tar.xz
mbuto-5a51411e558a0609b5cf22ddbbe3d4a72e655e30.tar.zst
mbuto-5a51411e558a0609b5cf22ddbbe3d4a72e655e30.zip
mbuto: Display help message even if fakeroot is not found
The aim is the same as commit 6199e368f68d ("mbuto: Parse options before fakeroot check"), without, however, touching arguments before calling the script itself, which was the problem highlighted by commit 2458f4064b63 ("mbuto: undo commit 6199e368"). Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rwxr-xr-xmbuto12
1 files changed, 9 insertions, 3 deletions
diff --git a/mbuto b/mbuto
index 49b8139..6918415 100755
--- a/mbuto
+++ b/mbuto
@@ -1179,10 +1179,11 @@ usage() {
# 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"
+ __fakeroot_missing="y"
+ else
+ PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" "${@}"
+ exit ${?}
fi
- PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" "${@}"
- exit ${?}
fi
# Parse options
@@ -1206,6 +1207,11 @@ done
shift $((OPTIND - 1))
[ -z "${PROFILE}" ] && PROFILE="base"
+if [ "${__fakeroot_missing}" = "y" ]; then
+ err "Not root and no fakeroot available, exiting"
+ exit 1
+fi
+
# Check needed tools, exit if any is missing
for __l in ${TOOLS}; do
cmd_check "${__l}"