Index: src/platform/installer/chromeos-postinst |
diff --git a/src/platform/installer/chromeos-postinst b/src/platform/installer/chromeos-postinst |
index b6e409e1af6f19c99c9871c08780909ef7446c66..151743806b89dc896e1ea3dfacb49d75835ea3c6 100755 |
--- a/src/platform/installer/chromeos-postinst |
+++ b/src/platform/installer/chromeos-postinst |
@@ -12,11 +12,27 @@ |
# Update /boot/extlinux.conf. |
INSTALL_ROOT=`dirname "$0"` |
INSTALL_DEV="$1" |
+POSTCOMMIT="$2" |
+ |
+if [ "$POSTCOMMIT" != "--postcommit" ]; then |
+ # Pre-commit. Returning an error here will prevent ever booting into the |
+ # installed system. |
+ |
+ # If the mount-point is read-write, update the bootloader |
+ # Only update extlinux.conf if $1 is non-empty |
+ if [ -n "$INSTALL_DEV" ]; then |
+ # Set default label to chromeos-hd. |
+ sed -i 's/^DEFAULT .*/DEFAULT chromeos-hd/' \ |
+ "$INSTALL_ROOT"/boot/extlinux.conf || true |
+ sed -i "{ s:HDROOT:$INSTALL_DEV: }" \ |
+ "$INSTALL_ROOT"/boot/extlinux.conf || true |
+ fi |
+ |
+else |
+ # Post-commit. At this point an unexpected reboot may boot the installed |
+ # system, but returning an error here will cause the updater to try to |
+ # not boot the installed system, instead keeping the existing system. |
-# Only update extlinux.conf if $1 is non-empty |
-if [ -n "$INSTALL_DEV" ]; then |
- # Set default label to chromeos-hd. |
- sed -i 's/^DEFAULT .*/DEFAULT chromeos-hd/' "$INSTALL_ROOT"/boot/extlinux.conf |
- sed -i "{ s:HDROOT:$INSTALL_DEV: }" "$INSTALL_ROOT"/boot/extlinux.conf |
fi |
+ |