diff options
author | Ming Liu <liu.ming50@gmail.com> | 2022-07-17 14:56:41 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-07-25 15:11:46 +0100 |
commit | 88bc9d2b93de490d33f23244dca1e8ae7db7fb44 (patch) | |
tree | 393e1343f7c2118c6c00697f66a987ae441a4787 /meta/recipes-core | |
parent | f884ab8ffcb3b4ab7e19b6fa70f5838fa29bf591 (diff) | |
download | poky-88bc9d2b93de490d33f23244dca1e8ae7db7fb44.tar.gz |
udev-extraconf: let automount base directory configurable
Dont hard-code automount base directory to '/run/media', introduce a
variable MOUNT_BASE to let it configurable, like in udisks2 the mount
base is also configurable by setting option: --enable-fhs-media.
(From OE-Core rev: c021f5592c3d920eda1bfc10c099ad1484e9c0ce)
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit f077befd5f36ad88623aaf6a38b1a837ecb18650)
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/udev/udev-extraconf/mount.sh | 25 | ||||
-rw-r--r-- | meta/recipes-core/udev/udev-extraconf_1.1.bb | 2 |
2 files changed, 15 insertions, 12 deletions
diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh b/meta/recipes-core/udev/udev-extraconf/mount.sh index 5ba66e98e2..c8b773bc07 100644 --- a/meta/recipes-core/udev/udev-extraconf/mount.sh +++ b/meta/recipes-core/udev/udev-extraconf/mount.sh | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | BASE_INIT="`readlink -f "@base_sbindir@/init"`" | 7 | BASE_INIT="`readlink -f "@base_sbindir@/init"`" |
8 | INIT_SYSTEMD="@systemd_unitdir@/systemd" | 8 | INIT_SYSTEMD="@systemd_unitdir@/systemd" |
9 | MOUNT_BASE="@MOUNT_BASE@" | ||
9 | 10 | ||
10 | if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then | 11 | if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then |
11 | # systemd as init uses systemd-mount to mount block devices | 12 | # systemd as init uses systemd-mount to mount block devices |
@@ -40,7 +41,7 @@ automount_systemd() { | |||
40 | 41 | ||
41 | # Skip already mounted partitions | 42 | # Skip already mounted partitions |
42 | if [ -f /run/systemd/transient/run-media-$name.mount ]; then | 43 | if [ -f /run/systemd/transient/run-media-$name.mount ]; then |
43 | logger "mount.sh/automount" "/run/media/$name already mounted" | 44 | logger "mount.sh/automount" "$MOUNT_BASE/$name already mounted" |
44 | return | 45 | return |
45 | fi | 46 | fi |
46 | 47 | ||
@@ -53,7 +54,7 @@ automount_systemd() { | |||
53 | grep "^[[:space:]]*$tmp" /etc/fstab && return | 54 | grep "^[[:space:]]*$tmp" /etc/fstab && return |
54 | done | 55 | done |
55 | 56 | ||
56 | [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name" | 57 | [ -d "$MOUNT_BASE/$name" ] || mkdir -p "$MOUNT_BASE/$name" |
57 | 58 | ||
58 | MOUNT="$MOUNT -o silent" | 59 | MOUNT="$MOUNT -o silent" |
59 | 60 | ||
@@ -70,12 +71,12 @@ automount_systemd() { | |||
70 | ;; | 71 | ;; |
71 | esac | 72 | esac |
72 | 73 | ||
73 | if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name" | 74 | if ! $MOUNT --no-block -t auto $DEVNAME "$MOUNT_BASE/$name" |
74 | then | 75 | then |
75 | #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!" | 76 | #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"$MOUNT_BASE/$name\" failed!" |
76 | rm_dir "/run/media/$name" | 77 | rm_dir "$MOUNT_BASE/$name" |
77 | else | 78 | else |
78 | logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful" | 79 | logger "mount.sh/automount" "Auto-mount of [$MOUNT_BASE/$name] successful" |
79 | touch "/tmp/.automount-$name" | 80 | touch "/tmp/.automount-$name" |
80 | fi | 81 | fi |
81 | } | 82 | } |
@@ -93,7 +94,7 @@ automount() { | |||
93 | # configured in fstab | 94 | # configured in fstab |
94 | grep -q "^$DEVNAME " /proc/mounts && return | 95 | grep -q "^$DEVNAME " /proc/mounts && return |
95 | 96 | ||
96 | ! test -d "/run/media/$name" && mkdir -p "/run/media/$name" | 97 | ! test -d "$MOUNT_BASE/$name" && mkdir -p "$MOUNT_BASE/$name" |
97 | # Silent util-linux's version of mounting auto | 98 | # Silent util-linux's version of mounting auto |
98 | if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; | 99 | if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ; |
99 | then | 100 | then |
@@ -113,12 +114,12 @@ automount() { | |||
113 | ;; | 114 | ;; |
114 | esac | 115 | esac |
115 | 116 | ||
116 | if ! $MOUNT -t auto $DEVNAME "/run/media/$name" | 117 | if ! $MOUNT -t auto $DEVNAME "$MOUNT_BASE/$name" |
117 | then | 118 | then |
118 | #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" failed!" | 119 | #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"$MOUNT_BASE/$name\" failed!" |
119 | rm_dir "/run/media/$name" | 120 | rm_dir "$MOUNT_BASE/$name" |
120 | else | 121 | else |
121 | logger "mount.sh/automount" "Auto-mount of [/run/media/$name] successful" | 122 | logger "mount.sh/automount" "Auto-mount of [$MOUNT_BASE/$name] successful" |
122 | touch "/tmp/.automount-$name" | 123 | touch "/tmp/.automount-$name" |
123 | fi | 124 | fi |
124 | } | 125 | } |
@@ -157,5 +158,5 @@ if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ | |||
157 | 158 | ||
158 | # Remove empty directories from auto-mounter | 159 | # Remove empty directories from auto-mounter |
159 | name="`basename "$DEVNAME"`" | 160 | name="`basename "$DEVNAME"`" |
160 | test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name" | 161 | test -e "/tmp/.automount-$name" && rm_dir "$MOUNT_BASE/$name" |
161 | fi | 162 | fi |
diff --git a/meta/recipes-core/udev/udev-extraconf_1.1.bb b/meta/recipes-core/udev/udev-extraconf_1.1.bb index 7da04379c0..2b908ac05b 100644 --- a/meta/recipes-core/udev/udev-extraconf_1.1.bb +++ b/meta/recipes-core/udev/udev-extraconf_1.1.bb | |||
@@ -15,6 +15,7 @@ SRC_URI = " \ | |||
15 | 15 | ||
16 | S = "${WORKDIR}" | 16 | S = "${WORKDIR}" |
17 | 17 | ||
18 | MOUNT_BASE = "/run/media" | ||
18 | 19 | ||
19 | do_install() { | 20 | do_install() { |
20 | install -d ${D}${sysconfdir}/udev/rules.d | 21 | install -d ${D}${sysconfdir}/udev/rules.d |
@@ -31,6 +32,7 @@ do_install() { | |||
31 | install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh | 32 | install -m 0755 ${WORKDIR}/mount.sh ${D}${sysconfdir}/udev/scripts/mount.sh |
32 | sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh | 33 | sed -i 's|@systemd_unitdir@|${systemd_unitdir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh |
33 | sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh | 34 | sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${sysconfdir}/udev/scripts/mount.sh |
35 | sed -i 's|@MOUNT_BASE@|${MOUNT_BASE}|g' ${D}${sysconfdir}/udev/scripts/mount.sh | ||
34 | 36 | ||
35 | install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts | 37 | install -m 0755 ${WORKDIR}/network.sh ${D}${sysconfdir}/udev/scripts |
36 | } | 38 | } |