From 664c2c4c270edbf7cb3d19b229e41fd144f9366f Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Tue, 29 Jun 2010 03:52:42 +0200 Subject: [PATCH] pnd_make and pnd_run: Fixed some bugs (contributed by various people) --- testdata/conf/eventmap | 4 ++-- testdata/scripts/pnd_make.sh | 12 +++++----- testdata/scripts/pnd_run.sh | 44 ++++++++++++++++++------------------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/testdata/conf/eventmap b/testdata/conf/eventmap index c95a6f0..0e14190 100644 --- a/testdata/conf/eventmap +++ b/testdata/conf/eventmap @@ -16,9 +16,9 @@ minimum_separation 1 # 1 second minimum between a single event repeating [battery] # for LED-blinking when battery gets low -threshold 5 # in %age; at x%, we go into blink-mode as warning +threshold 10 # in %age; at x%, we go into blink-mode as warning check_interval 7 # in seconds to check threshold; should be a high 300s blink_interval 2 # frequency of blink blink_duration 50000 # how long a blink lasts, in uSecs -shutdown_threshold 1 # battery %age we force a shutdown (to save the SD!) +shutdown_threshold 3 # battery %age we force a shutdown (to save the SD!) shutdown_script /usr/pandora/scripts/op_shutdown.sh diff --git a/testdata/scripts/pnd_make.sh b/testdata/scripts/pnd_make.sh index 3a0ce2c..3e8ad8b 100755 --- a/testdata/scripts/pnd_make.sh +++ b/testdata/scripts/pnd_make.sh @@ -39,13 +39,13 @@ if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi #check if pxml act #make iso from folder if [ ! $SQUASH ]; then - mkisofs -o $PNDNAME.iso -R $FOLDER + mkisofs -o $PNDNAME.iso -R $FOLDER else - if [ $(mksquashfs -version | awk '{if ($3 >= 4) print 1}') = 1 ]; then - echo "your squashfs version is older then version 4, pleas upgrade to 4.0 or later" - exit 1 - fi - mksquashfs -no-recovery -nopad $FOLDER $PNDNAME.iso + if [ $(mksquashfs -version | awk 'BEGIN{r=0} $3>=4{r=1} END{print r}') = 0 ]; then + echo "your squashfs version is older then version 4, pleas upgrade to 4.0 or later" + exit 1 + fi + mksquashfs $FOLDER $PNDNAME.iso -nopad -no-recovery fi #append pxml to iso cat $PNDNAME.iso $PXML > $PNDNAME diff --git a/testdata/scripts/pnd_run.sh b/testdata/scripts/pnd_run.sh index ae10e32..e32c0c1 100755 --- a/testdata/scripts/pnd_run.sh +++ b/testdata/scripts/pnd_run.sh @@ -91,7 +91,7 @@ if [ $nox ]; then #the app doesnt want x to run, so we kill it and restart it on fi #vars -DFS=$(file -b $PND | awk '{ print $1 }') #is -p a zip/iso or folder? +DFS=$(file -b "$PND" | awk '{ print $1 }') #is -p a zip/iso or folder? MOUNTPOINT=$(df $PND | sed -ne 's/.*\% \(\S*\)/\1/p' | tail -n1) #find out on which mountpoint the pnd is if [ ! -d "$MOUNTPOINT" ]; then MOUNTPOINT="/"; fi #make sure folder exists, if it doesnt assume rootfs @@ -112,10 +112,10 @@ if [ ! $umount ]; then oCWD=$(pwd) #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 #mountpoint for iso, ro + if [ ! -d "/mnt/pnd/$BASENAME" ]; then sudo mkdir -p "/mnt/pnd/$BASENAME" ; fi #mountpoint for iso, ro #writeable dir for union - if [ ! -d $MOUNTPOINT/pandora/appdata/$BASENAME ]; then sudo mkdir -p $MOUNTPOINT/pandora/appdata/$BASENAME; sudo chmod -R a+xrw $MOUNTPOINT/pandora/appdata/$BASENAME; fi - if [ ! -d /mnt/utmp/$BASENAME ]; then sudo mkdir -p /mnt/utmp/$BASENAME; fi #union over the two + if [ ! -d "$MOUNTPOINT/pandora/appdata/$BASENAME" ]; then sudo mkdir -p "$MOUNTPOINT/pandora/appdata/$BASENAME"; sudo chmod -R a+xrw "$MOUNTPOINT/pandora/appdata/$BASENAME"; fi + if [ ! -d "/mnt/utmp/$BASENAME" ]; then sudo mkdir -p "/mnt/utmp/$BASENAME"; fi #union over the two if [ ! $cpuspeed -eq $(cat /proc/pandora/cpu_mhz_max) ]; then gksu --message "$BASENAME wants to set the cpu speed to $cpuspeed, enter root password to allow" echo $cpuspeed > /proc/pandora/cpu_mhz_max @@ -149,16 +149,16 @@ if [ ! $umount ]; then if [ $DFS = ISO ]; then sudo /sbin/losetup $FREELOOP $PND #attach the pnd to the loop device - mntline="sudo mount $FREELOOP /mnt/pnd/$BASENAME/" #setup the mountline for later + mntline="sudo mount $FREELOOP '/mnt/pnd/$BASENAME/'" #setup the mountline for later #mntline="sudo mount -o loop,mode=777 $PND /mnt/pnd/$BASENAME" echo "Filetype is $DFS" elif [ $DFS = directory ]; then - 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 + mntline="sudo mount --bind -o ro '$PND' '/mnt/pnd/$BASENAME'" + #we bind the folder, now it can be treated in a unified way ATTENTION: -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" elif [ $DFS = Squashfs ]; then sudo /sbin/losetup $FREELOOP $PND #attach the pnd to the loop device - mntline="sudo mount -t squashfs $FREELOOP /mnt/pnd/$BASENAME" + mntline="sudo mount -t squashfs $FREELOOP '/mnt/pnd/$BASENAME'" echo "Filetype is $DFS" else echo "error determining fs, output was $DFS" @@ -172,15 +172,15 @@ if [ ! $umount ]; then echo "Filesystem is $FILESYSTEM" if [ $FILESYSTEM = vfat ]; then # use noplink on fat, dont on other fs's #append is fucking dirty, need to clean that up - sudo mount -t aufs -o exec,noplink,dirs=$MOUNTPOINT/pandora/appdata/$BASENAME=rw+nolwh:/mnt/pnd/$BASENAME=rr$append none /mnt/utmp/$BASENAME # put union on top + sudo mount -t aufs -o exec,noplink,dirs="$MOUNTPOINT/pandora/appdata/$BASENAME"=rw+nolwh:"/mnt/pnd/$BASENAME"=rr$append none "/mnt/utmp/$BASENAME" # put union on top else - sudo mount -t aufs -o exec,dirs=$MOUNTPOINT/pandora/appdata/$BASENAME=rw+nolwh:/mnt/pnd/$BASENAME=rr$append none /mnt/utmp/$BASENAME # put union on top + sudo mount -t aufs -o exec,dirs="$MOUNTPOINT/pandora/appdata/$BASENAME"=rw+nolwh:"/mnt/pnd/$BASENAME"=rr$append none "/mnt/utmp/$BASENAME" # put union on top fi else #the pnd is already mounted but a mount was requested with a different basename/uid, just link it there echo $LOOP already mounted on $loopmountedon skipping losetup - putting link to old mount #this is bullshit - sudo rmdir /mnt/utmp/$BASENAME - sudo ln -s $loopmountedon /mnt/utmp/$BASENAME + sudo rmdir "/mnt/utmp/$BASENAME" + sudo ln -s $loopmountedon "/mnt/utmp/$BASENAME" fi else @@ -189,7 +189,7 @@ if [ ! $umount ]; then if [ $mount ]; then echo "mounted /mnt/utmp/$BASENAME"; exit 1; fi; #mount only, die here - cd /mnt/utmp/$BASENAME # cd to union mount + cd "/mnt/utmp/$BASENAME" # cd to union mount if [ $STARTDIR ]; then cd $STARTDIR; fi #cd to folder specified by the optional arg -s LD_LIBRARY_PATH=/mnt/utmp/$BASENAME ./$EXENAME $ARGUMENTS # execute app with ld_lib_path set to the union mount, a bit evil but i think its a good solution #the app could have exited now, OR it went into bg, we still need to wait in that case till it really quits! @@ -209,25 +209,25 @@ fi #clean up -sudo rmdir /mnt/utmp/$BASENAME -sudo rm /mnt/utmp/$BASENAME -sudo umount /mnt/utmp/$BASENAME #umount union +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 - sudo umount /mnt/pnd/$BASENAME + sudo umount "/mnt/pnd/$BASENAME" #delete folders created by aufs if empty - sudo rmdir $MOUNTPOINT/pandora/appdata/$BASENAME/.wh..wh.plnk - sudo rmdir $MOUNTPOINT/pandora/appdata/$BASENAME/.wh..wh..tmp + sudo rmdir "$MOUNTPOINT/pandora/appdata/$BASENAME/.wh..wh.plnk" + sudo rmdir "$MOUNTPOINT/pandora/appdata/$BASENAME/.wh..wh..tmp" #delete appdata folder and ancestors if empty - sudo rmdir -p $MOUNTPOINT/pandora/appdata/$BASENAME/ + 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 $(basename $PND) | tail -n1 | awk -F: '{print $1}') sudo /sbin/losetup -d $LOOP sudo rm $LOOP fi - sudo rmdir /mnt/pnd/$BASENAME #delete pnd mountpoint + sudo rmdir "/mnt/pnd/$BASENAME" #delete pnd mountpoint echo cleanup done else echo umount failed, didnt clean up -- 2.39.5