Last active
February 9, 2017 18:09
-
-
Save un1versal/feb3c0de56c4c8fd9eea to your computer and use it in GitHub Desktop.
Boot time increases 3x but it mounts by label. a worthy note is the user that owns it is a large string of numbers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rule automount on add|change|remove cd/dvd | |
ACTION!="add|change|remove", GOTO="cdrom_end" | |
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="cdrom_end" | |
# Get label | |
PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c" | |
# Use basename to correctly handle labels such as ../mnt/foo | |
PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c" | |
ENV{dir_name}=="", ENV{dir_name}="usbhd-%k" | |
# Define Device and attributes. | |
SUBSYSTEM=="block", KERNEL=="sr*", ENV{ID_PATH}=="pci-0000:00:0b.0-scsi-1:0:0:0", ATTRS{type}=="5", ATTR{removable}=="1", ATTR{events}=="media_change eject_request" | |
# Mount on device attached from cold boot and at device change | |
ACTION=="add",KERNEL=="sr*", RUN+="/bin/mkdir -p '/media/%E{dir_name}'" | |
ACTION=="add",KERNEL=="sr*", RUN+="/bin/mount /dev/sr0 '/media/%E{dir_name}'" | |
ACTION=="change",KERNEL=="sr*", RUN+="/bin/mkdir -p '/media/%E{dir_name}'" | |
ACTION=="change",KERNEL=="sr*", RUN+="/bin/mount /dev/sr0 '/media/%E{dir_name}'" | |
# On remove unmount and remove directories | |
ACTION=="change",KERNEL=="sr*", RUN+="/bin/rmdir '/media/%E{dir_name}'" | |
ACTION=="remove",KERNEL=="sr*", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'" | |
LABEL="cdrom_end" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment