pandora-scripts: improve op_osupgrade
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_osupgrade.sh
old mode 100644 (file)
new mode 100755 (executable)
index 9968fe9..973518a
@@ -1,4 +1,5 @@
 #!/bin/sh
+work_script_path="/usr/pandora/scripts/op_osupgrade_work.sh"
 kernel_path="/boot/uImage-3"
 
 zenity --question --title="Update Firmware OS" --text="This little tool helps you to keep your firmware OS up-to-date with the latest tweaks.\n\nPlease note that this is in TESTING state and\nmight break parts of your system with unstable packages!\n\nMake sure your Pandora is connected to the internet and click the Upgrade-Button.\n\n" --ok-label="Upgrade OS" --cancel-label="Quit" || exit 0
@@ -22,24 +23,14 @@ Aborting."
   exit 1
 fi
 
-rm -f /tmp/upgrade_ok
+rm -f /tmp/upgrade_ok /tmp/upgrade_script_updated
 kernelmd5_old=`md5sum $kernel_path`
 
 # reminder: don't use '&&' '||' ... after tee, it breaks set -e, no idea why
 terminal -x bash -c \
-  '( set -e; \
-     cd /tmp/; \
-     echo "Updating package lists..."; \
-     opkg update 2>&1; \
-     echo "Checking for updated packages..."; \
-     opkg upgrade 2>&1; \
-     touch /tmp/upgrade_ok; \
-     sync; \
-     echo "Finished, press Ctrl-C to exit" ) \
+  "( $work_script_path || ( echo && echo "Retrying.." && $work_script_path ) ) 2>&1 \
        | tee /tmp/upgrade.log; \
-   test -e /tmp/upgrade_ok || sleep 3'
-
-sync
+   test -e /tmp/upgrade_ok || sleep 3"
 
 kernelmd5_new=`md5sum $kernel_path`