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

Side by Side Diff: src/scripts/image_to_live.sh

Issue 1784006: Changes to image_to_live to copy stateful partition over (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: Created 10 years, 7 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 | « src/platform/init/chromeos_startup ('k') | src/scripts/remote_access.sh » ('j') | 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) 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 # Script to update an image onto a live running ChromiumOS instance. 7 # Script to update an image onto a live running ChromiumOS instance.
8 8
9 # Load common constants. This should be the first executable line. 9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location. 10 # The path to common.sh should be relative to your script's location.
(...skipping 12 matching lines...) Expand all
23 23
24 function kill_all_devservers { 24 function kill_all_devservers {
25 # Using ! here to avoid exiting with set -e is insufficient, so use 25 # Using ! here to avoid exiting with set -e is insufficient, so use
26 # || true instead. 26 # || true instead.
27 pkill -fx ".*devserver\.py" || true 27 pkill -fx ".*devserver\.py" || true
28 } 28 }
29 29
30 function cleanup { 30 function cleanup {
31 echo "Killing dev server." 31 echo "Killing dev server."
32 kill_all_devservers 32 kill_all_devservers
33 cleanup_remote_access 33 cleanup_remote_access
34 ./mount_gpt_image.sh -mu
34 rm -rf "${TMP}" 35 rm -rf "${TMP}"
35 } 36 }
36 37
37 function remote_reboot_sh { 38 function remote_reboot_sh {
38 rm -f "${TMP_KNOWN_HOSTS}" 39 rm -f "${TMP_KNOWN_HOSTS}"
39 remote_sh "$@" 40 remote_sh "$@"
40 } 41 }
41 42
42 function start_dev_server { 43 function start_dev_server {
43 kill_all_devservers 44 kill_all_devservers
44 if [ ${FLAGS_verbose} -eq ${FLAGS_FALSE} ]; then 45 if [ ${FLAGS_verbose} -eq ${FLAGS_FALSE} ]; then
45 ./enter_chroot.sh "./start_devserver > /dev/null 2>&1" & 46 ./enter_chroot.sh "./start_devserver > /dev/null 2>&1" &
46 else 47 else
47 ./enter_chroot.sh "./start_devserver" & 48 ./enter_chroot.sh "./start_devserver" &
48 fi 49 fi
49 echo -n "Waiting on devserver to start" 50 echo -n "Waiting on devserver to start"
50 until netstat -anp 2>&1 | grep 8080 > /dev/null; do 51 until netstat -anp 2>&1 | grep 8080 > /dev/null; do
51 sleep .5 52 sleep .5
52 echo -n "." 53 echo -n "."
53 done 54 done
54 echo "" 55 echo ""
55 } 56 }
56 57
58 function copy_stateful_tarball {
59 echo "Starting stateful update."
60 # Mounts most recent image stateful dir to /tmp/s
61 ./mount_gpt_image.sh -m
62 # Create tar files for the stateful partition.
63 cd /tmp/s/var && sudo tar -cf /tmp/var.tar . && cd -
64 cd /tmp/s/dev_image && sudo tar -cf /tmp/developer.tar . && cd -
65 # Copy over tar files.
seano 2010/04/27 18:17:13 I might be missing the reason that you need to cre
66 remote_cp /tmp/var.tar /tmp
67 remote_cp /tmp/developer.tar /tmp
68 remote_sh "mkdir /mnt/stateful_partition/var_new &&\
69 mkdir /mnt/stateful_partition/dev_image_new &&\
70 tar -xf /tmp/var.tar -C /mnt/stateful_partition/var_new &&\
71 tar -xf /tmp/developer.tar \
72 -C /mnt/stateful_partition/dev_image_new &&\
73 touch /mnt/stateful_partition/.update_available"
74 # unmounts stateful partition
75 ./mount_gpt_image.sh -mu
76 }
77
57 function prepare_update_metadata { 78 function prepare_update_metadata {
58 remote_sh "mount -norw,remount /" 79 remote_sh "mount -norw,remount /"
59 80
60 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then 81 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then
61 echo "Forcing update independent of the current version" 82 echo "Forcing update independent of the current version"
62 remote_sh "cat /etc/lsb-release |\ 83 remote_sh "cat /etc/lsb-release |\
63 grep -v CHROMEOS_RELEASE_VERSION > /etc/lsb-release~;\ 84 grep -v CHROMEOS_RELEASE_VERSION > /etc/lsb-release~;\
64 mv /etc/lsb-release~ /etc/lsb-release; \ 85 mv /etc/lsb-release~ /etc/lsb-release; \
65 echo 'CHROMEOS_RELEASE_VERSION=0.0.0.0' >> /etc/lsb-release" 86 echo 'CHROMEOS_RELEASE_VERSION=0.0.0.0' >> /etc/lsb-release"
66 fi 87 fi
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 fi 192 fi
172 193
173 start_dev_server 194 start_dev_server
174 195
175 prepare_update_metadata 196 prepare_update_metadata
176 197
177 if ! run_auto_update; then 198 if ! run_auto_update; then
178 echo "Update was not successful." 199 echo "Update was not successful."
179 exit 1 200 exit 1
180 fi 201 fi
202
203 if ! copy_stateful_tarball; then
204 echo "Stateful update was not successful."
205 exit 1
206 fi
181 207
182 remote_reboot 208 remote_reboot
183 209
184 if [[ ${FLAGS_update_hostkey} -eq ${FLAGS_TRUE} ]]; then 210 if [[ ${FLAGS_update_hostkey} -eq ${FLAGS_TRUE} ]]; then
185 local known_hosts="${HOME}/.ssh/known_hosts" 211 local known_hosts="${HOME}/.ssh/known_hosts"
186 cp "${known_hosts}" "${known_hosts}~" 212 cp "${known_hosts}" "${known_hosts}~"
187 grep -v "^${FLAGS_remote} " "${known_hosts}" > "${TMP}/new_known_hosts" 213 grep -v "^${FLAGS_remote} " "${known_hosts}" > "${TMP}/new_known_hosts"
188 cat "${TMP}/new_known_hosts" "${TMP_KNOWN_HOSTS}" > "${known_hosts}" 214 cat "${TMP}/new_known_hosts" "${TMP_KNOWN_HOSTS}" > "${known_hosts}"
189 chmod 0640 "${known_hosts}" 215 chmod 0640 "${known_hosts}"
190 echo "New updated in ${known_hosts}, backup made." 216 echo "New updated in ${known_hosts}, backup made."
191 fi 217 fi
192 218
193 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" 219 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release"
194 local release_description=$(echo $REMOTE_OUT | cut -d '=' -f 2) 220 local release_description=$(echo $REMOTE_OUT | cut -d '=' -f 2)
195 echo "Update was successful and rebooted to $release_description" 221 echo "Update was successful and rebooted to $release_description"
196 222
197 return 0 223 return 0
198 } 224 }
199 225
200 main $@ 226 main $@
OLDNEW
« no previous file with comments | « src/platform/init/chromeos_startup ('k') | src/scripts/remote_access.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698