From 8b925767fbacf85f2ea4e9aa2556ebb136a2edb7 Mon Sep 17 00:00:00 2001 From: hzy Date: Tue, 16 Aug 2022 00:47:57 +0800 Subject: [PATCH] Keep empty line in armbianEnv.txt --- .../usr/lib/armbian/armbian-hardware-optimization | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization b/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization index 1ad3fff937b2..d0eea1295a5c 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization +++ b/packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization @@ -390,14 +390,6 @@ add_usb_storage_quirks() { # check for /boot/armbianEnv.txt existence [ -f /boot/armbianEnv.txt ] || return - # cleanup. add LF. This prevents adding parameters to the same line - echo "" >> /boot/armbianEnv.txt - sed -i '/^$/d;$G' /boot/armbianEnv.txt - sed -i '/^$/d;$G' /boot/armbianEnv.txt - - # cleanup. remove empty lines in the middle - sed -i '/^$/d' /boot/armbianEnv.txt - # preserve old contents if existent TMPFILE=$(mktemp /tmp/${0##*/}.XXXXXX) trap "sleep 1 ; rm \"${TMPFILE}\" ; exit 0" 0 1 2 3 15 @@ -417,8 +409,7 @@ add_usb_storage_quirks() { done read USBQUIRKS < ${TMPFILE} - sed -i '/^usbstoragequirks/d' /boot/armbianEnv.txt - echo "usbstoragequirks=${USBQUIRKS}" >> /boot/armbianEnv.txt + sed -i "s/^usbstoragequirks=.*/usbstoragequirks=${USBQUIRKS}/" /boot/armbianEnv.txt sync & if [ -f /sys/module/usb_storage/parameters/quirks ]; then echo ${USBQUIRKS} > /sys/module/usb_storage/parameters/quirks