| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 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 # Script to generate a Chromium OS update for use by the update engine. | 7 # Script to generate a Chromium OS update for use by the update engine. |
| 8 # If a source .bin is specified, the update is assumed to be a delta update. | 8 # If a source .bin is specified, the update is assumed to be a delta update. |
| 9 | 9 |
| 10 # Load common constants. This should be the first executable line. | 10 # Load common constants. This should be the first executable line. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 sudo losetup -o "$offset" "$STATE_LOOP_DEV" "$IMAGE" | 85 sudo losetup -o "$offset" "$STATE_LOOP_DEV" "$IMAGE" |
| 86 STATE_MNT=$(mktemp -d /tmp/state.XXXXXX) | 86 STATE_MNT=$(mktemp -d /tmp/state.XXXXXX) |
| 87 sudo mount "$STATE_LOOP_DEV" "$STATE_MNT" | 87 sudo mount "$STATE_LOOP_DEV" "$STATE_MNT" |
| 88 dd if="$STATE_MNT"/vmlinuz_hd.vblock of="$KERN_FILE" conv=notrunc | 88 dd if="$STATE_MNT"/vmlinuz_hd.vblock of="$KERN_FILE" conv=notrunc |
| 89 sudo umount "$STATE_MNT" | 89 sudo umount "$STATE_MNT" |
| 90 STATE_MNT="" | 90 STATE_MNT="" |
| 91 sudo losetup -d "$STATE_LOOP_DEV" | 91 sudo losetup -d "$STATE_LOOP_DEV" |
| 92 STATE_LOOP_DEV="" | 92 STATE_LOOP_DEV="" |
| 93 } | 93 } |
| 94 | 94 |
| 95 # We should be in the chroot. | |
| 96 assert_inside_chroot | |
| 97 | |
| 98 DEFINE_string image "" "The image that should be sent to clients." | 95 DEFINE_string image "" "The image that should be sent to clients." |
| 99 DEFINE_string src_image "" "Optional: a source image. If specified, this makes\ | 96 DEFINE_string src_image "" "Optional: a source image. If specified, this makes\ |
| 100 a delta update." | 97 a delta update." |
| 101 DEFINE_boolean old_style "$FLAGS_TRUE" "Generate an old-style .gz full update." | 98 DEFINE_boolean old_style "$FLAGS_TRUE" "Generate an old-style .gz full update." |
| 102 DEFINE_string output "" "Output file" | 99 DEFINE_string output "" "Output file" |
| 103 DEFINE_boolean patch_kernel "$FLAGS_FALSE" "Whether or not to patch the kernel \ | 100 DEFINE_boolean patch_kernel "$FLAGS_FALSE" "Whether or not to patch the kernel \ |
| 104 with the patch from the stateful partition (default: false)" | 101 with the patch from the stateful partition (default: false)" |
| 105 | 102 |
| 106 # Parse command line | 103 # Parse command line |
| 107 FLAGS "$@" || exit 1 | 104 FLAGS "$@" || exit 1 |
| 108 eval set -- "${FLAGS_ARGV}" | 105 eval set -- "${FLAGS_ARGV}" |
| 109 | 106 |
| 110 set -e | 107 set -e |
| 111 | 108 |
| 109 if [ -n "$FLAGS_src_image" ]; then |
| 110 # We need to be in the chroot for generating delta images |
| 111 assert_inside_chroot |
| 112 fi |
| 113 |
| 112 locate_gpt | 114 locate_gpt |
| 113 | 115 |
| 114 DELTA=$FLAGS_TRUE | 116 DELTA=$FLAGS_TRUE |
| 115 [ -n "$FLAGS_output" ] || die \ | 117 [ -n "$FLAGS_output" ] || die \ |
| 116 "Error: you must specify an output filename with --output FILENAME" | 118 "Error: you must specify an output filename with --output FILENAME" |
| 117 | 119 |
| 118 if [ -z "$FLAGS_src_image" ]; then | 120 if [ -z "$FLAGS_src_image" ]; then |
| 119 DELTA=$FLAGS_FALSE | 121 DELTA=$FLAGS_FALSE |
| 120 if [ "$FLAGS_old_style" = "$FLAGS_TRUE" ]; then | 122 if [ "$FLAGS_old_style" = "$FLAGS_TRUE" ]; then |
| 121 echo "Generating an old-style full update" | 123 echo "Generating an old-style full update" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 177 |
| 176 GENERATOR="$(dirname "$0")/mk_memento_images.sh" | 178 GENERATOR="$(dirname "$0")/mk_memento_images.sh" |
| 177 | 179 |
| 178 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" | 180 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" |
| 179 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" | 181 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" |
| 180 | 182 |
| 181 trap - INT TERM EXIT | 183 trap - INT TERM EXIT |
| 182 cleanup noexit | 184 cleanup noexit |
| 183 echo "Done generating full update." | 185 echo "Done generating full update." |
| 184 fi | 186 fi |
| OLD | NEW |