Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: cros_generate_update_payload

Issue 3167035: AU: when generating payload, don't patch kernel by default (Closed) Base URL: ssh://git@chromiumos-git/crosutils.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 # We should be in the chroot. 95 # We should be in the chroot.
96 assert_inside_chroot 96 assert_inside_chroot
97 97
98 DEFINE_string image "" "The image that should be sent to clients." 98 DEFINE_string image "" "The image that should be sent to clients."
99 DEFINE_string src_image "" "Optional: a source image. If specified, this makes\ 99 DEFINE_string src_image "" "Optional: a source image. If specified, this makes\
100 a delta update." 100 a delta update."
101 DEFINE_boolean old_style "$FLAGS_TRUE" "Generate an old-style .gz full update." 101 DEFINE_boolean old_style "$FLAGS_TRUE" "Generate an old-style .gz full update."
102 DEFINE_string output "" "Output file" 102 DEFINE_string output "" "Output file"
103 DEFINE_boolean patch_kernel "$FLAGS_FALSE" "Whether or not to patch the kernel \
104 with the patch from the stateful partition (default: false)"
103 105
104 # Parse command line 106 # Parse command line
105 FLAGS "$@" || exit 1 107 FLAGS "$@" || exit 1
106 eval set -- "${FLAGS_ARGV}" 108 eval set -- "${FLAGS_ARGV}"
107 109
108 set -e 110 set -e
109 111
110 locate_gpt 112 locate_gpt
111 113
112 DELTA=$FLAGS_TRUE 114 DELTA=$FLAGS_TRUE
(...skipping 11 matching lines...) Expand all
124 126
125 if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then 127 if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then
126 echo "Generating a delta update" 128 echo "Generating a delta update"
127 129
128 # Sanity check that the real generator exists: 130 # Sanity check that the real generator exists:
129 GENERATOR="$(dirname "$0")/../platform/update_engine/delta_generator" 131 GENERATOR="$(dirname "$0")/../platform/update_engine/delta_generator"
130 [ -x "$GENERATOR" ] || die "$GENERATOR doesn't exist, or isn't executable" 132 [ -x "$GENERATOR" ] || die "$GENERATOR doesn't exist, or isn't executable"
131 133
132 trap cleanup INT TERM EXIT 134 trap cleanup INT TERM EXIT
133 SRC_KERNEL=$(extract_partition_to_temp_file "$FLAGS_src_image" 2) 135 SRC_KERNEL=$(extract_partition_to_temp_file "$FLAGS_src_image" 2)
134 patch_kernel "$FLAGS_src_image" "$SRC_KERNEL" 136 if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then
137 patch_kernel "$FLAGS_src_image" "$SRC_KERNEL"
138 fi
135 SRC_ROOT=$(extract_partition_to_temp_file "$FLAGS_src_image" 3) 139 SRC_ROOT=$(extract_partition_to_temp_file "$FLAGS_src_image" 3)
136 140
137 echo md5sum of src kernel: 141 echo md5sum of src kernel:
138 md5sum "$SRC_KERNEL" 142 md5sum "$SRC_KERNEL"
139 echo md5sum of src root: 143 echo md5sum of src root:
140 md5sum "$SRC_ROOT" 144 md5sum "$SRC_ROOT"
141 145
142 DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2) 146 DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2)
143 patch_kernel "$FLAGS_image" "$DST_KERNEL" 147 if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then
148 patch_kernel "$FLAGS_image" "$DST_KERNEL"
149 fi
144 DST_ROOT=$(extract_partition_to_temp_file "$FLAGS_image" 3) 150 DST_ROOT=$(extract_partition_to_temp_file "$FLAGS_image" 3)
145 151
146 SRC_MNT=$(mktemp -d /tmp/src_root.XXXXXX) 152 SRC_MNT=$(mktemp -d /tmp/src_root.XXXXXX)
147 sudo mount -o loop,ro "$SRC_ROOT" "$SRC_MNT" 153 sudo mount -o loop,ro "$SRC_ROOT" "$SRC_MNT"
148 154
149 DST_MNT=$(mktemp -d /tmp/src_root.XXXXXX) 155 DST_MNT=$(mktemp -d /tmp/src_root.XXXXXX)
150 sudo mount -o loop,ro "$DST_ROOT" "$DST_MNT" 156 sudo mount -o loop,ro "$DST_ROOT" "$DST_MNT"
151 157
152 sudo "$GENERATOR" \ 158 sudo "$GENERATOR" \
153 -new_dir "$DST_MNT" -new_image "$DST_ROOT" -new_kernel "$DST_KERNEL" \ 159 -new_dir "$DST_MNT" -new_image "$DST_ROOT" -new_kernel "$DST_KERNEL" \
154 -old_dir "$SRC_MNT" -old_image "$SRC_ROOT" -old_kernel "$SRC_KERNEL" \ 160 -old_dir "$SRC_MNT" -old_image "$SRC_ROOT" -old_kernel "$SRC_KERNEL" \
155 -out_file "$FLAGS_output" 161 -out_file "$FLAGS_output"
156 162
157 trap - INT TERM EXIT 163 trap - INT TERM EXIT
158 cleanup noexit 164 cleanup noexit
159 echo "Done generating delta." 165 echo "Done generating delta."
160 else 166 else
161 echo "Generating full update" 167 echo "Generating full update"
162 168
163 trap cleanup INT TERM EXIT 169 trap cleanup INT TERM EXIT
164 DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2) 170 DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2)
165 patch_kernel "$FLAGS_image" "$DST_KERNEL" 171 if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then
172 patch_kernel "$FLAGS_image" "$DST_KERNEL"
173 fi
166 DST_ROOT=$(extract_partition_to_temp_file "$FLAGS_image" 3) 174 DST_ROOT=$(extract_partition_to_temp_file "$FLAGS_image" 3)
167 175
168 GENERATOR="$(dirname "$0")/mk_memento_images.sh" 176 GENERATOR="$(dirname "$0")/mk_memento_images.sh"
169 177
170 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" 178 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT"
171 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" 179 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output"
172 180
173 trap - INT TERM EXIT 181 trap - INT TERM EXIT
174 cleanup noexit 182 cleanup noexit
175 echo "Done generating full update." 183 echo "Done generating full update."
176 fi 184 fi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698