| Index: src/platform/memento_softwareupdate/memento_updater.sh
|
| diff --git a/src/platform/memento_softwareupdate/memento_updater.sh b/src/platform/memento_softwareupdate/memento_updater.sh
|
| index 33db4171de8faa8417e4ccbe741fa0d93eaf7e58..b39a3ce0fb23aa51fa36c8f6514542033e3dbe78 100755
|
| --- a/src/platform/memento_softwareupdate/memento_updater.sh
|
| +++ b/src/platform/memento_softwareupdate/memento_updater.sh
|
| @@ -77,11 +77,11 @@ if [ -z "${FLAGS_dst_partition}" ]; then
|
| fi
|
| fi
|
|
|
| -if ( set -o noclobber; echo "$$" > "$PID_FILE") 2> /dev/null;
|
| +if ( set -o noclobber; echo "$$" > "$PID_FILE") 2> /dev/null;
|
| then
|
| true
|
| else
|
| - log "Failed to acquire lockfile: $PID_FILE."
|
| + log "Failed to acquire lockfile: $PID_FILE."
|
| log "Held by $(cat $PID_FILE)"
|
| exit 1
|
| fi
|
| @@ -152,7 +152,7 @@ else
|
| INSTALL_DEV=$(echo $LOCAL_DEV | tr '35' '53')
|
| fi
|
| NEW_PART_NUM=${INSTALL_DEV##*/*[a-z]}
|
| -# The kernel needs to be installed to its own partition.
|
| +# The kernel needs to be installed to its own partition.
|
| # partitions 2&3 are image A, partitions 4&5 are image B.
|
| if [ -z "${FLAGS_kernel_partition}" ]; then
|
| KINSTALL_DEV=$(echo $INSTALL_DEV | tr '35' '24')
|
| @@ -170,12 +170,12 @@ fi
|
| ROOT_DEV=${INSTALL_DEV%%[0-9]*}
|
|
|
| # Do some device sanity checks.
|
| -if ! expr match "$LOCAL_DEV" '^/dev/[a-z][a-z]*[123458]$' > /dev/null
|
| +if [ ! -b "$LOCAL_DEV" ]
|
| then
|
| log "didnt find good local device. local: $LOCAL_DEV install: $INSTALL_DEV"
|
| exit 1
|
| fi
|
| -if ! expr match "$INSTALL_DEV" '^/dev/[a-z][a-z]*[123458]$' > /dev/null
|
| +if [ ! -b "$INSTALL_DEV" ]
|
| then
|
| log "didnt find good install device. local: $LOCAL_DEV install: $INSTALL_DEV"
|
| exit 1
|
| @@ -284,7 +284,7 @@ if [ $FLAGS_skip_postinst -eq $FLAGS_FALSE ]; then
|
| MOUNTPOINT=/tmp/newpart
|
| mkdir -p "$MOUNTPOINT"
|
| mount "$INSTALL_DEV" "$MOUNTPOINT"
|
| -
|
| +
|
| # Check version of new software if not forcing a dst partition
|
| if [ -z "${FLAGS_dst_partition}" ]; then
|
| NEW_VERSION=$(grep ^GOOGLE_RELEASE "$MOUNTPOINT"/etc/lsb-release | \
|
| @@ -307,42 +307,28 @@ if [ $FLAGS_skip_postinst -eq $FLAGS_FALSE ]; then
|
| fi
|
| fi
|
| fi
|
| -
|
| +
|
| "$MOUNTPOINT"/postinst "$INSTALL_DEV" 2>&1 | cat >> "$MEMENTO_AU_LOG"
|
| [ "${PIPESTATUS[*]}" = "0 0" ]
|
| POSTINST_RETURN_CODE=$?
|
| umount "$MOUNTPOINT"
|
| rmdir "$MOUNTPOINT"
|
| -
|
| +
|
| # If it failed, don't update MBR but just to be safe, zero out a page of
|
| # install device.
|
| abort_update_if_cmd_failed_long "$POSTINST_RETURN_CODE" "$MOUNTPOINT"/postinst
|
| # postinstall on new partition succeeded.
|
| fi
|
|
|
| -# flush linux caches; seems to be necessary
|
| -sync
|
| -echo 3 > /proc/sys/vm/drop_caches
|
| -# Configure the PMBR to boot the new image.
|
| -# TODO: ChromeOS EFI BIOS will need a different command to set the GPT
|
| -# partition attributes bits to mark the new image as bootable.
|
| -# NOTE: This won't work for ARM, because we'll need to regenerate the U-Boot
|
| -# script when the kernel size and location are changed. Luckily it won't
|
| -# matter because we'll ship with the GPT-based selection process. The U-Boot
|
| -# script is just a temporary hack for bringup.
|
| -# FIX: The current gpt tool requires a -b arg to specify the PMBR bootcode. We
|
| -# don't want to change the code, so we have to extract it, then put it back.
|
| -# We'll fix this RSN.
|
| -dd if=${ROOT_DEV} bs=512 count=1 of=/tmp/oldpmbr.bin
|
| -gpt -S boot -i $NEW_PART_NUM -b /tmp/oldpmbr.bin ${ROOT_DEV} 2>&1 | \
|
| - cat >> "$MEMENTO_AU_LOG"
|
| -abort_update_if_cmd_failed
|
| -
|
| if [ -z "${FLAGS_dst_partition}" ]; then
|
| # mark update as complete so we don't try to update again
|
| touch "$UPDATED_COMPLETED_FILE"
|
| fi
|
|
|
| +# Flush linux caches; seems to be necessary
|
| +sync
|
| +echo 3 > /proc/sys/vm/drop_caches
|
| +
|
| # tell user to reboot
|
| log Autoupdate applied. You should now reboot
|
| echo UPDATED
|
|
|