fix script
This commit is contained in:
parent
b09a6db9da
commit
afdb474640
29
package/lean/automount/files/15-automount
Executable file
29
package/lean/automount/files/15-automount
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
# 0 yes blockdevice handles this - 1 no it is not there
|
||||
|
||||
(ls /etc/uci-defaults £ü grep fstab > /dev/null 2>&1) && sleep 10
|
||||
|
||||
blkdev=`dirname $DEVPATH`
|
||||
basename=`basename $blkdev`
|
||||
device=`basename $DEVPATH`
|
||||
skip=`block info | sed 's/\(.*\): .*/\1/' | grep -q $device ; echo $?`
|
||||
path=$DEVPATH
|
||||
|
||||
if [ $basename != "block" ] && [ -z "${device##sd*}" ] && [ $skip -eq 1 ]; then
|
||||
mntpnt=$device
|
||||
case "$ACTION" in
|
||||
add)
|
||||
mkdir -p /mnt/$mntpnt
|
||||
# Try to be gentle on solid state devices
|
||||
mount -o rw,noatime,discard /dev/$device /mnt/$mntpnt
|
||||
;;
|
||||
remove)
|
||||
# Once the device is removed, the /dev entry disappear. We need mountpoint
|
||||
mountpoint=`mount |grep /dev/$device | sed 's/.* on \(.*\) type.*/\1/'`
|
||||
umount -l $mountpoint
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
Loading…
Reference in New Issue
Block a user