PKGBUILDs/alarm/udev-automount/11-sd-cards-auto-mount.rules
2012-07-25 01:04:38 -04:00

13 lines
767 B
Plaintext

KERNEL!="mmcblk[0-9]p[0-9]", GOTO="sd_cards_auto_mount_end"
PROGRAM="/usr/bin/grep -q ' %M:%m /[^ ]* /' /proc/self/mountinfo", PROGRAM!="/usr/bin/grep -q ' %M:%m / /media/' /proc/self/mountinfo", GOTO="sd_cards_auto_mount_end"
# Global mount options
ACTION=="add", ENV{mount_options}="relatime"
# Filesystem specific options
ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p %N"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
ACTION=="add", RUN+="/bin/mkdir -p /media/sd-%k", RUN+="/bin/ln -s /media/sd-%k /mnt/sd-%k", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/sd-%k"
ACTION=="remove", RUN+="/bin/umount -l /media/sd-%k", RUN+="/bin/rmdir /media/sd-%k"
LABEL="sd_cards_auto_mount_end"