From 05ff4302234b89ea41e86a9582520d7544d2cd20 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Mon, 4 Jul 2016 16:37:12 +0200 Subject: [PATCH] xbps-src: Preprocess arguments using getopt in order to allow options before and after XBPS_TARGET. --- xbps-src | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xbps-src b/xbps-src index e91bc67a0f5..1d47c94ee79 100755 --- a/xbps-src +++ b/xbps-src @@ -408,8 +408,12 @@ export XBPS_MACHINE=$(xbps-uhelper arch) # main() # XBPS_OPTIONS= +XBPS_OPTSTRING="a:CEfgGhH:Ij:Lm:No:r:tV" -while getopts "a:CEfgGhH:Ij:Lm:No:r:tV" opt; do +# Preprocess arguments in order to allow options before and after XBPS_TARGET. +eval set -- $(getopt -- "$XBPS_OPTSTRING" "$@"); + +while getopts "$XBPS_OPTSTRING" opt; do case $opt in a) readonly XBPS_CROSS_BUILD="$OPTARG"; XBPS_OPTIONS+=" -a $OPTARG";; C) readonly XBPS_KEEP_ALL=1; XBPS_OPTIONS+=" -C";;