mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-25 22:18:07 +00:00
Add UAS prevention for rockpi4
This commit is contained in:
parent
a5e9a4e120
commit
3d3c8b9fa0
|
@ -25,12 +25,13 @@ else
|
||||||
echo "UAS FOUND"
|
echo "UAS FOUND"
|
||||||
USBINFO=$(lsusb | grep "SATA 6Gb/s bridge")
|
USBINFO=$(lsusb | grep "SATA 6Gb/s bridge")
|
||||||
DEVID=$(egrep -o '[0-9a-f]+:[0-9a-f]+' <<< $USBINFO)
|
DEVID=$(egrep -o '[0-9a-f]+:[0-9a-f]+' <<< $USBINFO)
|
||||||
|
QUIRK="${DEVID}:u"
|
||||||
echo "UAS IN USE ON $DEVID"
|
echo "UAS IN USE ON $DEVID"
|
||||||
|
|
||||||
|
# Raspberry Pi
|
||||||
if [ $IS_RASPI -eq 1 ]; then
|
if [ $IS_RASPI -eq 1 ]; then
|
||||||
echo "IS RASPBERRY PI"
|
echo "IS RASPBERRY PI"
|
||||||
if [ -f /boot/cmdline.txt ]; then
|
if [ -f /boot/cmdline.txt ]; then
|
||||||
QUIRK="${DEVID}:u"
|
|
||||||
CMDLINE=$(head -n 1 /boot/cmdline.txt)
|
CMDLINE=$(head -n 1 /boot/cmdline.txt)
|
||||||
cat /boot/cmdline.txt | grep "usb-storage.quirks"
|
cat /boot/cmdline.txt | grep "usb-storage.quirks"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
@ -55,6 +56,26 @@ else
|
||||||
/usr/bin/mynode-reboot
|
/usr/bin/mynode-reboot
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# RockPi 4
|
||||||
|
if [ $IS_ROCKPI4 -eq 1 ]; then
|
||||||
|
echo "IS ROCKPI 4"
|
||||||
|
if [ -f /boot/armbianEnv.txt ]; then
|
||||||
|
cat /boot/armbianEnv.txt | grep "${QUIRK}"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
# Quirk already added, exit 0
|
||||||
|
echo "QUIRK ALREADY EXISTS, EXITING"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "ADDING QUIRK AND REBOOTING"
|
||||||
|
sed -i "s/usbstoragequirks=.*/&,${QUIRK}/g" cat /boot/armbianEnv.txt
|
||||||
|
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
|
||||||
|
sync
|
||||||
|
sleep 5s
|
||||||
|
/usr/bin/mynode-reboot
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "No UAS devices found"
|
echo "No UAS devices found"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user