68 lines
1.6 KiB
Bash
68 lines
1.6 KiB
Bash
#!/bin/sh /etc/rc.common
|
|
. /lib/functions.sh
|
|
|
|
log() {
|
|
logger -t "20-mount" "$@"
|
|
}
|
|
|
|
blkdev=`dirname $DEVPATH`
|
|
if [ `basename $blkdev` != "block" ]; then
|
|
device=`basename $DEVPATH`
|
|
if echo $device | grep -q "mtdblock"; then
|
|
exit 0
|
|
fi
|
|
if [ -e /etc/sda_drop ]; then
|
|
source /etc/sda_drop
|
|
if echo $device | grep -q "$SDA"; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
if [ ! -e /usr/lib/sdcard/sdcard.sh ]; then
|
|
/usr/lib/sdcard/sdcard.sh detect
|
|
source /tmp/detect.file
|
|
if [ $detect = "1" ]; then
|
|
if echo $device | grep -q "mmcblk"; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
fi
|
|
if echo $device | grep -q "mmcblk"; then
|
|
device1="SDCard"${device:8:2}
|
|
else
|
|
device1=$device
|
|
fi
|
|
|
|
case "$ACTION" in
|
|
add)
|
|
mkdir -p /mnt/$device1
|
|
# vfat & ntfs-3g check
|
|
if [ `which fdisk` ]; then
|
|
isntfs=`fdisk -l | grep $device | grep NTFS`
|
|
isvfat=`fdisk -l | grep $device | grep FAT`
|
|
isfuse=`lsmod | grep fuse`
|
|
isntfs3g=`which ntfs-3g`
|
|
else
|
|
isntfs=""
|
|
isvfat=""
|
|
fi
|
|
# mount with ntfs-3g if possible, else with default mount
|
|
if [ "$isntfs" -a "$isfuse" -a "$isntfs3g" ]; then
|
|
ntfs-3g -o nls=utf8 /dev/$device /mnt/$device1
|
|
log "Mount /mnt/$device as NTFS"
|
|
elif [ "$isvfat" ]; then
|
|
mount -o rw,sync,umask=002,codepage=437,iocharset=iso8859-1 /dev/$device /mnt/$device1
|
|
log "Mount /mnt/$device as FAT"
|
|
else
|
|
mount -o rw,sync /dev/$device /mnt/$device1
|
|
log "Mount /mnt/$device as other"
|
|
fi
|
|
|
|
chmod 777 /mnt/$device1
|
|
chown nobody /mnt/$device1
|
|
|
|
if [ -e /usr/lib/sdcard/sdcard.sh ]; then
|
|
/usr/lib/sdcard/sdcard.sh add
|
|
fi
|
|
;;
|
|
esac
|
|
fi |