All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
To: sbrivio@redhat.com
Cc: outreachy@lists.linux.dev
Subject: [PATCH] mbuto: always display help message
Date: Mon, 18 Apr 2022 11:55:30 -0400	[thread overview]
Message-ID: <20220418155530.GA43865@euclid> (raw)

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


             reply	other threads:[~2022-04-18 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18 15:55 Sevinj Aghayeva [this message]
2022-04-18 16:00 ` [PATCH] mbuto: always display help message Sevinj Aghayeva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220418155530.GA43865@euclid \
    --to=sevinj.aghayeva@gmail.com \
    --cc=outreachy@lists.linux.dev \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.