Guest User

Untitled

a guest
Jan 22nd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. # /etc/udev/rules.d/11-media-by-label-auto-mount.rules
  2.  
  3. KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
  4.  
  5. # Import FS infos
  6. IMPORT{program}="/sbin/blkid -o udev -p %N"
  7.  
  8. # Get a label if present, otherwise specify one
  9. ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
  10. ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
  11.  
  12. # Global mount options
  13. ACTION=="add", ENV{mount_options}="relatime"
  14. # Filesystem-specific mount options
  15. ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
  16.  
  17. # Mount the device
  18. ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
  19.  
  20. # Clean up after removal
  21. ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
  22.  
  23. # Exit
  24. LABEL="media_by_label_auto_mount_end"
Add Comment
Please, Sign In to add comment