summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-06-21 16:53:13 +0000
committerNicolas Vigier <boklm@mageia.org>2011-06-21 16:53:13 +0000
commita73cfdebff22fb433371b027c24742a2ffc7c76b (patch)
tree03d78c377faeec9a642b2651df640b7cbc0bc8d0
parent3a69c314c407949f29f59a85413a208137187907 (diff)
downloadmgatools-a73cfdebff22fb433371b027c24742a2ffc7c76b.tar
mgatools-a73cfdebff22fb433371b027c24742a2ffc7c76b.tar.gz
mgatools-a73cfdebff22fb433371b027c24742a2ffc7c76b.tar.bz2
mgatools-a73cfdebff22fb433371b027c24742a2ffc7c76b.tar.xz
mgatools-a73cfdebff22fb433371b027c24742a2ffc7c76b.zip
check arguments
-rw-r--r--functions14
-rw-r--r--mga-move-update17
2 files changed, 29 insertions, 2 deletions
diff --git a/functions b/functions
index d612ce3..9891247 100644
--- a/functions
+++ b/functions
@@ -14,3 +14,17 @@ function isingroup()
return 1
}
+function inlist()
+{
+ k="$1"
+ list="$2"
+ for e in $list
+ do
+ if [ a"$k" = a"$e" ]
+ then
+ return 0
+ fi
+ done
+ return 1
+}
+
diff --git a/mga-move-update b/mga-move-update
index a2423db..881a35f 100644
--- a/mga-move-update
+++ b/mga-move-update
@@ -5,12 +5,25 @@ moveupdate_allowed_group=mga-qa
dryrun=echo
+if [ $# != 3 ]
+then
+ echo 'Usage: mga-move-update distrorelease section srcname' >&2
+ exit 1
+fi
+
distrorelease="$1"
section="$2"
srcname="$3"
-if test -z $distrorelease || test -z $section || test -z $srcname
+
+if ! inlist "$distrorelease" "$distroreleases"
+then
+ echo "Incorrect distrorelease $distrorelease" >&2
+ exit 1
+fi
+
+if ! inlist "$section" "$distrosections"
then
- echo 'Missing argument' >&2
+ echo "Incorrect section $section" >&2
exit 1
fi