new file: testdata/scripts/pnd_button.sh
authorvimacs <vimacs@pndtest>
Sun, 15 Nov 2009 00:00:40 +0000 (01:00 +0100)
committervimacs <vimacs@pndtest>
Sun, 15 Nov 2009 00:00:40 +0000 (01:00 +0100)
take care of menu button
Added -c to create squashfs pnd
Now also eats squashfs

testdata/scripts/pnd_button.sh [new file with mode: 0755]
testdata/scripts/pnd_make.sh
testdata/scripts/pnd_run.sh

diff --git a/testdata/scripts/pnd_button.sh b/testdata/scripts/pnd_button.sh
new file mode 100755 (executable)
index 0000000..fd8d978
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+#actions done when the menu button is pressed
+#only argument is the time the button was pressed in  seconds
+
+if [ "$1" -ge "3" ]; then #button was pressed 3 sec or longer, show list of apps to kill instead of launcher
+  killist=y
+fi
+
+xpid=$(pidof X)
+if [ $xpid ]; then
+  echo "x is running"
+  if [ $killist ]; then
+    echo "displaying kill list"
+    pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*-\(.*\)(\([0-9]\+\))/\2\n \1/p' | zenity --list --multiple --column "pid" --column "name" --title "kill" --text "which apps should be killed" | sed 's/|/\n/')
+    for PID in $pidlist
+    do
+      kill -9 $PID
+    done
+  else
+  echo "starting appfinder"
+    xfce4-appfinder
+  fi
+else
+  echo "no x, killing all pnd aps so x gets restarted"
+  pndrunning=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p')
+  for PID in $pidlist
+  do
+    kill -9 $PID
+  done
+fi
index dcba316..8ae0ae4 100755 (executable)
@@ -13,6 +13,7 @@ while true ; do
                -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 ;;
+               -c) echo "-c set, will create compressed squasfs image instead of iso $2" ;SQUASH=1;shift 2 ;;
                --) shift ; break ;;
                *) echo "Error while parsing arguments! $2" ; exit 1 ;;
        esac
@@ -37,7 +38,15 @@ if [ ! -d $FOLDER ]; then echo "$FOLDER doesnt exist"; exit 1; fi #check if fold
 if [ ! -f $PXML ]; then echo "$PXML doesnt exist"; exit 1; fi #check if pxml actually exists
  
 #make iso from folder
-mkisofs -o $PNDNAME.iso -R $FOLDER
+if [ ! $SQUASH ]; then
+       mkisofs -o $PNDNAME.iso -R $FOLDER
+else
+       mksquashfs $FOLDER $PNDNAME.iso 
+fi
+#append pxml to iso
+else
+       mksquashfs $FOLDER $PNDNAME.iso 
+fi
 #append pxml to iso
 cat $PNDNAME.iso $PXML >  $PNDNAME
 rm $PNDNAME.iso #cleanup
index e95f033..b5b834a 100755 (executable)
@@ -116,8 +116,15 @@ 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
        echo "Filetype is $DFS"
+elif [ $DFS = Squashfs ]; then
+       usedminor=$( ls -l /dev/loop* | awk '{print $6}')
+       freeminor=$( echo -e "$(seq 0 64)\n$usedminor" | sort -rn | uniq -u | tail -n1)
+       sudo mknod -m777 /dev/loop$freeminor b 7 $freeminor
+       sudo losetup /dev/loop$freeminor $PND #attach the pnd to the loop device
+       mntline="sudo mount -t squashfs  /dev/loop$freeminor /mnt/pnd/$BASENAME"
+       echo "Filetype is $DFS"
 else
-       echo "error"
+       echo "error determining fs, output was $DFS"
        exit 1;
 fi