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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 CHECKSUM_FILE="/tmp/memento_autoupdate_checksum" | 224 CHECKSUM_FILE="/tmp/memento_autoupdate_checksum" |
225 | 225 |
226 # Generally we pipe to split_write to write to two devices, but if | 226 # Generally we pipe to split_write to write to two devices, but if |
227 # KINSTALL_DEV is 'none' we write directly to a specific output device. | 227 # KINSTALL_DEV is 'none' we write directly to a specific output device. |
228 WRITE_COMMAND='cat > "$INSTALL_DEV"' | 228 WRITE_COMMAND='cat > "$INSTALL_DEV"' |
229 if [ "$KINSTALL_DEV" != "none" ]; then | 229 if [ "$KINSTALL_DEV" != "none" ]; then |
230 WRITE_COMMAND='"$(dirname "$0")"/split_write "$KINSTALL_DEV" "$INSTALL_DEV"' | 230 WRITE_COMMAND='"$(dirname "$0")"/split_write "$KINSTALL_DEV" "$INSTALL_DEV"' |
231 fi | 231 fi |
232 | 232 |
233 COMMAND='wget -O - --load-cookies <(echo "$COOKIES") \ | 233 COMMAND='wget --progress=dot:mega -O - --load-cookies <(echo "$COOKIES") \ |
234 "$IMG_URL" 2>> "$MEMENTO_AU_LOG" | \ | 234 "$IMG_URL" 2>> "$MEMENTO_AU_LOG" | \ |
235 tee >(openssl sha1 -binary | openssl base64 > "$CHECKSUM_FILE") | \ | 235 tee >(openssl sha1 -binary | openssl base64 > "$CHECKSUM_FILE") | \ |
236 gzip -d | '${WRITE_COMMAND}' ; echo ${PIPESTATUS[*]}' | 236 gzip -d | '${WRITE_COMMAND}' ; echo ${PIPESTATUS[*]}' |
237 | 237 |
238 RETURNED_CODES=$(eval "$COMMAND") | 238 RETURNED_CODES=$(eval "$COMMAND") |
239 | 239 |
240 EXPECTED_CODES="0 0 0 0" | 240 EXPECTED_CODES="0 0 0 0" |
241 CALCULATED_CS=$(cat "$CHECKSUM_FILE") | 241 CALCULATED_CS=$(cat "$CHECKSUM_FILE") |
242 rm -f "$CHECKSUM_FILE" | 242 rm -f "$CHECKSUM_FILE" |
243 | 243 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 touch "$UPDATED_COMPLETED_FILE" | 346 touch "$UPDATED_COMPLETED_FILE" |
347 fi | 347 fi |
348 | 348 |
349 # Flush linux caches; seems to be necessary | 349 # Flush linux caches; seems to be necessary |
350 sync | 350 sync |
351 echo 3 > /proc/sys/vm/drop_caches | 351 echo 3 > /proc/sys/vm/drop_caches |
352 | 352 |
353 # tell user to reboot | 353 # tell user to reboot |
354 log Autoupdate applied. You should now reboot | 354 log Autoupdate applied. You should now reboot |
355 echo UPDATED | 355 echo UPDATED |
OLD | NEW |