|
我要实现U盘自动挂载功能,在网上查找资料发现可以在openwrt中/etc/hotplug.d/block/10-mount这个文件中写如下代码即可
- #!/bin/sh
- case "$ACTION" in
- add)
- for i in $(ls /dev/ | grep 'sd[a-z][1-9]')
- do
- mkdir -p /mnt/$i
- mount -o iocharset=utf8,rw /dev/$i /mnt/$i
- if [ "$?" -ne 0 ];then
- mount -o rw /dev/$i /mnt/$i
- fi
- done
- ;;
- remove)
- MOUNT=`mount | grep -o '/mnt/sd[a-z][1-9]'`
- for i in $MOUNT
- do
- umount $i
-
- done
- ;;
- esac
复制代码
openwrt中/etc/hotplug.d/block/10-mount这个文件中原来的代码如下:
现在我想将这个脚本添加到源码中编译出固件,但是openwrt源码中openwrt/package/base-files/files/etc/hotplug.d/下只有一个net/00-sysctl文件,里面内容如下,我要在什么地方添加我前面的脚本代码,编译出固件以后在/etc/hotplug.d/block/10-mount下才能看到我的脚本代码??- #!/bin/sh
- if [ -f /etc/sysctl.conf ] && [ "$ACTION" = add ]; then
- sed -ne "/^[[:space:]]*net\..*\.$DEVICENAME\./p" /etc/sysctl.conf | \
- sysctl -e -p - | logger -t sysctl
- fi
复制代码
|
|