X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=blobdiff_plain;f=recipes%2Fpandora-system%2Fpandora-scripts%2Fop_osupgrade.sh;h=fa0a837a18c669bf92af308f4222730c0e03fe86;hp=3c9475dd89010893dbbeacc5321196dbb84bfe7d;hb=68f11caa9d96ff76d2675010d335c4b7f097c96b;hpb=becbc7a4f72906f3b6bb242e3380d39816df4511 diff --git a/recipes/pandora-system/pandora-scripts/op_osupgrade.sh b/recipes/pandora-system/pandora-scripts/op_osupgrade.sh old mode 100644 new mode 100755 index 3c9475d..fa0a837 --- a/recipes/pandora-system/pandora-scripts/op_osupgrade.sh +++ b/recipes/pandora-system/pandora-scripts/op_osupgrade.sh @@ -1,5 +1,17 @@ #!/bin/sh -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 +work_script_path="/usr/pandora/scripts/op_osupgrade_work.sh" +kernel_path="/boot/uImage-3" + +get_version() +{ + ver=`grep "Display Ver:" /etc/op-version | awk -F': ' '{print $2}' 2> /dev/null` + if [ -n "$ver" ]; then + echo "Current OS version:\n$ver" + fi +} + +ver=`get_version` +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$ver" --ok-label="Upgrade OS" --cancel-label="Quit" || exit 0 # check free space root_free=`df | grep '/$' | sed -e '2~1d' | awk '{print $4}'` @@ -15,23 +27,38 @@ fi # check for default angstrom feeds if cat /etc/opkg/*.conf | awk -F# '{printf $1}' | grep -q www.angstrom-distribution.org; then zenity --error --text "There seem to be Angstrom feeds in your opkg configs, \ -upgraging from them is known to make the system unbootable. +upgrading from them is known to make the system unbootable. Aborting." exit 1 fi +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 \ - 'echo "Updating package lists..." && \ - opkg update 2>&1 | tee /tmp/upgrade.log && test ${PIPESTATUS[0]} -eq 0 && \ - echo "Checking for updated packages..." && \ - opkg upgrade 2>&1 | tee -a /tmp/upgrade.log && test ${PIPESTATUS[0]} -eq 0 && \ - touch /tmp/upgrade_ok || sleep 3' + "( $work_script_path || ( echo && echo "Retrying.." && $work_script_path ) ) 2>&1 \ + | tee /tmp/upgrade.log; \ + test -e /tmp/upgrade_ok || sleep 3" + +kernelmd5_new=`md5sum $kernel_path` if test -e /tmp/upgrade_ok; then + rm -f /tmp/upgrade_ok + ver=`get_version` zenity --info --title="Upgrade complete" \ - --text "All operations have been finished.\n\nYou can find a logfile at /tmp/upgrade.log" + --text "All operations have been finished.\n\nYou can find a log file at /tmp/upgrade.log\n\n$ver" + if [ "$kernelmd5_old" != "$kernelmd5_new" ]; then + zenity --question --title="Kernel updated" \ + --text "The kernel has been updated,\nreboot is needed to start it.\n\nReboot now?" \ + --ok-label="Yes" --cancel-label="No, do it later" \ + && reboot + fi else zenity --error --title="Errors detected" \ - --text "Errors detected during update.\n\nYou can find a logfile at /tmp/upgrade.log" + --text "Errors detected during update. Please check your Internet connection and try again. + +If long update process was interrupted, it is recommended to run the update again before a reboot. + +You can find a log file at /tmp/upgrade.log" fi -rm -f /tmp/upgrade_ok