28 lines
490 B
Bash
28 lines
490 B
Bash
|
|
||
|
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
|
||
|
|