Index: chromeos-postinst |
diff --git a/chromeos-postinst b/chromeos-postinst |
index e183247ab9c24ba9f46ed953b704212d00987534..6504e4e17f7acfade27ab1fd8b367c72d388c5ed 100755 |
--- a/chromeos-postinst |
+++ b/chromeos-postinst |
@@ -14,7 +14,7 @@ INSTALL_ROOT=`dirname "$0"` |
INSTALL_DEV="$1" |
POSTCOMMIT="$2" |
# Find whole disk device. |
-ROOT_DEV=${INSTALL_DEV%%[0-9]*} |
+ROOT_DEV=$(get_block_dev_from_partition_dev ${INSTALL_DEV}) |
NEW_PART_NUM=${INSTALL_DEV##*/*[a-z]} |
case ${NEW_PART_NUM} in |
@@ -39,17 +39,20 @@ if [ "$POSTCOMMIT" != "--postcommit" ]; then |
echo " Set boot target to ${INSTALL_DEV}: \ |
Partition ${NEW_PART_NUM}, Slot ${BOOT_SLOT}" |
- echo "Updating /boot/extlinux.conf target" |
- # 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 |
+ if [ -f /boot/extlinux.conf ]; then |
+ echo "Updating /boot/extlinux.conf target" |
+ # 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 |
fi |
+ |
echo "Updating grub target for EFI BIOS" |
# Set up grub.cfg |
${INSTALL_ROOT}/usr/sbin/chromeos-setimage ${BOOT_SLOT} \ |
@@ -60,6 +63,7 @@ Partition ${NEW_PART_NUM}, Slot ${BOOT_SLOT}" |
sync |
echo 3 > /proc/sys/vm/drop_caches |
+ |
echo "Updating gpt PMBR target for legacy BIOS" |
# Configure the PMBR to boot the new image. |
# |