--- /dev/null
+#!/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
-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
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
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