Patchwork [1/2] udev-extraconf: allow users in disk group to write vfat filesystem

login
register
mail settings
Submitter Hongxu Jia
Date July 16, 2013, 7:33 a.m.
Message ID <2701823185a01c8b6e652ae6c28ba43ca2fb89db.1373954600.git.hongxu.jia@windriver.com>
Download mbox | patch
Permalink /patch/53751/
State Accepted
Commit eeed0cebebc945bf62b29336b9df8e2c0a975538
Headers show

Comments

Hongxu Jia - July 16, 2013, 7:33 a.m.
If filesystem type is vfat, change the ownership group to 'disk', and grant it
with  w/r/x permissions.

The user which belongs to 'disk' group could write the storage.

[YOCTO #4004]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/recipes-core/udev/udev-extraconf/mount.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d1419ed..327cfc6 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -27,6 +27,17 @@  automount() {
 		MOUNT="$MOUNT -o silent"
 	fi
 	
+	# If filesystem type is vfat, change the ownership group to 'disk', and
+	# grant it with  w/r/x permissions.
+	case $ID_FS_TYPE in
+	vfat|fat)
+		MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`"
+		;;
+	# TODO
+	*)
+		;;
+	esac
+
 	if ! $MOUNT -t auto $DEVNAME "/media/$name"
 	then
 		#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!"