summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2025-01-10 09:00:55 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-01-14 11:57:52 +0000
commit58bbcc3de42dff4e1c4edf6bf3f0f128050be8a2 (patch)
tree3efd836cf8adfcffd180933040ea7bccb27ffb7a
parent15ebdb6fcc321aa4980d70e291fd34c1e57ea936 (diff)
downloadpoky-58bbcc3de42dff4e1c4edf6bf3f0f128050be8a2.tar.gz
udev-extraconf: Allow FAT mount group to be specified
Adds a variable that allows the group given permissions to access FAT mounted file systems to be specified, instead of being hardcoded to 'disk'. As a note, the usage of 'disk' as the mount group is not a very secure default, since the disk user usually has read/write access to all block devices in /dev/, meaning that adding a user to this group for the purpose of accessing FAT file systems effectively gives the write access to all block devices. (From OE-Core rev: c723dbc329d4cf2a75022f8dd1cfa304383bb4f5) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.sh8
-rw-r--r--meta/recipes-core/udev/udev-extraconf_1.1.bb9
2 files changed, 10 insertions, 7 deletions
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh
index eb84a468be..0cbae48729 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -83,11 +83,11 @@ automount_systemd() {
83 83
84 MOUNT="$MOUNT -o silent" 84 MOUNT="$MOUNT -o silent"
85 85
86 # If filesystemtype is vfat, change the ownership group to 'disk', and 86 # If filesystemtype is vfat, change the ownership group to mount group, and
87 # grant it with w/r/x permissions. 87 # grant it with w/r/x permissions.
88 case $ID_FS_TYPE in 88 case $ID_FS_TYPE in
89 vfat|fat) 89 vfat|fat)
90 MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`" 90 MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^@MOUNT_GROUP@:/{print $3}' /etc/group`"
91 ;; 91 ;;
92 swap) 92 swap)
93 return ;; 93 return ;;
@@ -138,11 +138,11 @@ automount() {
138 MOUNT="$MOUNT -o silent" 138 MOUNT="$MOUNT -o silent"
139 fi 139 fi
140 140
141 # If filesystem type is vfat, change the ownership group to 'disk', and 141 # If filesystem type is vfat, change the ownership group to mount group, and
142 # grant it with w/r/x permissions. 142 # grant it with w/r/x permissions.
143 case $ID_FS_TYPE in 143 case $ID_FS_TYPE in
144 vfat|fat) 144 vfat|fat)
145 MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' /etc/group`" 145 MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^@MOUNT_GROUP@:/{print $3}' /etc/group`"
146 ;; 146 ;;
147 swap) 147 swap)
148 return ;; 148 return ;;
diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb
index 0e2abcd424..0d7e4f4f36 100644
--- a/meta/recipes-core/udev/udev-extraconf_1.1.bb
+++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb
@@ -17,6 +17,7 @@ S = "${WORKDIR}/sources"
17UNPACKDIR = "${S}" 17UNPACKDIR = "${S}"
18 18
19MOUNT_BASE = "/run/media" 19MOUNT_BASE = "/run/media"
20MOUNT_GROUP ?= "disk"
20 21
21do_install() { 22do_install() {
22 install -d ${D}${sysconfdir}/udev/rules.d 23 install -d ${D}${sysconfdir}/udev/rules.d
@@ -31,9 +32,11 @@ do_install() {
31 install -d ${D}${sysconfdir}/udev/scripts/ 32 install -d ${D}${sysconfdir}/udev/scripts/
32 33
33 install -m 0755 ${S}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh 34 install -m 0755 ${S}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh
34 sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh 35 sed -e 's|@systemd_unitdir@|${systemd_unitdir}|g' \
35 sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh 36 -e 's|@base_sbindir@|${base_sbindir}|g' \
36 sed -i 's|@MOUNT_BASE@|${MOUNT_BASE}|g' ${D}${sysconfdir}/udev/scripts/mount.sh 37 -e 's|@MOUNT_BASE@|${MOUNT_BASE}|g' \
38 -e 's|@MOUNT_GROUP@|${MOUNT_GROUP}|g' \
39 -i ${D}${sysconfdir}/udev/scripts/mount.sh
37 40
38 install -m 0755 ${S}/network.sh ${D}${sysconfdir}/udev/scripts 41 install -m 0755 ${S}/network.sh ${D}${sysconfdir}/udev/scripts
39} 42}