From 45c24df9a33eff321146595a8af0a445f17fac65 Mon Sep 17 00:00:00 2001 From: Andrew de los Reyes Date: Thu, 7 Oct 2010 19:57:12 -0700 Subject: [PATCH] AU update generator script: support for new style full updates A corresponding CL adds support for the delta generator to generate new style full updates. This CL adds support for creating new style full updates to the common update payload generator script. This does not change the defaults, so generating a full update still uses the old style. BUG=7248 TEST=generated/applied full update on host Review URL: http://codereview.chromium.org/3604011 --- cros_generate_update_payload | 53 ++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/cros_generate_update_payload b/cros_generate_update_payload index f66b8aeb41..7cf31297b8 100755 --- a/cros_generate_update_payload +++ b/cros_generate_update_payload @@ -158,11 +158,11 @@ if [ -z "$FLAGS_src_image" ]; then if [ "$FLAGS_old_style" = "$FLAGS_TRUE" ]; then echo "Generating an old-style full update" else - die "Generating a new-style full update not yet supported" + echo "Generating a new-style full update" fi fi -if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then +if [ "$DELTA" -eq "$FLAGS_TRUE" -o "$FLAGS_old_style" -eq "$FLAGS_FALSE" ]; then echo "Generating a delta update" # Sanity check that the real generator exists: @@ -170,16 +170,18 @@ if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then [ -x "$GENERATOR" ] || die "$GENERATOR doesn't exist, or isn't executable" trap cleanup INT TERM EXIT - SRC_KERNEL=$(extract_partition_to_temp_file "$FLAGS_src_image" 2) - if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then - patch_kernel "$FLAGS_src_image" "$SRC_KERNEL" - fi - SRC_ROOT=$(extract_partition_to_temp_file "$FLAGS_src_image" 3) + if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then + SRC_KERNEL=$(extract_partition_to_temp_file "$FLAGS_src_image" 2) + if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then + patch_kernel "$FLAGS_src_image" "$SRC_KERNEL" + fi + SRC_ROOT=$(extract_partition_to_temp_file "$FLAGS_src_image" 3) - echo md5sum of src kernel: - md5sum "$SRC_KERNEL" - echo md5sum of src root: - md5sum "$SRC_ROOT" + echo md5sum of src kernel: + md5sum "$SRC_KERNEL" + echo md5sum of src root: + md5sum "$SRC_ROOT" + fi DST_KERNEL=$(extract_partition_to_temp_file "$FLAGS_image" 2) if [ "$FLAGS_patch_kernel" -eq "$FLAGS_TRUE" ]; then @@ -187,20 +189,31 @@ if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then fi DST_ROOT=$(extract_partition_to_temp_file "$FLAGS_image" 3) - SRC_MNT=$(mktemp -d /tmp/src_root.XXXXXX) - sudo mount -o loop,ro "$SRC_ROOT" "$SRC_MNT" + if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then + SRC_MNT=$(mktemp -d /tmp/src_root.XXXXXX) + sudo mount -o loop,ro "$SRC_ROOT" "$SRC_MNT" - DST_MNT=$(mktemp -d /tmp/src_root.XXXXXX) - sudo mount -o loop,ro "$DST_ROOT" "$DST_MNT" + DST_MNT=$(mktemp -d /tmp/src_root.XXXXXX) + sudo mount -o loop,ro "$DST_ROOT" "$DST_MNT" - sudo "$GENERATOR" \ - -new_dir "$DST_MNT" -new_image "$DST_ROOT" -new_kernel "$DST_KERNEL" \ - -old_dir "$SRC_MNT" -old_image "$SRC_ROOT" -old_kernel "$SRC_KERNEL" \ - -out_file "$FLAGS_output" -private_key "$FLAGS_private_key" + sudo "$GENERATOR" \ + -new_dir "$DST_MNT" -new_image "$DST_ROOT" -new_kernel "$DST_KERNEL" \ + -old_dir "$SRC_MNT" -old_image "$SRC_ROOT" -old_kernel "$SRC_KERNEL" \ + -out_file "$FLAGS_output" -private_key "$FLAGS_private_key" + else + "$GENERATOR" \ + -new_image "$DST_ROOT" -new_kernel "$DST_KERNEL" \ + -out_file "$FLAGS_output" -private_key "$FLAGS_private_key" + fi trap - INT TERM EXIT cleanup noexit - echo "Done generating delta." + + if [ "$DELTA" -eq "$FLAGS_TRUE" ]; then + echo "Done generating delta." + else + echo "Done generating new style full update." + fi else echo "Generating full update"