[arch-projects] [devtools] [PATCH 2/4] makechrootpkg: Look harder for -R argument

Dave Reisner dreisner at archlinux.org
Sun Oct 20 16:17:43 EDT 2013

We shouldn't be in the business of reparsing makepkg's arguments, but
since we have to treat the case of repackaging separately, do a better
job of trying to find signs of it happening. This change lets you pass
the longopt, --repackage, or multiple shortopts such as -RA, and still
get the intended effect.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
This still isn't really an exact science, but it improves the current

 makechrootpkg.in | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/makechrootpkg.in b/makechrootpkg.in
index 8c64ae1..00e538a 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -104,11 +104,13 @@ fi
 makepkg_args="$makepkg_args ${*:$OPTIND}"
 # See if -R was passed to makepkg
-for arg in ${*:$OPTIND}; do
-	if [[ $arg = -R ]]; then
-		repack=true
-		break
-	fi
+for arg in "${@:OPTIND}"; do
+	case ${arg%%=*} in
+		-*R*|--repackage)
+			repack=true
+			break 2
+			;;
+	esac
 if [[ -n $SUDO_USER ]]; then

More information about the arch-projects mailing list