#/bin/bash
[ $# == 0 ] && echo "Usage: $0 {H,F}" && exit 7
# 1.create mount directory
# 2.mount the given flash disk, hard disk, U disk and so on. Belong to Storage Media.
#mount HarDisk or flashDisk
WHERE_TO_MOUNT=${HOME}//NTFS_HARD_DISK/
WHERE_TO_MOUNT18I=${HOME}/NTFS_HARD_DISK18I/
#Auto Find the location of Media.
LOC=`sudo fdisk -l | tail -n 1 | cut -d " " -f 1`
echo $LOC
# mkdir ${WHERE_TO_MOUNT}
#use ‘sudo fdisk -l‘ find the location of the Storage Media. Then we can mount it.
#H: HarDisk
#F: flashDisk
if [ $1 == "H" ]; then
#sudo mount -t ntfs /dev/sdb2 ${WHERE_TO_MOUNT} -o gid=${USER},uid=${USER},umask=022
sudo mount -t ntfs $LOC ${WHERE_TO_MOUNT} -o gid=${USER},uid=${USER},umask=022
elif [ $1 == "F" ]; then
#sudo mount /dev/sdb1 ${WHERE_TO_MOUNT} -o gid=${USER},uid=${USER},umask=022
sudo mount $LOC ${WHERE_TO_MOUNT} -o iocharset=utf8,gid=${USER},uid=${USER},umask=022
elif [ $1 == "G" ]; then
#sudo mount /dev/sdb1 ${WHERE_TO_MOUNT} -o gid=${USER},uid=${USER},umask=022
#sudo mount /dev/sdb1 ${WHERE_TO_MOUNT18I} -o iocharset=utf8,gid=${USER},uid=${USER},umask=022
sudo mount /dev/sdc1 ${WHERE_TO_MOUNT18I} -o iocharset=utf8,gid=${USER},uid=${USER},umask=022
#sudo mount /dev/sdb1 ${WHERE_TO_MOUNT} -o iocharset=utf8,gid=${USER},uid=${USER},umask=022
else
echo "What are you going to do..?"
fi
# Noter: 20130321 by N
# write ‘sudo‘ in text, when execute, just do ‘./xx.sh‘
# no ‘sudo‘ inside, when execute, do ‘sudo ./xx.sh‘
#The Format of this Scritps: [07072013]
# -> sudo inside scripts, do ‘./mntXXX {H,F}‘
# -> sudo not inside scripts, do ‘sudo ./mntXXX {H,F}‘