summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/udev/udev-extraconf/mount.sh25
-rw-r--r--meta/recipes-core/udev/udev-extraconf_1.1.bb2
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
7BASE_INIT="`readlink -f "@base_sbindir@/init"`" 7BASE_INIT="`readlink -f "@base_sbindir@/init"`"
8INIT_SYSTEMD="@systemd_unitdir@/systemd" 8INIT_SYSTEMD="@systemd_unitdir@/systemd"
9MOUNT_BASE="@MOUNT_BASE@"
9 10
10if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then 11if [ "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"
161fi 162fi
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
16S = "${WORKDIR}" 16S = "${WORKDIR}"
17 17
18MOUNT_BASE = "/run/media"
18 19
19do_install() { 20do_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}