summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmga-move-pkg25
1 files changed, 12 insertions, 13 deletions
diff --git a/mga-move-pkg b/mga-move-pkg
index 0f5af54..f7602c1 100755
--- a/mga-move-pkg
+++ b/mga-move-pkg
@@ -21,22 +21,13 @@ if [ "$1" = "--no-confirm" ]; then
shift
fi
-backport=
-if [ "$1" = "--backport" ]; then
- backport=y
- shift
-fi
-
function usage()
{
- echo "Usage: $(basename $0) [--dry-run] [--sync] [--no-confirm] [--backport] <release>/<section>/<pkg> [<release>/<section>/<pkg>...]" >&2
+ echo "Usage: $(basename $0) [--dry-run] [--sync] [--no-confirm] [--backport] <release>/<section>/<pkg> [[--backport] <release>/<section>/<pkg>...]" >&2
exit 1
}
[ $# -lt 1 ] && usage
-declare subsection='updates';
-[ -n "$backport" ] && subsection='backports';
-
declare -a _releases;
declare -a _sections;
declare -a _srcsubsections;
@@ -51,10 +42,17 @@ declare _fullsrpmname="y"
function parse_args()
{
local -a tmptriplet;
+ local subsection;
local -i i=0;
- for arg in "$@"; do
- OIFS="$IFS"; IFS=/; tmptriplet=($arg); IFS="$OIFS";
+ while [ $# -gt 0 ]; do
+ subsection='updates';
+ if [ "$1" = "--backport" ]; then
+ subsection='backports';
+ shift
+ fi
+
+ OIFS="$IFS"; IFS=/; tmptriplet=($1); IFS="$OIFS";
[ ${#tmptriplet[*]} -ne 3 ] && usage
@@ -70,13 +68,14 @@ function parse_args()
# Special case in cauldron where we move updates_testing -> release
if [ 'cauldron' = "${_releases[$i]}" ]; then
- if [ -n "$backport" ]; then
+ if [ 'backports' = "$subsection" ]; then
echo "Error: Cannot use --backport with cauldron" >&2
exit 1
fi
_destsubsections[$i]="release"
fi
((++i))
+ shift
done
}
parse_args "$@"