mirror of
https://github.com/flatcar/scripts.git
synced 2026-02-26 18:11:45 +01:00
Changes to image_to_live to copy stateful partition over
Review URL: http://codereview.chromium.org/1784006
This commit is contained in:
parent
86e28fd1d9
commit
ef96430135
@ -31,6 +31,7 @@ function cleanup {
|
||||
echo "Killing dev server."
|
||||
kill_all_devservers
|
||||
cleanup_remote_access
|
||||
. "$(dirname $0)/mount_gpt_image.sh" -mu
|
||||
rm -rf "${TMP}"
|
||||
}
|
||||
|
||||
@ -54,6 +55,25 @@ function start_dev_server {
|
||||
echo ""
|
||||
}
|
||||
|
||||
function copy_stateful_tarball {
|
||||
echo "Starting stateful update."
|
||||
# Mounts most recent image stateful dir to /tmp/s
|
||||
. "$(dirname $0)/mount_gpt_image.sh" -m
|
||||
# Create tar files for the stateful partition.
|
||||
cd /tmp/s/var && sudo tar -cf /tmp/var.tar . && cd -
|
||||
cd /tmp/s/dev_image && sudo tar -cf /tmp/developer.tar . && cd -
|
||||
# Copy over tar files.
|
||||
remote_cp /tmp/var.tar /tmp
|
||||
remote_cp /tmp/developer.tar /tmp
|
||||
remote_sh "mkdir /mnt/stateful_partition/var_new |\
|
||||
mkdir /mnt/stateful_partition/dev_image_new |\
|
||||
tar -xf /tmp/var.tar -C /mnt/stateful_partition/var_new |\
|
||||
tar -xf /tmp/developer.tar \
|
||||
-C /mnt/stateful_partition/dev_image_new"
|
||||
# unmounts stateful partition
|
||||
. "$(dirname $0)/mount_gpt_image.sh" -mu
|
||||
}
|
||||
|
||||
function prepare_update_metadata {
|
||||
remote_sh "mount -norw,remount /"
|
||||
|
||||
@ -179,6 +199,11 @@ function main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! copy_stateful_tarball; then
|
||||
echo "Stateful update was not successful."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
remote_reboot
|
||||
|
||||
if [[ ${FLAGS_update_hostkey} -eq ${FLAGS_TRUE} ]]; then
|
||||
|
||||
@ -11,6 +11,13 @@ DEFINE_string remote "" "remote hostname/IP of running Chromium OS instance"
|
||||
DEFINE_string private_key "$DEFAULT_PRIVATE_KEY" \
|
||||
"Private key of root account on remote host"
|
||||
|
||||
# Copies $1 to $2 on remote host
|
||||
function remote_cp() {
|
||||
REMOTE_OUT=$(scp -o StrictHostKeyChecking=no -o \
|
||||
UserKnownHostsFile=$TMP_KNOWN_HOSTS $1 root@$FLAGS_remote:$2)
|
||||
return ${PIPESTATUS[0]}
|
||||
}
|
||||
|
||||
function remote_sh() {
|
||||
REMOTE_OUT=$(ssh -o StrictHostKeyChecking=no -o \
|
||||
UserKnownHostsFile=$TMP_KNOWN_HOSTS root@$FLAGS_remote "$@")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user