summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/volatile-binds/volatile-binds.bb
diff options
context:
space:
mode:
authorStéphane Veyret <sveyret@gmail.com>2023-08-28 19:52:56 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-30 08:50:46 +0000
commit494a25d861d72c662c25cfee3a388ead71992bdf (patch)
treea617982cea2012471d0924996d4bea229c97425b /meta/recipes-core/volatile-binds/volatile-binds.bb
parentd6134c9f97d9ac062471a870c70a3f1d1f3a5959 (diff)
downloadpoky-494a25d861d72c662c25cfee3a388ead71992bdf.tar.gz
volatile-binds: Calculate the name of the /var/lib service
By default, /var/lib is bind mounted on /var/volatile/lib. If this is the case, the recipe adds conditions on systemd-random-seed in the service file mounting it. But as the VOLATILE_BINDS may be modified, /var/lib may be mounted elsewhere, for example in /persistent/var/lib. In this case, the conditions are not set because the service file name does not match expected one. This patch automatically records the name of the service mounting /var/lib, if any, in order to set the condition in the appropriate file. (From OE-Core rev: 66f0c2a1678cb69cf8d50372b0592c55e2dc3e3c) Signed-off-by: Stéphane Veyret <sveyret@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/volatile-binds/volatile-binds.bb')
-rw-r--r--meta/recipes-core/volatile-binds/volatile-binds.bb18
1 files changed, 9 insertions, 9 deletions
diff --git a/meta/recipes-core/volatile-binds/volatile-binds.bb b/meta/recipes-core/volatile-binds/volatile-binds.bb
index 3fefa9abde..cca8a65fb4 100644
--- a/meta/recipes-core/volatile-binds/volatile-binds.bb
+++ b/meta/recipes-core/volatile-binds/volatile-binds.bb
@@ -16,10 +16,10 @@ inherit allarch systemd features_check
16REQUIRED_DISTRO_FEATURES = "systemd" 16REQUIRED_DISTRO_FEATURES = "systemd"
17 17
18VOLATILE_BINDS ?= "\ 18VOLATILE_BINDS ?= "\
19 /var/volatile/lib /var/lib\n\ 19 ${localstatedir}/volatile/lib ${localstatedir}/lib\n\
20 /var/volatile/cache /var/cache\n\ 20 ${localstatedir}/volatile/cache ${localstatedir}/cache\n\
21 /var/volatile/spool /var/spool\n\ 21 ${localstatedir}/volatile/spool ${localstatedir}/spool\n\
22 /var/volatile/srv /srv\n\ 22 ${localstatedir}/volatile/srv /srv\n\
23" 23"
24VOLATILE_BINDS[type] = "list" 24VOLATILE_BINDS[type] = "list"
25VOLATILE_BINDS[separator] = "\n" 25VOLATILE_BINDS[separator] = "\n"
@@ -46,8 +46,8 @@ do_compile () {
46 continue 46 continue
47 fi 47 fi
48 48
49 servicefile="${spec#/}" 49 servicefile="$(echo "${spec#/}" | tr / -).service"
50 servicefile="$(echo "$servicefile" | tr / -).service" 50 [ "$mountpoint" != ${localstatedir}/lib ] || var_lib_servicefile=$servicefile
51 sed -e "s#@what@#$spec#g; s#@where@#$mountpoint#g" \ 51 sed -e "s#@what@#$spec#g; s#@where@#$mountpoint#g" \
52 -e "s#@whatparent@#${spec%/*}#g; s#@whereparent@#${mountpoint%/*}#g" \ 52 -e "s#@whatparent@#${spec%/*}#g; s#@whereparent@#${mountpoint%/*}#g" \
53 -e "s#@avoid_overlayfs@#${@d.getVar('AVOID_OVERLAYFS')}#g" \ 53 -e "s#@avoid_overlayfs@#${@d.getVar('AVOID_OVERLAYFS')}#g" \
@@ -56,12 +56,12 @@ do_compile () {
56${@d.getVar('VOLATILE_BINDS').replace("\\n", "\n")} 56${@d.getVar('VOLATILE_BINDS').replace("\\n", "\n")}
57END 57END
58 58
59 if [ -e var-volatile-lib.service ]; then 59 if [ -e "$var_lib_servicefile" ]; then
60 # As the seed is stored under /var/lib, ensure that this service runs 60 # As the seed is stored under /var/lib, ensure that this service runs
61 # after the volatile /var/lib is mounted. 61 # after the volatile /var/lib is mounted.
62 sed -i -e "/^Before=/s/\$/ systemd-random-seed.service/" \ 62 sed -i -e "/^Before=/s/\$/ systemd-random-seed.service/" \
63 -e "/^WantedBy=/s/\$/ systemd-random-seed.service/" \ 63 -e "/^WantedBy=/s/\$/ systemd-random-seed.service/" \
64 var-volatile-lib.service 64 "$var_lib_servicefile"
65 fi 65 fi
66} 66}
67do_compile[dirs] = "${WORKDIR}" 67do_compile[dirs] = "${WORKDIR}"
@@ -78,7 +78,7 @@ do_install () {
78 78
79 # Suppress attempts to process some tmpfiles that are not temporary. 79 # Suppress attempts to process some tmpfiles that are not temporary.
80 # 80 #
81 install -d ${D}${sysconfdir}/tmpfiles.d ${D}/var/cache 81 install -d ${D}${sysconfdir}/tmpfiles.d ${D}${localstatedir}/cache
82 ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/etc.conf 82 ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/etc.conf
83 ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/home.conf 83 ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/home.conf
84} 84}