海思通过udev实现自动挂载U盘和SD卡

(来自网络并修改验证)

vi /etc/udev/rules.d/10-my-dev.rules

按“i”进入编辑模式,修改完后按“ESC键”并输入“wq”保存退出

ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /mnt/%k"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount /dev/%k /mnt/%k"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/ntfs-3g /dev/%k /mnt/%k", OPTI

ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/sync"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /mnt/%k"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rm -rf /mnt/%k", OPTI

ACTION=="add", KERNEL=="mmcblk[0-9]p[0-9]", RUN+="/bin/mkdir -p /mnt/%k"
ACTION=="add", KERNEL=="mmcblk[0-9]p[0-9]", RUN+="/bin/mount /dev/%k /mnt/%k"
ACTION=="add", KERNEL=="mmcblk[0-9]p[0-9]", RUN+="/bin/ntfs-3g /dev/%k /mnt/%k", OPTI

ACTION=="remove", KERNEL=="mmcblk[0-9]p[0-9]", RUN+="/bin/sync"
ACTION=="remove", KERNEL=="mmcblk[0-9]p[0-9]", RUN+="/bin/umount -l /mnt/%k"
ACTION=="remove", KERNEL=="mmcblk[0-9]p[0-9]", RUN+="/bin/rm -rf /mnt/%k", OPTI

 

你可能感兴趣的:(海思开发)