[SCM] debian-live/config-webc branch, master, updated. 9e2a9d737420800b22f6c7279a629faf86216d76

Kai Hendry hendry at iki.fi
Sun Nov 27 14:51:22 UTC 2011


The following commit has been merged in the master branch:
commit 9e2a9d737420800b22f6c7279a629faf86216d76
Author: Kai Hendry <hendry at iki.fi>
Date:   Sun Nov 27 15:50:33 2011 +0100

    Automount USB sticks for main use case of uploading pictures. Pondering on how bad this is for security.

diff --git a/webconverger/config/includes.chroot/etc/udev/rules.d/11-media-by-label-auto-mount.rules b/webconverger/config/includes.chroot/etc/udev/rules.d/11-media-by-label-auto-mount.rules
new file mode 100644
index 0000000..2b6d30d
--- /dev/null
+++ b/webconverger/config/includes.chroot/etc/udev/rules.d/11-media-by-label-auto-mount.rules
@@ -0,0 +1,23 @@
+ENV{mount_options}="relatime"
+KERNEL!="sd[a-z][0-9]", GOTO="media_by_label_auto_mount_end"
+
+# Import FS infos
+IMPORT{program}="/sbin/blkid -o udev -p %N"
+
+# Get a label if present, otherwise specify one
+ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
+ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
+
+# Global mount options
+ACTION=="add", ENV{mount_options}="relatime"
+# Filesystem-specific mount options
+ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},utf8,gid=100,umask=002"
+
+# Mount the device
+ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
+
+# Clean up after removal
+ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
+
+# Exit
+LABEL="media_by_label_auto_mount_end"
diff --git a/webconverger/config/includes.chroot/etc/udev/rules.d/11-sd-cards-auto-mount.rules b/webconverger/config/includes.chroot/etc/udev/rules.d/11-sd-cards-auto-mount.rules
new file mode 100644
index 0000000..61dc69b
--- /dev/null
+++ b/webconverger/config/includes.chroot/etc/udev/rules.d/11-sd-cards-auto-mount.rules
@@ -0,0 +1,11 @@
+KERNEL!="mmcblk[0-9]p[0-9]", 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"

-- 
debian-live/config-webc



More information about the debian-live-changes mailing list