From: vimacs Date: Wed, 10 Mar 2010 17:26:14 +0000 (+0100) Subject: fixed detaching/destroying of loop devices. X-Git-Tag: Release-2010-05/1~63^2~4 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f157f4825da9e7ca3d8319b8b3e14e70a99687f4;p=pandora-libraries.git fixed detaching/destroying of loop devices. nox mode when no x is running wont start x anymore modified: testdata/scripts/pnd_run.sh --- diff --git a/testdata/scripts/pnd_run.sh b/testdata/scripts/pnd_run.sh index e59d73d..37ef213 100755 --- a/testdata/scripts/pnd_run.sh +++ b/testdata/scripts/pnd_run.sh @@ -48,7 +48,7 @@ while true ; do *) echo "Error while parsing arguments!" ; exit 1 ;; esac done - + if [ ! $PND ]; then #check if theres a pnd suplied, need to clean that up a bit more echo "Usage: pnd_run.sh -p your.pnd -e executeable [-a \"(arguments)\"] [ -s \"cd to folder inside pnd\"] [-b UID (name of mountpoint/pandora/appdata)] [-x close x before launching(script needs to be started with nohup for this to work]" exit 1 @@ -61,6 +61,10 @@ if [ ! $EXENAME ]; then fi fi +if [ $(pidof X) ]; then +unset $nox +fi + fork () { echo in fork! if [ $nox ]; then #the app doesnt want x to run, so we kill it and restart it once the app quits @@ -211,6 +215,7 @@ fi #clean up sudo rmdir /mnt/utmp/$BASENAME +sudo rm /mnt/utmp/$BASENAME sudo umount /mnt/utmp/$BASENAME #umount union 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, this WILL lead to clutter if it happens, so we should make damn sure it never happens #umount the actual pnd @@ -221,9 +226,9 @@ if [ $? -eq 0 ]; then # check if the umount was successfull, if it wasnt it woul #delete appdata folder and ancestors if empty sudo rmdir -p $MOUNTPOINT/pandora/appdata/$BASENAME/ #delete tmp mountpoint - sudo rmdir /mnt/utmp/$BASENAME; + sudo rmdir /mnt/utmp/$BASENAME if [ $DFS = ISO ] || [ $DFS = Squashfs ]; then # check if we where running an iso, clean up loop device if we did - LOOP=$(sudo losetup -a | grep $PND | tail -n1 | awk -F: '{print $1}') + LOOP=$(sudo losetup -a | grep $(basename $PND) | tail -n1 | awk -F: '{print $1}') sudo /sbin/losetup -d $LOOP sudo rm $LOOP fi @@ -243,9 +248,9 @@ fi if [ $nox ]; then echo forking now! -fork &> /tmp/pndrun$BASENAME.out & +fork &> /tmp/pndrun$BASENAME$mount.out & disown else echo Running with x, not disowning! -fork &> /tmp/pndrun$BASENAME.out +fork &> /tmp/pndrun$BASENAME$mount.out fi \ No newline at end of file