Do not accept any command line arguments we can't handle
authorMichael Prokop <mika@grml.org>
Fri, 27 Jul 2012 12:43:40 +0000 (14:43 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 27 Jul 2012 12:51:08 +0000 (14:51 +0200)
When executing something like:

| grml-live [...] -V B -q

this doesn't skip the mksquashfs stage (and neither the chroot
build stage of course) because the "B" can't be processed for
obvious reasons.  The user mistyped the "-B" here, but then we
shouldn't even try to execute the command line, so just exit in
such a case.

grml-live

index 3964cbd..0aed77e 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -337,6 +337,11 @@ while getopts "a:C:c:d:D:e:g:i:I:o:r:s:t:U:v:AbBFhnNqQuVz" opt; do
   esac
 done
 shift $(($OPTIND - 1))  # set ARGV to the first not parsed commandline parameter
+
+if [ -n "$1" ] ; then
+  echo "Error: unknown argument '$1' in options. Exiting to avoid possible data loss." >&2
+  bailout 1
+fi
 # }}}
 
 # read local (non-packaged) configuration {{{