From: skeezix Date: Fri, 6 Mar 2009 00:40:20 +0000 (-0500) Subject: Merged updated scripts from vimacs, updated Makefile with some deployment rules X-Git-Tag: Release-2010-05/1~197 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff78de3f0244b780e8d24563c6ab4487467b15cf;p=pandora-libraries.git Merged updated scripts from vimacs, updated Makefile with some deployment rules --- diff --git a/Makefile b/Makefile index 1d8d689..6260563 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ ALLOBJ = pnd_conf.o pnd_container.o pnd_discovery.o pnd_pxml.o pnd_notify.o pnd_ all: ${SOLIB} ${LIB} conftest discotest notifytest locatetest pndnotifyd clean: - ${RM} -f ${ALLOBJ} ${XMLOBJ} ${LIB} ${SOLIB1} locatetest.o bin/locatetest conftest.o bin/conftest discotest.o bin/discotest bin/notifytest notifytest.o bin/pndnotifyd pndnotifyd.o ${SOLIB} testdata/dotdesktop/*.desktop testdata/apps/*.pnd testdata/dotdesktop/*.png + ${RM} -f ${ALLOBJ} ${XMLOBJ} ${LIB} ${SOLIB1} locatetest.o bin/locatetest conftest.o bin/conftest discotest.o bin/discotest bin/notifytest notifytest.o bin/pndnotifyd pndnotifyd.o ${SOLIB} testdata/dotdesktop/*.desktop testdata/apps/*.pnd testdata/dotdesktop/*.png deployment/usr/lib/libpnd* deployment/usr/bin/pndnotifyd deployment/usr/pandora/scripts/* deployment/etc/sudoers deployment/etc/init.d/pndnotifyd find . -name "*~*" -exec rm {} \; -print # component targets @@ -47,10 +47,9 @@ pndnotifyd: pndnotifyd.o ${SOLIB1} pnd: # build x86_ls with icon - cd testdata/pndsample; ../scripts/pnd_make.sh x86_ls.pnd x86_ls/PXML.xml x86_ls - cd testdata/pndsample; cat x86_ls/zeldaicon.png >> x86_ls.pnd + cd testdata/pndsample; ../scripts/pnd_make.sh -p x86_ls.pnd -d x86_ls -i x86_ls/zeldaicon.png -x x86_ls/PXML.xml # build x86_echo with no icon - cd testdata/pndsample; ../scripts/pnd_make.sh x86_echo.pnd x86_echo/PXML.xml x86_echo + cd testdata/pndsample; ../scripts/pnd_make.sh -p x86_echo.pnd -d x86_echo -x x86_echo/PXML.xml deploy: # populate deployment directory for copying into image bakes @@ -60,12 +59,15 @@ deploy: mkdir -p deployment/usr/bin mkdir -p deployment/usr/pandora/apps mkdir -p deployment/usr/pandora/scripts + mkdir -p deployment/etc/init.d/ # copy in goodies cp libpnd* deployment/usr/lib cp bin/pndnotifyd deployment/usr/bin cp testdata/scripts/* deployment/usr/pandora/scripts # copy in freebee .pnd apps to /usr/pandora/apps # add pndnotify to etc/rc/startup-whatever + cp testdata/sh/pndnotifyd deployment/etc/init.d/pndnotifyd + cp testdata/sh/sudoers deployment/etc/sudoers # test tool targets # diff --git a/deployment/usr/bin/pndnotifyd b/deployment/usr/bin/pndnotifyd deleted file mode 100755 index edb413b..0000000 Binary files a/deployment/usr/bin/pndnotifyd and /dev/null differ diff --git a/deployment/usr/lib/libpnd.a b/deployment/usr/lib/libpnd.a deleted file mode 100644 index 563f639..0000000 Binary files a/deployment/usr/lib/libpnd.a and /dev/null differ diff --git a/deployment/usr/lib/libpnd.so.1 b/deployment/usr/lib/libpnd.so.1 deleted file mode 100755 index d63c646..0000000 Binary files a/deployment/usr/lib/libpnd.so.1 and /dev/null differ diff --git a/deployment/usr/lib/libpnd.so.1.0.1 b/deployment/usr/lib/libpnd.so.1.0.1 deleted file mode 100755 index d63c646..0000000 Binary files a/deployment/usr/lib/libpnd.so.1.0.1 and /dev/null differ diff --git a/deployment/usr/lib/libpnd.txt b/deployment/usr/lib/libpnd.txt deleted file mode 100644 index e5b2f25..0000000 --- a/deployment/usr/lib/libpnd.txt +++ /dev/null @@ -1,42 +0,0 @@ - -Overview --------- - -libpnd is a basic collection of functions and tools to make working Pandora-specific -operations easier; to wit, it is hoped multiple applications will make use of this -library rather than re-implement similar functionality and lead to problems down the -road. (Instead we can run into problems together and thus clobberize them.) - -The library is broken into parts: - -include - include these files to make use of the lib -lib - the code that produces the lib -test - mini tools to test various pieces of the lib in isolation -bin - test tools -testdata/ - for testing /etc/pandora; will contain 'conf' dir, for example - -Revisions ---------- - -The initial version of this code will be very limited and meant to kick-start further -work, yet provide basic functionaliy. - -TODO ----- - -o We need an actual matchbox plugin that uses this lib to obtain app list - -o PND-file handling, so iso/cram/zip app bundles actually work when pnd_apps_exec()'d - -o PXML parser has to actually be an XML parser - -o UNICODE support? ie: paths and filenames and app-names.. - -Nice to do: - -o Handle regexp's or globbing in searchpaths, so can do tricks like /mnt/*/app etc - -jeff - -PS: Yes, I know, the entire thing could be done in 20 lines of perl, but we wanted C to -maximize availability. diff --git a/deployment/usr/pandora/scripts/pnd_make.sh b/deployment/usr/pandora/scripts/pnd_make.sh deleted file mode 100755 index 867f247..0000000 --- a/deployment/usr/pandora/scripts/pnd_make.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -pkgname=$1 -folder=$3 -xml=$2 -mkisofs -o $pkgname.iso -R $folder -cat $pkgname.iso $xml > $pkgname -rm $pkgname.iso diff --git a/deployment/usr/pandora/scripts/pnd_run.sh b/deployment/usr/pandora/scripts/pnd_run.sh deleted file mode 100755 index b26ccf2..0000000 --- a/deployment/usr/pandora/scripts/pnd_run.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -#input pnd_run.sh -p "/path/to/foobar.pnd" -e "exe" --a "arguments for exe" -# -u to skip union mount -# -s startdir -# arguments can be inside -e, -a is optional - -############################# dont forget to remove the echos! ############################ - -# parse arguments -TEMP=`getopt -o p:e:a:b:u::s: --long p-long,e-long:,a-long: -- "$@"` - -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|--p-long) echo "pnd set to \`$2'" ;PND=$2;shift 2;; - -e|--e-long) echo "exec set to \`$2'" ;EXENAME=$2;shift 2 ;; - -u) echo "u set, no union pls!";UNION=1;shift 2 ;; - -b) echo "BASENAME set to $2";BASENAME=$2;shift 2;; - -s) echo "startdir set to $2";STARTDIR=$2;shift 2;; - -a|--a-long) - 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 -done - -# add sanity check - -#vars -DFS=$(file -b $PND | awk '{ print $1 }') # is -p a zip iso or folder? -MOUNTPOINT=$(df $PND | grep -vE '^Filesystem' | awk '{ print $6 }') #find out which mountpoint the pnd/folder is on - -#if -b is set use that as basename, else generate it from PND -#get basename (strip extension if file) for union mountpoints etc, maybe this should be changed to something specified inside the xml -if [ ! $BASENAME ]; then BASENAME=$(basename "$PND" | cut -d'.' -f1) ; fi - -oCWD=$(pwd) -# add sanity check - -#detect fs -if [ $DFS = ISO ]; then - mntline="mount -o loop,fmask=000 $PND /mnt/pnd/$BASENAME" - echo "Filetype is $DFS" -elif [ $DFS = Zip ]; then - mntline="fuse-zip $PND /mnt/pnd/$BASENAME -o ro,fmask=000" - echo "Filetype is $DFS" -elif [ $DFS = directory ]; then - mntline="mount --bind -o ro,fmask=000 $PND /mnt/pnd/$BASENAME" -#we bind the folder, now it can be treated in a unified way ATENTION: -o ro doesnt work for --bind at least on 25, on 26 its possible using remount, may have changed on 27 - echo "Filetype is $DFS" -else - echo "error" - exit 1; -fi - -#create mountpoints - -if [ ! -d /mnt/pnd/$BASENAME ]; then echo "mkdir -p /mnt/pnd/$BASENAME "; fi -if [ ! -d $MOUNTPOINT/appdata/$BASENAME ]; then echo "mkdir -p $MOUNTPOINT/appdata/$BASENAME "; fi -if [ ! -d /mnt/utmp/$BASENAME ]; then echo "mkdir -p /mnt/utmp/$BASENAME "; fi - -#mount -if [ ! $UNION ] ; then - #is the union already mounted? if not mount evrything, else launch the stuff - mount | grep "on /mnt/utmp/$BASENAME type" > /dev/null - if [ ! $? -eq 0 ]; then - - $mntline #mount the pnd/folder - #mount -t unionfs -o exec,dirs\=$MOUNTPOINT/appdata/$BASENAME=rw:/mnt/pnd/$BASENAME=ro unionfs /mnt/utmp/$BASENAME #union mount - #aufs, one of those should work, bit unsure. - mount -t aufs -o exec,fmask=000,dirs\=$MOUNTPOINT/appdata/$BASENAME=rw:/mnt/pnd/$BASENAME=ro none /mnt/utmp/$BASENAME #aufs? - #mount -t aufs -o exec,dirs\=$MOUNTPOINT/appdata/$BASENAME=rw:/mnt/pnd/$BASENAME=ro aufs /mnt/utmp/$BASENAME #aufs? - - else - echo "doh!" - fi - - - #start app - cd /mnt/utmp/$BASENAME - if [ $STARTDIR ]; then cd $STARTDIR; fi - $EXENAME $ARGUMENTS - #app exited - -else - - $mntline - cd /mnt/pnd/$BASENAME - if [ $STARTDIR ]; then cd $STARTDIR; fi - $EXENAME $ARGUMENTS -fi - -#clean up -umount /mnt/utmp/$BASENAME -if [ $? -eq 0 ]; then - - umount /mnt/pnd/$BASENAME - rmdir /mnt/pnd/$BASENAME - rmdir /mnt/utmp/$BASENAME - -fi diff --git a/testdata/pndsample/x86_echo.pnd b/testdata/pndsample/x86_echo.pnd index 671226e..23b75c0 100644 Binary files a/testdata/pndsample/x86_echo.pnd and b/testdata/pndsample/x86_echo.pnd differ diff --git a/testdata/pndsample/x86_ls.pnd b/testdata/pndsample/x86_ls.pnd index be0369d..2fd9cc5 100644 Binary files a/testdata/pndsample/x86_ls.pnd and b/testdata/pndsample/x86_ls.pnd differ diff --git a/testdata/scripts/genpxml.sh b/testdata/scripts/genpxml.sh new file mode 100755 index 0000000..84392fb --- /dev/null +++ b/testdata/scripts/genpxml.sh @@ -0,0 +1,36 @@ +#!/bin/bash +if [ $1 ]; then cd $1; fi + +for x in $(pwd)/* +do +if [ -x $x ] && [ ! -d $x ]; then exe=$x; break; fi +done +BASENAMEnoex=$(basename "$exe" | cut -d'.' -f1) +BASENAME=$(basename "$exe") + +rnd=$(dd if=/dev/random count=10 bs=1 | hexdump | cut -d \ -f 2-| head -n 1 | tr -d " ") + +echo ' + + + <en>'$BASENAMEnoex'</en> + + +'$rnd' + +NO + + + Automatically generated pxml from'$(pwd)' exe='$BASENAME' + + +'$BASENAME' + + +
Main category
+ Subcategory 1 + Subcategory 2 +
+ +
+' \ No newline at end of file diff --git a/testdata/scripts/pnd_make.sh b/testdata/scripts/pnd_make.sh index 867f247..0794b34 100755 --- a/testdata/scripts/pnd_make.sh +++ b/testdata/scripts/pnd_make.sh @@ -1,7 +1,57 @@ #!/bin/bash -pkgname=$1 -folder=$3 -xml=$2 -mkisofs -o $pkgname.iso -R $folder -cat $pkgname.iso $xml > $pkgname -rm $pkgname.iso + +######adjust path of genpxml.sh if you want to use that "feture"##### +# \!/ black magic ahead + +TEMP=`getopt -o p:d:x:i: -- "$@"` + +if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi + +eval set -- "$TEMP" +while true ; do + case "$1" in + -p) echo "PNDNAME set to $2" ;PNDNAME=$2;shift 2;; + -d) echo "FOLDER set to $2" ;FOLDER=$2;shift 2 ;; + -x) echo "PXML set to $2" ;PXML=$2;shift 2 ;; + -i) echo "ICON set to $2" ;ICON=$2;shift 2 ;; + --) shift ; break ;; + *) echo "Error while parsing arguments! $2" ; exit 1 ;; + esac +done + +rnd=$RANDOM%10; # random number for genpxml and index$rnd.xml + +if [ $PXML = "guess" ] && [ $PNDNAME ] && [ $FOLDER ]; then + PXMLtxt=$(/usr/pandora/scripts $FOLDER) + PXML=tmp$rnd.pxml + echo "$PXMLtxt" > tmp$rnd.pxml +fi + +if [ ! $PNDNAME ] || [ ! $FOLDER ] || [ ! $PXML ]; then + echo " Usage: pnd_make.sh -p your.pnd -d folder/containing/your/app/ -x + your.pxml (or \"guess\" to try to generate it from the folder) other files to append" + exit 1 +fi + +if [ ! -d $FOLDER ]; then echo "$FOLDER doesnt exist"; exit 1; fi +if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi + + +mkisofs -o $PNDNAME.iso -R $FOLDER +#pxmlstart=$(stat -c%s "$PNDNAME.iso") + +cat $PNDNAME.iso $PXML > $PNDNAME +rm $PNDNAME.iso + +if [ $ICON ]; then # is -i used? + if [ ! -f $ICON ]; then #does the icon actually exist? + echo "$ICON doesnt exist" + else # yes + mv $PNDNAME $PNDNAME.tmp + cat $PNDNAME.tmp $ICON > $PNDNAME + fi +fi + +if [ $PXML = "guess" ];then rm tmp$rnd.pxml; fi + +#printf %08d $pxmlstart >> $PNDNAME #append end of iso/start of pxml offset \ No newline at end of file diff --git a/testdata/scripts/pnd_run.sh b/testdata/scripts/pnd_run.sh index de8760c..6ee7523 100755 --- a/testdata/scripts/pnd_run.sh +++ b/testdata/scripts/pnd_run.sh @@ -1,13 +1,15 @@ #!/bin/bash -#input pnd_run.sh -p "/path/to/foobar.pnd" -e "exe" --a "arguments for exe" -# -u to skip union mount +#Usage: pnd_run.sh -p your.pnd -e executeable [-a \"(arguments)\"] [ -s \"cd to folder inside pnd\"] [-u (skip union)] [-b override BASENAME (name of mountpoint/appdata)] +# -n to skip union mount, should probably be removed before release # -s startdir # arguments can be inside -e, -a is optional +#/etc/sudoers needs to be adjusted if you touch any of the sudo lines in the wrong place. + # parse arguments -TEMP=`getopt -o p:e:a:b:s:u:: --long p-long,e-long:,a-long: -- "$@"` +TEMP=`getopt -o p:e:a:b:s:m::u::n:: -- "$@"` if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi @@ -15,94 +17,131 @@ if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi eval set -- "$TEMP" while true ; do - case "$1" in - -p|--p-long) echo "pnd set to \`$2'" ;PND=$2;shift 2;; - -e|--e-long) echo "exec set to \`$2'" ;EXENAME=$2;shift 2 ;; - -u) echo "u set, no union pls!";UNION=1;shift 2 ;; - -b) echo "BASENAME set to $2";BASENAME=$2;shift 2;; - -s) echo "startdir set to $2";STARTDIR=$2;shift 2;; - -a|--a-long) - 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) echo "pnd set to \`$2'" ;PND=$2;shift 2;; + -e) echo "exec set to \`$2'" ;EXENAME=$2;shift 2 ;; + -n) echo "u set, no union pls!";NOUNION=1;shift 2;; + -b) echo "BASENAME set to $2";BASENAME=$2;shift 2;; + -s) echo "startdir set to $2";STARTDIR=$2;shift 2;; + -m) echo "mount";mount=1;shift 2;; + -u) echo "umount";umount=1;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 done -# add sanity check +if [ ! $PND ] || [ ! $EXENAME ]; then + echo "Usage: pnd_run.sh -p your.pnd -e executeable [-a \"(arguments)\"] [ -s \"cd to folder inside pnd\"] [-u (skip union)] [-b override BASENAME (name of mountpoint/appdata)]" + exit 1 +fi #vars -DFS=$(file -b $PND | awk '{ print $1 }') # is -p a zip iso or folder? -MOUNTPOINT=$(df $PND | grep -vE '^Filesystem' | awk '{ print $6 }') #find out which mountpoint the pnd/folder is on +DFS=$(file -b $PND | awk '{ print $1 }') #is -p a zip/iso or folder? +MOUNTPOINT=$(df $PND | grep -vE '^Filesystem' | awk '{ print $6 }') #find out which mountpoint the pnd/folder is on, there probably is a better way to do this + +#BASENAME really should be something sensible and somewhat unique #if -b is set use that as basename, else generate it from PND #get basename (strip extension if file) for union mountpoints etc, maybe this should be changed to something specified inside the xml +#this should probably be changed to .... something more sensible if [ ! $BASENAME ]; then BASENAME=$(basename "$PND" | cut -d'.' -f1) ; fi + + oCWD=$(pwd) -# add sanity check #detect fs if [ $DFS = ISO ]; then - mntline="sudo mount -o loop,mode=777 $PND /mnt/pnd/$BASENAME" - echo "Filetype is $DFS" + mntline="sudo mount -o loop,mode=777 $PND /mnt/pnd/$BASENAME" + echo "Filetype is $DFS" elif [ $DFS = Zip ]; then - mntline="fuse-zip $PND /mnt/pnd/$BASENAME -o ro,fmask=000" - echo "Filetype is $DFS" + mntline="fuse-zip $PND /mnt/pnd/$BASENAME -o ro,fmask=000" #TOTALLY untested right now + echo "Filetype is $DFS" elif [ $DFS = directory ]; then - mntline="sudo mount --bind -o ro $PND /mnt/pnd/$BASENAME" + mntline="sudo mount --bind -o ro $PND /mnt/pnd/$BASENAME" #we bind the folder, now it can be treated in a unified way ATENTION: -o ro doesnt work for --bind at least on 25, on 26 its possible using remount, may have changed on 27 - echo "Filetype is $DFS" + echo "Filetype is $DFS" else - echo "error" - exit 1; + echo "error" + exit 1; fi -#create mountpoints - +#create mountpoints, check if they exist already first to avoid annoying error messages if [ ! -d /mnt/pnd/$BASENAME ]; then sudo mkdir -p /mnt/pnd/$BASENAME ; fi if [ ! -d $MOUNTPOINT/appdata/$BASENAME ]; then sudo mkdir -p $MOUNTPOINT/appdata/$BASENAME; fi if [ ! -d /mnt/utmp/$BASENAME ]; then sudo mkdir -p /mnt/utmp/$BASENAME; fi #mount -if [ ! $UNION ] ; then - #is the union already mounted? if not mount evrything, else launch the stuff - mount | grep "on /mnt/utmp/$BASENAME type" # > /dev/null - if [ ! $? -eq 0 ]; then - echo "mounting union!" - $mntline #mount the pnd/folder - - sudo mount -t aufs -o exec,dirs\=$MOUNTPOINT/appdata/$BASENAME=rw:/mnt/pnd/$BASENAME=ro none /mnt/utmp/$BASENAME # put union on top - - else - echo "Union already mounted" - fi - - - #start app - cd /mnt/utmp/$BASENAME - if [ $STARTDIR ]; then cd $STARTDIR; fi - ./$EXENAME $ARGUMENTS - #app exited - cd $oCWD +if [ ! $NOUNION ] && [ ! $umount ]; then + #is the union already mounted? if not mount evrything, else launch the stuff + mount | grep "on /mnt/utmp/$BASENAME type" # > /dev/null + if [ ! $? -eq 0 ]; then + $mntline #mount the pnd/folder + echo "mounting union!" + sudo mount -t aufs -o exec,dirs\=$MOUNTPOINT/appdata/$BASENAME=rw+nolwh:/mnt/pnd/$BASENAME=rr none /mnt/utmp/$BASENAME # put union on top + + else + echo "Union already mounted" + fi + + if [ $mount ]; then echo "mounted /mnt/utmp/$BASENAME"; exit 1; fi; + + #start app + cd /mnt/utmp/$BASENAME + if [ $STARTDIR ]; then cd $STARTDIR; fi #cd to folder specified by the optional arg -s + ./$EXENAME $ARGUMENTS + +#the app could have exited now, OR it went into bg, we still need to wait in that case till it really quits! + PID=`pidof -o %PPID -x $EXENAME` + while [ "$PID" -gt 0 ] + do + sleep 10s + PID=`pidof -o %PPID -x $EXENAME` + done + echo end + + #app exited + cd $oCWD #cd out of the mountpoint so we can umount, doesnt really matter to where... + +elif [ ! $umount ]; then + $mntline + if [ $mount ]; then echo "mounted /mnt/pnd/$BASENAME"; exit 1; fi; + cd /mnt/pnd/$BASENAME + if [ $STARTDIR ]; then cd $STARTDIR; fi + echo $(pwd) + ./$EXENAME $ARGUMENTS + +#the app could have exited now, OR it went into bg, we still need to wait in that case till it really quits! + PID=`pidof -o %PPID -x $EXENAME` + while [ "$PID" -gt 0 ] + do + sleep 10s + PID=`pidof -o %PPID -x $EXENAME` + done + echo end + + cd $oCWD else - - $mntline - cd /mnt/pnd/$BASENAME - if [ $STARTDIR ]; then cd $STARTDIR; fi - echo $(pwd) - ./$EXENAME $ARGUMENTS - cd $oCWD +echo "-u set, nothing to do here" fi + #clean up -if [ ! $UNION ] ; then sudo umount /mnt/utmp/$BASENAME; fi -if [ $UNION ] ; then sudo umount /mnt/pnd/$BASENAME; fi -if [ $? -eq 0 ]; then - sudo umount /mnt/pnd/$BASENAME - sudo rmdir /mnt/pnd/$BASENAME - if [ ! $UNION ] ; then sudo rmdir /mnt/utmp/$BASENAME; fi -fi + +if [ ! $NOUNION ] ; then sudo umount /mnt/utmp/$BASENAME; fi #umount union if -u wasnt set +if [ $NOUNION ] ; then sudo umount /mnt/pnd/$BASENAME; fi #umount iso if -u WAS set +if [ $? -eq 0 ]; then # check if the umount was successfull, if it wasnt it would mean that theres still something running so we skip this stuff + if [ ! $NOUNION ] ; then + sudo umount /mnt/pnd/$BASENAME + sudo rmdir $MOUNTPOINT/appdata/$BASENAME/.wh..wh.plink + sudo rmdir $MOUNTPOINT/appdata/$BASENAME/ + sudo rmdir /mnt/utmp/$BASENAME; + fi + sudo rmdir /mnt/pnd/$BASENAME +fi \ No newline at end of file diff --git a/testdata/sh/pndnotifyd b/testdata/sh/pndnotifyd new file mode 100755 index 0000000..c4faf0a --- /dev/null +++ b/testdata/sh/pndnotifyd @@ -0,0 +1,46 @@ +#! /bin/sh +# +### BEGIN INIT INFO +# Provides: pndnotifyd +# Required-Start: #adjust +# Required-Stop: #adjust +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO + +PID=`pidof -o %PPID -x pndnotifyd` +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/libpnd/pandora-libraries #remove +export LD_LIBRARY_PATH #remove +PNDNOTIFY='/home/user/libpnd/pandora-libraries/bin/pndnotifyd' #adjust + +case "$1" in +start) + # Start daemon. + echo "starting $PID" + if [ $PID ] + then + echo "pndnotifyd already running." + else + $PNDNOTIFY -d + echo "started pndnotifyd" + fi + + ;; +stop) + # Stop daemon. + kill $PID + ;; +reload) + kill -HUP $PID + ;; +restart|force-reload) + $0 stop + $0 start + ;; +*) + echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 + exit 2 + ;; +esac +exit 0 + diff --git a/testdata/sh/sudoers b/testdata/sh/sudoers new file mode 100644 index 0000000..3023434 --- /dev/null +++ b/testdata/sh/sudoers @@ -0,0 +1,6 @@ +ALL ALL=NOPASSWD:NOEXEC: /bin/mount -o loop\,mode=777 *pnd /mnt/pnd/* , \ +/bin/mount -t aufs -o exec\,dirs\=*/appdata/*\=rw+nolwh\:/mnt/pnd/*\=rr none /mnt/utmp/* , \ +/bin/mount --bind -o ro * /mnt/pnd/*, \ +/bin/umount /mnt/pnd/*, /bin/umount /mnt/utmp/*, \ +/bin/mkdir -p /mnt/pnd/* , /bin/mkdir -p /mnt/utmp/* , /bin/mkdir -p */appdata/* , \ +/bin/rmdir /mnt/pnd/*,/bin/rmdir /mnt/utmp/* ,/bin/rmdir */appdata/*/.wh..wh.plink ,/bin/rmdir */appdata/*/