| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # This is the autoupdater for Memento. When called it consults Omaha to see | 7 # This is the autoupdater for Memento. When called it consults Omaha to see |
| 8 # if there's an update available. If so, it downloads it to the other | 8 # if there's an update available. If so, it downloads it to the other |
| 9 # partition on the Memento USB stick, then alters the MBR and partitions | 9 # partition on the Memento USB stick, then alters the MBR and partitions |
| 10 # as needed so the next reboot will boot into the newly installed partition. | 10 # as needed so the next reboot will boot into the newly installed partition. |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 168 |
| 169 # Find whole disk device. | 169 # Find whole disk device. |
| 170 ROOT_DEV=${INSTALL_DEV%%[0-9]*} | 170 ROOT_DEV=${INSTALL_DEV%%[0-9]*} |
| 171 | 171 |
| 172 # Do some device sanity checks. | 172 # Do some device sanity checks. |
| 173 if [ ! -b "$LOCAL_DEV" ] | 173 if [ ! -b "$LOCAL_DEV" ] |
| 174 then | 174 then |
| 175 log "didnt find good local device. local: $LOCAL_DEV install: $INSTALL_DEV" | 175 log "didnt find good local device. local: $LOCAL_DEV install: $INSTALL_DEV" |
| 176 exit 1 | 176 exit 1 |
| 177 fi | 177 fi |
| 178 if [ ! -b "$INSTALL_DEV" ] | 178 if [ ! -b "$INSTALL_DEV" -a ! "${FLAGS_force_track}" = "firmware-channel" ] |
| 179 then | 179 then |
| 180 log "didnt find good install device. local: $LOCAL_DEV install: $INSTALL_DEV" | 180 log "didnt find good install device. local: $LOCAL_DEV install: $INSTALL_DEV" |
| 181 exit 1 | 181 exit 1 |
| 182 fi | 182 fi |
| 183 if [ "$LOCAL_DEV" == "$INSTALL_DEV" ] | 183 if [ "$LOCAL_DEV" == "$INSTALL_DEV" ] |
| 184 then | 184 then |
| 185 log local and installation device are the same: "$LOCAL_DEV" | 185 log local and installation device are the same: "$LOCAL_DEV" |
| 186 exit 1 | 186 exit 1 |
| 187 fi | 187 fi |
| 188 | 188 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 POSTINST_RETURN_CODE=$? | 313 POSTINST_RETURN_CODE=$? |
| 314 umount "$MOUNTPOINT" | 314 umount "$MOUNTPOINT" |
| 315 rmdir "$MOUNTPOINT" | 315 rmdir "$MOUNTPOINT" |
| 316 | 316 |
| 317 # If it failed, don't update MBR but just to be safe, zero out a page of | 317 # If it failed, don't update MBR but just to be safe, zero out a page of |
| 318 # install device. | 318 # install device. |
| 319 abort_update_if_cmd_failed_long "$POSTINST_RETURN_CODE" "$MOUNTPOINT"/postinst | 319 abort_update_if_cmd_failed_long "$POSTINST_RETURN_CODE" "$MOUNTPOINT"/postinst |
| 320 # postinstall on new partition succeeded. | 320 # postinstall on new partition succeeded. |
| 321 fi | 321 fi |
| 322 | 322 |
| 323 if [ "${FLAGS_force_track}" = "firmware-channel" ]; then |
| 324 log execute firmware-install script |
| 325 INSTALL_SCRIPT="${FLAGS_dst_partition}" |
| 326 chmod +x "${INSTALL_SCRIPT}" |
| 327 pushd "$(dirname "${INSTALL_SCRIPT}")" > /dev/null |
| 328 eval "${INSTALL_SCRIPT}" >> "$MEMENTO_AU_LOG" |
| 329 popd > /dev/null |
| 330 fi |
| 331 |
| 323 if [ -z "${FLAGS_dst_partition}" ]; then | 332 if [ -z "${FLAGS_dst_partition}" ]; then |
| 324 # mark update as complete so we don't try to update again | 333 # mark update as complete so we don't try to update again |
| 325 touch "$UPDATED_COMPLETED_FILE" | 334 touch "$UPDATED_COMPLETED_FILE" |
| 326 fi | 335 fi |
| 327 | 336 |
| 328 # Flush linux caches; seems to be necessary | 337 # Flush linux caches; seems to be necessary |
| 329 sync | 338 sync |
| 330 echo 3 > /proc/sys/vm/drop_caches | 339 echo 3 > /proc/sys/vm/drop_caches |
| 331 | 340 |
| 332 # tell user to reboot | 341 # tell user to reboot |
| 333 log Autoupdate applied. You should now reboot | 342 log Autoupdate applied. You should now reboot |
| 334 echo UPDATED | 343 echo UPDATED |
| OLD | NEW |