linkpi_firmware_history/rootfs/link/shell/fusb.sh

34 lines
674 B
Bash

umount_usb(){
mnt=`df -h | grep /root/usb | wc -l`
count=0
while [ $mnt -gt 0 -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
if [ -b /dev/sda1 ];then
echo -e "\ny" | mkfs.ext4 -T largefile /dev/sda1
sleep 1
mount -t ext4 /dev/sda1 /root/usb
elif [ -b /dev/mmcblk0p6 ];then
echo -e "\ny" | mkfs.ext4 -T largefile /dev/mmcblk0p6
sleep 1
mount -o rw,sync,barrier=0 /dev/mmcblk0p6 /root/usb
fi
else
mkfs.vfat -F 32 /dev/sda1
sleep 1
mount -t vfat /dev/sda1 /root/usb
fi