Skip to content

Commit

Permalink
Keep empty line in armbianEnv.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
hzyitc committed Aug 15, 2022
1 parent 96dade2 commit 6d40a78
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,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
Expand All @@ -390,8 +384,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
Expand Down

0 comments on commit 6d40a78

Please sign in to comment.