x86: upgrade: make code comment appear as log lines
authorYousong Zhou <yszhou4tech@gmail.com>
Tue, 3 Nov 2020 03:41:44 +0000 (11:41 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Wed, 11 Nov 2020 13:29:55 +0000 (21:29 +0800)
The comment content can be useful for readers of both the log and code

Previously when dd command "records in/out" messages are not filtered
like now with get_image_dd, it's not clear that these messages are for
extracting boot sectors.  E.g.

Before

  == upgrade: Reading partition table from bootdisk...
  37+26 records in
  37+26 records out
  == upgrade: Reading partition table from image...

After

  == upgrade: Reading partition table from bootdisk...
  == upgrade: Extract boot sector from the image
  37+26 records in
  37+26 records out
  == upgrade: Reading partition table from image...

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
target/linux/x86/base-files/lib/upgrade/platform.sh

index 0b54caea29f22dc1cc07c093f95e170767679922..d8f2eba97ecbab9c18ddd82ba4a37a37485896f4 100644 (file)
@@ -19,7 +19,7 @@ platform_check_image() {
 
        get_partitions "/dev/$diskdev" bootdisk
 
-       #extract the boot sector from the image
+       v "Extract boot sector from the image"
        get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b
 
        get_partitions /tmp/image.bs image
@@ -82,7 +82,7 @@ platform_do_upgrade() {
        if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
                get_partitions "/dev/$diskdev" bootdisk
 
-               #extract the boot sector from the image
+               v "Extract boot sector from the image"
                get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b
 
                get_partitions /tmp/image.bs image
@@ -114,7 +114,6 @@ platform_do_upgrade() {
                fi
        done < /tmp/partmap.image
 
-       #copy partition uuid
        v "Writing new UUID to /dev/$diskdev..."
        get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
 
@@ -129,5 +128,4 @@ platform_do_upgrade() {
                sed -i "s/\(PARTUUID=\)[a-f0-9-]\+/\1$4$3$2$1-$6$5-$8$7-$9/ig" /mnt/boot/grub/grub.cfg
                umount /mnt
        fi
-
 }