From becbc7a4f72906f3b6bb242e3380d39816df4511 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Sun, 10 Feb 2013 01:59:28 +0200 Subject: [PATCH] op_osupgrade: add some sanity checks --- recipes/pandora-system/pandora-scripts.bb | 2 +- .../pandora-scripts/op_osupgrade.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/recipes/pandora-system/pandora-scripts.bb b/recipes/pandora-system/pandora-scripts.bb index e93dec9..350220b 100644 --- a/recipes/pandora-system/pandora-scripts.bb +++ b/recipes/pandora-system/pandora-scripts.bb @@ -6,7 +6,7 @@ COMPATIBLE_MACHINE = "omap3-pandora" DEPENDS = "zenity dbus" RDEPENDS = "zenity dbus" -PR = "r130" +PR = "r131" SRC_URI = " \ file://op_paths.sh \ diff --git a/recipes/pandora-system/pandora-scripts/op_osupgrade.sh b/recipes/pandora-system/pandora-scripts/op_osupgrade.sh index 1359e1a..3c9475d 100644 --- a/recipes/pandora-system/pandora-scripts/op_osupgrade.sh +++ b/recipes/pandora-system/pandora-scripts/op_osupgrade.sh @@ -1,6 +1,25 @@ #!/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 +# check free space +root_free=`df | grep '/$' | sed -e '2~1d' | awk '{print $4}'` +if [ "$root_free" -lt 20000 ]; then + zenity --error --text "There is not enough free space left in root partition +(at least 20MB is required). +This usually means your NAND is almost full. + +Delete some files and try again. Alternatively you can do a full reflash." + exit 1 +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. +Aborting." + exit 1 +fi + terminal -x bash -c \ 'echo "Updating package lists..." && \ opkg update 2>&1 | tee /tmp/upgrade.log && test ${PIPESTATUS[0]} -eq 0 && \ -- 2.39.2