flatcar-scripts/bin/cros_revert_image.sh
Greg Spencer 798d75f3be This starts to fix the scripts so that they load from /usr/lib/crosutils
from within the chroot.

It also fixes a number of style issues.

It changes the meaning of cros_workon "list-all" to list all available
packages, and adds "list-live" to list all live packages.

It changes things that load chromeos-common.sh from the installer to
load it from /usr/lib/installer.

BUG=chromium-os:4230
TEST=synced, rebuilt chroot, made packages, made images, built chrome
from source, and wrote an image to a USB stick.

Review URL: http://codereview.chromium.org/6240018

Change-Id: I90c34420af1a64020402bafef8e9e77f56837c02
2011-02-01 22:04:49 -08:00

45 lines
816 B
Bash
Executable File

#!/bin/bash
# Copyright (c) 2011 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.
# Usage:
# revert_image.sh [image_to_revert]
#
# This assumes the image has been updated by update_image.sh.
usage()
{
cat <<EOF
usage:
revert_image.sh [image_to_revert]
EOF
}
if [[ $# < 1 ]]; then
echo "Not enough arguments supplied."
usage
exit 1
fi
IMAGE=$(readlink -f "$1")
IMAGE_DIR=$(dirname "$IMAGE")
if [[ -z "$IMAGE" ]]; then
echo "Missing required argument 'image_to_revert'"
usage
exit 1
fi
cd "$IMAGE_DIR"
if [[ ! -d "./orig_partitions" ]]; then
echo "Could not find original partitions."
exit 1
fi
cp -f ./orig_partitions/* ./
./pack_partitions.sh "$IMAGE"
rm -rf ./orig_partitions