mbuto: always display help message
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.
Signed-off-by Sevinj Aghayeva <[email protected]>
--- mbuto | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
mbuto +6 -1
@@ -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
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.
Signed-off-by Sevinj Aghayeva <[email protected]>--- mbuto | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)mbuto +6
-2@@ -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