pnd_run.sh: restore fb0 too
[pandora-libraries.git] / testdata / scripts / pnd_run.sh
index c3562ea..c851920 100755 (executable)
@@ -314,8 +314,8 @@ mountPnd() {
                        #detect fs
                        case $PND_FSTYPE in
                        ISO)
-                               /sbin/losetup $FREELOOP "$PND" #attach the pnd to the loop device
-                               mntline="mount" #setup the mountline for later
+                               /sbin/losetup -r $FREELOOP "$PND" #attach the pnd to the loop device
+                               mntline="mount -o ro" #setup the mountline for later
                                mntdev="${FREELOOP}"
                                ;;
                        directory)
@@ -325,8 +325,8 @@ mountPnd() {
                                mntdev="${PND}"
                                ;;
                        Squashfs)
-                               /sbin/losetup $FREELOOP "$PND" #attach the pnd to the loop device
-                               mntline="mount -t squashfs"
+                               /sbin/losetup -r $FREELOOP "$PND" #attach the pnd to the loop device
+                               mntline="mount -t squashfs -o ro"
                                mntdev="${FREELOOP}"
                                ;;
                        *)
@@ -537,6 +537,8 @@ runApp() {
        fi
 
        export XDG_CONFIG_HOME="$UNION_MOUNT_DIR/$PND_NAME"
+       export REAL_HOME="$HOME"
+       export HOME="$UNION_MOUNT_DIR/$PND_NAME"
 
        if echo "$EXENAME"|grep -q ^\.\/;then
                "$EXENAME" $ARGUMENTS
@@ -551,6 +553,7 @@ runApp() {
                sleep 10s
                PID=`pidof -o %PPID -x \"$EXENAME\"`
        done
+       export HOME="$REAL_HOME"
        return $RC
 }
 
@@ -582,6 +585,7 @@ main() {
                        PND_EndTask
                fi
                oPWD=$(pwd)
+               old_fb0_geometry=$(fbset -fb /dev/fb0 -s | grep geometry | awk '{print $2, $3, $4, $5, $6}')
                if [ -e "${APPDATADIR}/PND_pre_script.sh" ]; then
                        PND_BeginTask "Starting user configured pre-script"
                        . ${APPDATADIR}/PND_pre_script.sh # Sourcing so it can shared vars with post-script ;)
@@ -606,6 +610,12 @@ main() {
                        PND_resetCPUSpeed
                        PND_EndTask
                fi
+               PND_BeginTask "Restoring the frame buffer status"
+               fbset -fb /dev/fb0 -g $old_fb0_geometry
+               if ! lsof /dev/fb1 > /dev/null; then
+                       ofbset -fb /dev/fb1 -mem 0 -size 0 0 -en 0
+               fi
+               PND_EndTask
                PND_BeginTask "uMount the PND"
                umountUnion
                PND_EndTask