dxwwym
V2EX  ›  CentOS

centos7,命令行下无法使用 udev 脚本自动挂载 u 盘,脚本如下

  •  
  •   dxwwym · Oct 3, 2016 via iPhone · 5217 views
    This topic created in 3514 days ago, the information mentioned may be changed or developed.
    KERNEL!="sd*", GOTO="media_by_label_auto_mount_end"
    SUBSYSTEM!="block",GOTO="media_by_label_auto_mount_end"
    IMPORT{program}="/sbin/blkid -o udev -p %N"
    ENV{ID_FS_TYPE}=="", GOTO="media_by_label_auto_mount_end"
    ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
    ENV{ID_FS_LABEL}=="", ENV{dir_name}="Untitled-%k"
    ACTION=="add", ENV{mount_options}="relatime,sync"
    ACTION=="add", ENV{ID_FS_TYPE}=="vfat", ENV{mount_options}="iocharset=utf8,umask=000"
    ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", ENV{mount_options}="iocharset=utf8,umask=000"
    ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
    ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
    LABEL="media_by_label_auto_mount_end"
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3499 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 05:02 · PVG 13:02 · LAX 22:02 · JFK 01:02
    ♥ Do have faith in what you're doing.