From d271db564293577decf87478ad6e1082b1f66c07 Mon Sep 17 00:00:00 2001 From: John Doe Date: Fri, 17 Sep 2021 15:19:55 +0800 Subject: [PATCH] build: fix firmware version output for r1s --- scripts/patches.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/patches.sh b/scripts/patches.sh index eb0e2a1..1d408e6 100644 --- a/scripts/patches.sh +++ b/scripts/patches.sh @@ -66,28 +66,28 @@ if [ $DEVICE != 'r1s' ]; then sed -i '/arm\/cpuinfo/a\\t$(INSTALL_DIR) $(1)/www/luci-static/resources/view/status/include' $mf_autcore sed -i '/arm\/cpuinfo/a\\t$(INSTALL_BIN) ./files/x86/ethinfo $(1)/sbin/ethinfo' $mf_autcore - # inject the firmware version - strDate=`TZ=UTC-8 date +%Y-%m-%d` - status_pages=`find package/ -follow -type f \( -path '*/autocore/files/arm/index.htm' -o -path '*/autocore/files/x86/index.htm' -o -path '*/autocore/files/arm/rpcd_10_system.js' -o -path '*/autocore/files/x86/rpcd_10_system.js' \)` - for status_page in $status_pages; do - case $status_page in - *htm) - line_number_FV=`grep -n 'Firmware Version' $status_page | cut -d: -f 1` - sed -i '/ver\./d' $status_page - sed -i $line_number_FV' a klever1988/nanopi-openwrt '$strDate $status_page - ;; - *js) - line_number_FV=`grep -m1 -n 'corelink' $status_page | cut -d: -f1` - sed -i $line_number_FV' i var pfv = document.createElement('\''placeholder'\'');pfv.innerHTML = '\''klever1988/nanopi-openwrt '$strDate"';" $status_page - line_number_FV=`grep -n 'Firmware Version' $status_page | cut -d : -f 1` - sed -i '/Firmware Version/d' $status_page - sed -i $line_number_FV' a _('\''Firmware Version'\''), pfv,' $status_page - ;; - esac - done - fi +# inject the firmware version +strDate=`TZ=UTC-8 date +%Y-%m-%d` +status_pages=`find package/ -follow -type f \( -path '*/autocore/files/arm/index.htm' -o -path '*/autocore/files/x86/index.htm' -o -path '*/autocore/files/arm/rpcd_10_system.js' -o -path '*/autocore/files/x86/rpcd_10_system.js' \)` +for status_page in $status_pages; do +case $status_page in + *htm) + line_number_FV=`grep -n 'Firmware Version' $status_page | cut -d: -f 1` + sed -i '/ver\./d' $status_page + sed -i $line_number_FV' a klever1988/nanopi-openwrt '$strDate $status_page + ;; + *js) + line_number_FV=`grep -m1 -n 'corelink' $status_page | cut -d: -f1` + sed -i $line_number_FV' i var pfv = document.createElement('\''placeholder'\'');pfv.innerHTML = '\''klever1988/nanopi-openwrt '$strDate"';" $status_page + line_number_FV=`grep -n 'Firmware Version' $status_page | cut -d : -f 1` + sed -i '/Firmware Version/d' $status_page + sed -i $line_number_FV' a _('\''Firmware Version'\''), pfv,' $status_page + ;; +esac +done + # little optimization argon css css_file=`find package/ -follow -type f -path '*/argon/css/cascade.css'` line_number_h6=`grep -m1 -n 'h6 {' $css_file | cut -d: -f1`