From 266e56674b0c0d51bf44db78f1cb23374031b00f Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Fri, 30 Aug 2013 21:21:57 -0400 Subject: [PATCH] Add SD card udev automount rule --- .../10-media-automount.rules} | 0 .../11-sd-card-automount.rules} | 19 +++++++++---------- .../{ => udev}/udev-create-persistent-net.sh | 0 stage2/pkg/udev | 8 ++++++-- 4 files changed, 15 insertions(+), 12 deletions(-) copy stage2/misc/{udev-media-automount.rules => udev/10-media-automount.rules} (100%) rename stage2/misc/{udev-media-automount.rules => udev/11-sd-card-automount.rules} (56%) rename stage2/misc/{ => udev}/udev-create-persistent-net.sh (100%) diff --git a/stage2/misc/udev-media-automount.rules b/stage2/misc/udev/10-media-automount.rules similarity index 100% copy from stage2/misc/udev-media-automount.rules copy to stage2/misc/udev/10-media-automount.rules diff --git a/stage2/misc/udev-media-automount.rules b/stage2/misc/udev/11-sd-card-automount.rules similarity index 56% rename from stage2/misc/udev-media-automount.rules rename to stage2/misc/udev/11-sd-card-automount.rules index 18c365f..de62336 100644 --- a/stage2/misc/udev-media-automount.rules +++ b/stage2/misc/udev/11-sd-card-automount.rules @@ -1,24 +1,23 @@ -# start at sdb to ignore the system hard drive -KERNEL!="sd[b-z]*", GOTO="my_media_automount_end" -ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="my_media_automount_end" + +KERNEL!="mmcblk[0-9]p[0-9]", GOTO="sd_cards_auto_mount_end" +ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="sd_cards_auto_mount_end" # import some useful filesystem info as variables IMPORT{program}="/sbin/blkid -o udev -p %N" # get the label if present, otherwise assign one based on device/partition ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}" -ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k" +ENV{ID_FS_LABEL}=="", ENV{dir_name}="sd-%k" # create the dir in /media ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'" -# global mount options +# Global mount options ACTION=="add", ENV{mount_options}="relatime" -# filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat) -ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111,utf8" +# 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" -# automount ntfs filesystems using ntfs-3g driver -ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k '/media/%E{dir_name}'" # automount all other filesystems ACTION=="add", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k '/media/%E{dir_name}'" @@ -26,4 +25,4 @@ ACTION=="add", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_opt ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'" # exit -LABEL="my_media_automount_end" +LABEL="sd_cards_auto_mount_end" diff --git a/stage2/misc/udev-create-persistent-net.sh b/stage2/misc/udev/udev-create-persistent-net.sh similarity index 100% rename from stage2/misc/udev-create-persistent-net.sh rename to stage2/misc/udev/udev-create-persistent-net.sh diff --git a/stage2/pkg/udev b/stage2/pkg/udev index 32c0c42..e1a3e24 100644 --- a/stage2/pkg/udev +++ b/stage2/pkg/udev @@ -16,8 +16,12 @@ hvconfig_pre() hvbuild_post() { - install -v -m755 ${SCRDIR}/misc/udev-create-persistent-net.sh /usr/local/bin - install -v -m644 ${SCRDIR}/misc/udev-media-automount.rules /etc/udev/rules.d/10-media-automount.rules + install -v -m755 ${SCRDIR}/misc/udev/udev-create-persistent-net.sh \ + /usr/local/bin + install -v -m644 ${SCRDIR}/misc/udev/10-media-automount.rules \ + /etc/udev/rules.d/ + install -v -m644 ${SCRDIR}/misc/udev/11-sd-card-automount.rules \ + /etc/udev/rules.d/ mv /lib/pkgconfig/{gudev-*.pc,libudev.pc} /usr/lib/pkgconfig rmdir /lib/pkgconfig -- 2.20.1