linkpi_firmware_history/rootfs/link/shell/fusb.sh

28 lines
490 B
Bash
Raw Normal View History

2024-02-15 22:07:30 +01:00
umount_usb(){
mnt=`df -h | grep /root/usb | wc -l`
count=0
while [ $mnt -eq 1 -a $count -le 5 ]
do
umount -f /root/usb/
mnt=`df -h | grep /root/usb | wc -l`
count=`expr $count + 1`
sleep 1
if [ $count -ge 5 ];then
exit
fi
done
}
umount_usb
if [ $1 == "ext4" ];then
echo -e "\ny" | mkfs.ext4 -T largefile /dev/sda1
sleep 1
mount -t ext4 /dev/sda1 /root/usb
else
mkfs.vfat -F 32 /dev/sda1
sleep 1
mount -t vfat /dev/sda1 /root/usb
fi