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

Unified Diff: src/platform/dev/stateful_update.sh

Issue 1774021: Modifies dev server to produce stateful gzip and modify image_to_live to use it. (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: Fixes for seano Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/dev/autoupdate.py ('k') | src/scripts/build_image » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/dev/stateful_update.sh
diff --git a/src/platform/dev/stateful_update.sh b/src/platform/dev/stateful_update.sh
new file mode 100755
index 0000000000000000000000000000000000000000..9274618abf112537904cc8237e58675d0f4cb099
--- /dev/null
+++ b/src/platform/dev/stateful_update.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This scripts performs update of stateful partition directories useful for
+# dev_mode.
+
+# Die on error.
+set -e
+
+STATEFUL_DIR="/mnt/stateful_partition"
+STATEFUL_IMAGE="$STATEFUL_DIR/stateful.image"
+STATEFUL_MOUNT_POINT="/tmp/s"
+
+PING_OMAHA=/opt/google/memento_updater/ping_omaha.sh
+
+# Get image url for stateful image
+OMAHA_CHECK_OUTPUT=$($PING_OMAHA --app_version ForcedUpdate 2> /dev/null)
+ROOT_UPDATE_URL=$(echo "$OMAHA_CHECK_OUTPUT" | grep '^URL=' | cut -d = -f 2-)
+STATEFUL_UPDATE_URL="$(dirname "$ROOT_UPDATE_URL")/stateful.image.gz"
+
+# Prepare directories for update.
+rm -rf "$STATEFUL_DIR/var_new" "$STATEFUL_DIR/dev_image_new"
+
+# Prepare and mount new stateful partition.
+rm -rf "$STATEFUL_MOUNT_POINT"
+mkdir -p "$STATEFUL_MOUNT_POINT"
+
+# Unzip mount and copy the relevant directories.
+# Get the update.
+eval "wget -O - \"$STATEFUL_UPDATE_URL\"" | gzip -d > $STATEFUL_IMAGE
+trap "rm -f \"$STATEFUL_IMAGE\"" EXIT
+mount -n -o loop "$STATEFUL_IMAGE" "$STATEFUL_MOUNT_POINT"
+if [ -d "$STATEFUL_MOUNT_POINT/var" ] && \
+ [ -d "$STATEFUL_MOUNT_POINT/dev_image" ] ; then
+ cp -rf "$STATEFUL_MOUNT_POINT/var" "$STATEFUL_DIR/var_new"
+ cp -rf "$STATEFUL_MOUNT_POINT/dev_image" "$STATEFUL_DIR/dev_image_new"
+ touch "$STATEFUL_DIR/.update_available"
+else
+ echo "No update available"
+fi
+
+umount -n -d "$STATEFUL_MOUNT_POINT"
+
+rm -f "$STATEFUL_IMAGE"
+
+trap - EXIT
« no previous file with comments | « src/platform/dev/autoupdate.py ('k') | src/scripts/build_image » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698