From: skeezix Date: Tue, 11 Jan 2011 13:46:39 +0000 (-0500) Subject: Recent pnd_run.sh from sebt3; history is .. a new version was in the pipe (or checked... X-Git-Tag: sz_beta3~113^2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71d03654046c4d66457d09d97c8572fdd42b2666;p=pandora-libraries.git Recent pnd_run.sh from sebt3; history is .. a new version was in the pipe (or checked in) which was cleaner, but had some issues; those issues are repaired, or we rewound to earlier stock, not entirely sure; either way, this new checkin seems to be solid, so we should beat it up a bit and call it a day. --- diff --git a/testdata/scripts/pnd_run.sh b/testdata/scripts/pnd_run.sh index 69601b8..c5aced0 100644 --- a/testdata/scripts/pnd_run.sh +++ b/testdata/scripts/pnd_run.sh @@ -17,13 +17,6 @@ #cleanup #Rewrite! - this sucks -showHelp() { - cat </dev/null);do ps hf $p;done } @@ -341,38 +334,46 @@ main() { fi } -###################################################################################### -#### Parse arguments -## - -PNDARGS="$@" +showHelp() { + cat <&2 ; exit 1 ; fi -eval set -- "$TEMP" # Note the quotes around `$TEMP': they are essential! - +function parseArgs() { ACTION=run +TEMP=`getopt -o d:p:e:a:b:s:m::u::n::x::j:c: -- "$@"` +if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi +# Note the quotes around `$TEMP': they are essential! +eval set -- "$TEMP" while true ; do - case "$1" in - -p) PND=$2;shift 2;; - -e) EXENAME=$2;shift 2 ;; - -b) PND_NAME=$2;shift 2;; - -s) STARTDIR=$2;shift 2;; - -m) ACTION=mount;shift 2;; - -u) ACTION=umount;shift 2;; - -x) nox=1;shift 2;; - -j) append=$2;shift 2;; - -c) cpuspeed=$2;shift 2;; - -d) APPDATASET=1;APPDATADIR=$2;shift 2;; - -a) - case "$2" in - "") echo "no arguments"; shift 2 ;; - *) echo "args set to \`$2'" ;ARGUMENTS=$2;shift 2 ;; - esac ;; - --) shift ; break ;; - *) echo "Error while parsing arguments!" ; exit 1 ;; - esac + case "$1" in + -p) PND="$2";shift 2;; + -e) EXENAME="$2";shift 2 ;; + -b) PND_NAME="$2";shift 2;; + -s) STARTDIR="$2";shift 2;; + -m) ACTION=mount;shift 2;; + -u) ACTION=umount;shift 2;; + -x) nox=1;shift 2;; + -j) append="$2";shift 2;; + -c) cpuspeed="$2";shift 2;; + -d) APPDATASET=1;APPDATADIR="$2";shift 2;; + -a) + case "$2" in + "") echo "no arguments"; shift 2 ;; + *) ARGUMENTS="$2";shift 2 ;; + esac ;; + --) shift ; break ;; + *) echo "Error while parsing arguments!"; showHelp; exit 1 ;; + esac done +} +###################################################################################### +#### Main : +## +PNDARGS="$@" +parseArgs "$@" if [ ! -e "$PND" ]; then #check if theres a pnd suplied, need to clean that up a bit more echo "ERROR: selected PND($PND) file does not exist!"