Skip to contentSkip to conversation

mbuto: always display help message

PATCH Superseded Sevinj Aghayeva 1 participant 2 messages Apr 18, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mbuto: always display help message

Currently, if the user is not root or if fakeroot is not available, no help message is displayed. Parse the command line, display the help message and then exit if the user is not root or if fakeroot is not available.

---
 mbuto | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
mbuto +6 -1
index 49b8139..c9f0b18 100755
@@ -1179,7 +1179,7 @@ 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"
+		__missing_fakeroot=1
 	fi
 	PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" "${@}"
 	exit ${?}
@@ -1203,6 +1203,11 @@ while getopts :c:df:k:m:p:s:vh __opt; do
 	h|*) usage						;;
 	esac
 done
+
+if [ ${__missing_fakeroot} -eq 1 ]; then
+	err "Not root and no fakeroot available, exiting"
+fi
+
 shift $((OPTIND - 1))
 [ -z "${PROFILE}" ] && PROFILE="base"
 
Signature · 1 line
2.25.1
#1 lore raw

Please ignore this one. I didn't check it properly.

Quoted 38 lines · Sevinj Aghayeva

Currently, if the user is not root or if fakeroot is not available, no help message is displayed. Parse the command line, display the help message and then exit if the user is not root or if fakeroot is not available.

---
 mbuto | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
mbuto +6 -2
index 49b8139..c9f0b18 100755
@@ -1179,7 +1179,7 @@ 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"
+               __missing_fakeroot=1
        fi
        PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" "${@}"
        exit ${?}
@@ -1203,6 +1203,11 @@ while getopts :c:df:k:m:p:s:vh __opt; do
        h|*) usage                                              ;;
        esac
 done
+
+if [ ${__missing_fakeroot} -eq 1 ]; then
+       err "Not root and no fakeroot available, exiting"
+fi
+
 shift $((OPTIND - 1))
 [ -z "${PROFILE}" ] && PROFILE="base"
 
--

2.25.1

Signature · 1 line
Sevinj.Aghayeva