X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-libraries.git;a=blobdiff_plain;f=testdata%2Fscripts%2Fpnd_run.sh;h=c6cdc9bcd46acefc563c95c3b02f271a77479d75;hp=62b8ebb05807c4c5863d04fe6126b63826238e7f;hb=a2006173780c382153fd079fcc7ac353226ea1f6;hpb=fb72a850a1074877058fd56dbd2f76f042ec1783 diff --git a/testdata/scripts/pnd_run.sh b/testdata/scripts/pnd_run.sh index 62b8ebb..c6cdc9b 100755 --- a/testdata/scripts/pnd_run.sh +++ b/testdata/scripts/pnd_run.sh @@ -135,7 +135,7 @@ PND_Exec() { showHelp() { cat < /dev/null; then + ofbset -fb /dev/fb1 -mem 0 -size 0 0 -en 0 + fi + PND_EndTask + + running_pnd_count=$(ps ax | grep "pnd_run.s[h]" | wc -l) + # restore settings if we are the last exiting pnd + # compare with 2 because one is used by subshell where "ps ax | ..." runs + if [ "$running_pnd_count" -eq "2" ]; then + PND_BeginTask "Restoring nub mode" + sed -n '1p' /etc/pandora/conf/nubs.state > /proc/pandora/nub0/mode + sed -n '7p' /etc/pandora/conf/nubs.state > /proc/pandora/nub1/mode + PND_EndTask + fi + PND_BeginTask "uMount the PND" umountUnion PND_EndTask @@ -616,8 +647,18 @@ main() { ###################################################################################### #### Parsing the arguments : ## +if [ "$#" -lt 1 ]; then + showHelp + exit 1 +fi + ACTION=run while [ "$#" -gt 0 ];do + if [ "$1" == "--" ]; then + shift + break + fi + if [ "$#" -gt 1 ] && ( [[ "$(echo $2|cut -c 1)" != "-" ]] || [[ "$1" = "-a" ]] );then case "$1" in -p) PND="$2";; @@ -629,7 +670,6 @@ while [ "$#" -gt 0 ];do -d) APPDATASET=1;APPDATADIR="$2";; -a) ARGUMENTS="$2";; *) echo "ERROR while parsing arguments: \"$1 $2\" is not a valid argument"; - echo "Arguments were : $PND_ARGS" showHelp; exit 1 ;; esac @@ -641,7 +681,6 @@ while [ "$#" -gt 0 ];do -x) CLOSE_X=1;; -d) APPDATASET=1;; *) echo "ERROR while parsing arguments: \"$1\" is not a valid argument"; - echo "Arguments were : $PND_ARGS" showHelp; exit 1 ;; esac @@ -650,6 +689,12 @@ while [ "$#" -gt 0 ];do fi done +if test -z "$PND"; then + echo "ERROR: pnd file provided (-p)" + showHelp + exit 1 +fi + # getting the real full path to the file PND="$(readlink -f $PND)" @@ -670,7 +715,7 @@ if [ ! -e "$PND" ]; then #check if theres a pnd suplied, need to clean that up a fi if [ ! "$EXENAME" ] && [[ "$ACTION" = "run" ]]; then - echo "ERROR: no executable name provided!" + echo "ERROR: no executable name provided! (-e)" showHelp exit 1 fi @@ -696,10 +741,10 @@ if [[ "$ACTION" == "run" ]];then PND_Start { if [ $CLOSE_X ]; then - main 2>&1 & + main "$@" 2>&1 & disown else - main 2>&1 + main "$@" 2>&1 fi }>>"$PND_LOG" PND_Stop