From 5a51411e558a0609b5cf22ddbbe3d4a72e655e30 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Fri, 22 Apr 2022 11:24:45 +0200 Subject: 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 --- mbuto | 12 +++++++++--- 1 file 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}" -- cgit v1.2.3