All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mbuto: always display help message
@ 2022-04-18 15:55 Sevinj Aghayeva
  2022-04-18 16:00 ` Sevinj Aghayeva
  0 siblings, 1 reply; 2+ messages in thread
From: Sevinj Aghayeva @ 2022-04-18 15:55 UTC (permalink / raw)
  To: sbrivio; +Cc: outreachy

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 <sevinj.aghayeva@gmail.com>
---
 mbuto | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mbuto b/mbuto
index 49b8139..c9f0b18 100755
--- a/mbuto
+++ b/mbuto
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-18 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18 15:55 [PATCH] mbuto: always display help message Sevinj Aghayeva
2022-04-18 16:00 ` Sevinj Aghayeva

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.