Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d21e8372 authored by Ladios Jonquil's avatar Ladios Jonquil
Browse files

envsetup: eat safely

Change-Id: I2d8b52206213d8f4d8dcce3518cadb2be59e78d8
parent c3db3dfe
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -630,16 +630,22 @@ function eat()
    if [ "$OUT" ] ; then
        MODVERSION=`sed -n -e'/ro\.modversion/s/^.*CyanogenMod-//p' $OUT/system/build.prop`
        ZIPFILE=$OUT/update-cm-$MODVERSION-signed.zip
        if [ $(adb get-state) != device ] ; then
            echo "No device is online. Waiting for one..."
            adb wait-for-device
        fi
        echo "Pushing update-cm-$MODVERSION-signed.zip to device"
        adb push $ZIPFILE /mnt/sdcard/
        if adb push $ZIPFILE /mnt/sdcard/ ; then
            cat << EOF > /tmp/extendedcommand
ui_print("Nom nom nom nom...");
install_zip("/sdcard/update-cm-$MODVERSION-signed.zip");
EOF
        adb push /tmp/extendedcommand /cache/recovery/
        rm /tmp/extendedcommand
            if adb push /tmp/extendedcommand /cache/recovery/ ; then
                echo "Rebooting into recovery for installation"
                adb reboot recovery
            fi
            rm /tmp/extendedcommand
        fi
    else
        echo "Nothing to eat"
        return 1