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 Nov 18, 2022
1 parent c3db31b commit 8b92576
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8b92576

Please sign in to comment.