mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-11 13:42:07 +01:00
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:
parent
5543339140
commit
5c37ce2e03
14
build_image
14
build_image
@ -332,7 +332,6 @@ if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
|
|||||||
# TODO(sosa@chromium.org) - Re-hide under statefuldev after switch
|
# TODO(sosa@chromium.org) - Re-hide under statefuldev after switch
|
||||||
# Flag will mount /usr/local on target device
|
# Flag will mount /usr/local on target device
|
||||||
sudo mkdir -p "$ROOT_FS_DIR/root"
|
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.
|
# 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"
|
sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin"
|
||||||
@ -410,13 +409,14 @@ menuentry "boot from usb with serial debug" {
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Run ldconfig for rootfs's ld.so.cache
|
# By default, dev mode should be activated for either development builds or
|
||||||
if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then
|
# test builds.
|
||||||
# Re-run ldconfig to fix /etc/ldconfig.so.cache
|
if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ||\
|
||||||
sudo /sbin/ldconfig -r "$ROOT_FS_DIR"
|
[[ $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.
|
# Re-run ldconfig to fix /etc/ldconfig.so.cache.
|
||||||
sudo ln -sf "/usr/local/bin/aterm" "/usr/bin/xterm"
|
sudo /sbin/ldconfig -r "$ROOT_FS_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"${SCRIPTS_DIR}/customize_rootfs" \
|
"${SCRIPTS_DIR}/customize_rootfs" \
|
||||||
|
|||||||
@ -34,10 +34,6 @@ function cleanup {
|
|||||||
rm -rf "${TMP}"
|
rm -rf "${TMP}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function unmount_gpt {
|
|
||||||
./mount_gpt_image.sh -mu
|
|
||||||
}
|
|
||||||
|
|
||||||
function remote_reboot_sh {
|
function remote_reboot_sh {
|
||||||
rm -f "${TMP_KNOWN_HOSTS}"
|
rm -f "${TMP_KNOWN_HOSTS}"
|
||||||
remote_sh "$@"
|
remote_sh "$@"
|
||||||
@ -46,7 +42,7 @@ function remote_reboot_sh {
|
|||||||
function start_dev_server {
|
function start_dev_server {
|
||||||
kill_all_devservers
|
kill_all_devservers
|
||||||
if [ ${FLAGS_verbose} -eq ${FLAGS_FALSE} ]; then
|
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
|
else
|
||||||
./enter_chroot.sh "./start_devserver" &
|
./enter_chroot.sh "./start_devserver" &
|
||||||
fi
|
fi
|
||||||
@ -58,35 +54,16 @@ function start_dev_server {
|
|||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copys new stateful var and developer directories to updating system.
|
# Copys stateful update script which fetches the newest stateful update
|
||||||
# chromeos_startup checks for .update_available on next boot and updates
|
# from the dev server and prepares the update. chromeos_startup finishes
|
||||||
# the stateful directories.
|
# the update on next boot.
|
||||||
function copy_stateful_tarball {
|
function copy_stateful_update {
|
||||||
echo "Starting stateful update."
|
echo "Starting stateful update."
|
||||||
# Mounts most recent image stateful dir to /tmp/s
|
local dev_dir="$(dirname $0)/../platform/dev"
|
||||||
./mount_gpt_image.sh -m
|
|
||||||
trap "unmount_gpt && cleanup" EXIT
|
|
||||||
|
|
||||||
# Create tar files for the stateful partition.
|
# Copy over tar files.
|
||||||
if [ ! -d /tmp/s/var ] || [ ! -d /tmp/s/dev_image ] ; then
|
remote_cp "$dev_dir/stateful_update.sh" "/tmp"
|
||||||
echo "No stateful directories found to copy. Continuing update."
|
remote_sh "/tmp/stateful_update.sh"
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare_update_metadata {
|
function prepare_update_metadata {
|
||||||
@ -214,7 +191,7 @@ function main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! copy_stateful_tarball; then
|
if ! copy_stateful_update; then
|
||||||
echo "Stateful update was not successful."
|
echo "Stateful update was not successful."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user