mbox series

[00/10] sysupgrade: reword and organize log lines

Message ID 20201103122107.30400-1-yszhou4tech@gmail.com
Headers show
Series sysupgrade: reword and organize log lines | expand

Message

Yousong Zhou Nov. 3, 2020, 12:20 p.m. UTC
The series mainly aims to make sysupgrade log output more organized and
less disturbing, in the following aspects

 - Hide "write error: Broken pipe" from cat command and its friends.
 - Make log lines from sysupgrade command itself more distinguishable
   more other commands by using common.sh function "v"

The series should at least partially address concerns raised at FS#3140

Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140

Before

  root@(none):/# sysupgrade -n -v /tmp/x86.gz
  Image metadata not found
  Reading partition table from bootdisk...
  zcat: write error: Broken pipe
  zcat: write: Broken pipe
  Reading partition table from image...
  Commencing upgrade. Closing all shell sessions.
  killall: telnetd: no process killed
  Sending TERM to remaining processes ... ubusd askfirst urngd logd netifd odhcpd ntpd dnsmasq
  Sending KILL to remaining processes ...
  Switching to ramdisk...
  Performing system upgrade...
  Reading partition table from bootdisk...
  0+63 records in
  0+63 records out
  zcat: write error: Broken pipe
  zcat: write: Broken pipe
  Reading partition table from image...
  Writing image to /dev/vda1...
  zcat: write error: Broken pipe
  zcat: write: Broken pipe
  32767+0 records in
  15+1 records out
  Writing image to /dev/vda2...
  212991+0 records in
  103+1 records out
  Writing new UUID to /dev/vda...
  4+0 records in
  4+0 records out
  zcat: write error: Broken pipe
  zcat: write: Broken pipe
  [   31.461949] F2FS-fs (vda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
  [   31.470274] F2FS-fs (vda1): Can't find valid F2FS filesystem in 1th superblock
  [   31.480216] F2FS-fs (vda1): Magic Mismatch, valid(0xf2f52010) - read(0x6020601)
  [   31.491775] F2FS-fs (vda1): Can't find valid F2FS filesystem in 2th superblock
  Upgrading bootloader on /dev/vda...
  Upgrade completed
  Rebooting system...
  umount: can't unmount /dev: Resource busy
  umount: can't unmount /tmp: Resource busy
  [   38.511806] Unregister pv shared memory for cpu 0
  [   38.519259] reboot: Restarting system
  [   38.523725] reboot: machine restart

After

  root@OpenWrt:/# sysupgrade -n -v /tmp/x86.gz
  == upgrade: Image metadata not present
  == upgrade: Reading partition table from bootdisk...
  == upgrade: Extract boot sector from the image
  54+9 records in
  54+9 records out
  == upgrade: Reading partition table from image...
  == upgrade: Commencing upgrade. Closing all shell sessions.
  killall: telnetd: no process killed
  Sending TERM to remaining processes ... ubusd askfirst urngd logd netifd odhcpd xl2tpd ntpd dnsmasq
  Sending KILL to remaining processes ...
  == upgrade: Switching to ramdisk...
  == upgrade: Performing system upgrade...
  == upgrade: Reading partition table from bootdisk...
  == upgrade: Extract boot sector from the image
  0+63 records in
  0+63 records out
  == upgrade: Reading partition table from image...
  == upgrade: Writing image to /dev/vda1...
  65535+0 records in
  31+1 records out
  == upgrade: Writing image to /dev/vda2...
  262143+0 records in
  127+1 records out
  == upgrade: Writing new UUID to /dev/vda...
  4+0 records in
  4+0 records out
  [   98.737664] F2FS-fs (vda1): Magic Mismatch, valid(0xf2f52010) - read(0x0)
  [   98.747115] F2FS-fs (vda1): Can't find valid F2FS filesystem in 1th superblock
  [   98.757250] F2FS-fs (vda1): Magic Mismatch, valid(0xf2f52010) - read(0x6020601)
  [   98.770807] F2FS-fs (vda1): Can't find valid F2FS filesystem in 2th superblock
  == upgrade: Upgrading bootloader on /dev/vda...
  == upgrade: Upgrade completed
  == upgrade: Rebooting system...
  umount: can't unmount /dev: Resource busy
  umount: can't unmount /tmp: Resource busy
  [  106.922638] Unregister pv shared memory for cpu 0
  [  106.931062] reboot: Restarting system
  [  106.936009] reboot: machine restart

Yousong Zhou (10):
  base-files: upgrade: log with prefix
  base-files: upgrade: use stdin redirection to replace cat command
  base-files: upgrade: add get_image_dd()
  base-files: upgrade: fwtool.sh: use v for log lines
  base-files: upgrade: fwtool.sh: rewording logs
  base-files: upgrade: stage2: rework log lines
  base-files: bump PKG_RELEASE
  x86: upgrade: use v function for writting logs
  x86: upgrade: use get_image_dd
  x86: upgrade: make code comment appear as log lines

 package/base-files/Makefile                   |  2 +-
 .../base-files/files/lib/upgrade/common.sh    | 10 ++++--
 .../base-files/files/lib/upgrade/fwtool.sh    | 24 +++++++-------
 package/base-files/files/lib/upgrade/stage2   | 10 +++---
 .../x86/base-files/lib/upgrade/platform.sh    | 32 +++++++++----------
 5 files changed, 41 insertions(+), 37 deletions(-)