Modifies dev server to produce stateful gzip and modify image_to_live to use it.

TEST=Tested with image_to_live, memento_updater without image_to_live

This mimics the update process of the real image for the stateful partition.
By moving this the update into a separate script, I can add it to the gmerge
package such that developers will not have to use image_to_live.  This change
also removes the dependency on tar.

Review URL: http://codereview.chromium.org/1774021
This commit is contained in:
Chris Sosa 2010-05-03 20:18:02 -07:00
parent 5543339140
commit 5c37ce2e03
2 changed files with 17 additions and 40 deletions

View File

@ -332,7 +332,6 @@ if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
# TODO(sosa@chromium.org) - Re-hide under statefuldev after switch
# Flag will mount /usr/local on target device
sudo mkdir -p "$ROOT_FS_DIR/root"
sudo touch "$ROOT_FS_DIR/root/.dev_mode"
# The ldd tool is a useful shell script but lives in glibc; just copy it.
sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin"
@ -410,13 +409,14 @@ menuentry "boot from usb with serial debug" {
EOF
# Run ldconfig for rootfs's ld.so.cache
if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then
# Re-run ldconfig to fix /etc/ldconfig.so.cache
sudo /sbin/ldconfig -r "$ROOT_FS_DIR"
# By default, dev mode should be activated for either development builds or
# test builds.
if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ||\
[[ $FLAGS_withtest -eq $FLAGS_TRUE ]]; then
sudo touch "$ROOT_FS_DIR/root/.dev_mode"
#TODO(sosa@chromium.org) - /usr/bin/xterm symlink not created in stateful.
sudo ln -sf "/usr/local/bin/aterm" "/usr/bin/xterm"
# Re-run ldconfig to fix /etc/ldconfig.so.cache.
sudo /sbin/ldconfig -r "$ROOT_FS_DIR"
fi
"${SCRIPTS_DIR}/customize_rootfs" \

View File

@ -34,10 +34,6 @@ function cleanup {
rm -rf "${TMP}"
}
function unmount_gpt {
./mount_gpt_image.sh -mu
}
function remote_reboot_sh {
rm -f "${TMP_KNOWN_HOSTS}"
remote_sh "$@"
@ -46,7 +42,7 @@ function remote_reboot_sh {
function start_dev_server {
kill_all_devservers
if [ ${FLAGS_verbose} -eq ${FLAGS_FALSE} ]; then
./enter_chroot.sh "./start_devserver > /dev/null 2>&1" &
./enter_chroot.sh "./start_devserver > dev_server.log 2>&1" &
else
./enter_chroot.sh "./start_devserver" &
fi
@ -58,35 +54,16 @@ function start_dev_server {
echo ""
}
# Copys new stateful var and developer directories to updating system.
# chromeos_startup checks for .update_available on next boot and updates
# the stateful directories.
function copy_stateful_tarball {
# Copys stateful update script which fetches the newest stateful update
# from the dev server and prepares the update. chromeos_startup finishes
# the update on next boot.
function copy_stateful_update {
echo "Starting stateful update."
# Mounts most recent image stateful dir to /tmp/s
./mount_gpt_image.sh -m
trap "unmount_gpt && cleanup" EXIT
local dev_dir="$(dirname $0)/../platform/dev"
# Create tar files for the stateful partition.
if [ ! -d /tmp/s/var ] || [ ! -d /tmp/s/dev_image ] ; then
echo "No stateful directories found to copy. Continuing update."
else
pushd /tmp/s/var && sudo tar -czf /tmp/var.tgz . && popd
pushd /tmp/s/dev_image && sudo tar -czf /tmp/developer.tgz . && popd
# Copy over tar files.
local s_dir="/mnt/stateful_partition"
remote_cp /tmp/var.tgz /tmp
remote_cp /tmp/developer.tgz /tmp
remote_sh "rm -rf $s_dir/var_new $s_dir/dev_image_new &&\
mkdir $s_dir/var_new $s_dir/dev_image_new &&\
tar -xzf /tmp/var.tgz -C $s_dir/var_new &&\
tar -xzf /tmp/developer.tgz -C $s_dir/dev_image_new &&\
touch $s_dir/.update_available"
fi
# unmounts stateful partition
./mount_gpt_image.sh -mu
trap cleanup EXIT
# Copy over tar files.
remote_cp "$dev_dir/stateful_update.sh" "/tmp"
remote_sh "/tmp/stateful_update.sh"
}
function prepare_update_metadata {
@ -214,7 +191,7 @@ function main() {
exit 1
fi
if ! copy_stateful_tarball; then
if ! copy_stateful_update; then
echo "Stateful update was not successful."
fi