summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/volatile-binds/volatile-binds.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/volatile-binds/volatile-binds.bb')
-rw-r--r--meta/recipes-core/volatile-binds/volatile-binds.bb32
1 files changed, 18 insertions, 14 deletions
diff --git a/meta/recipes-core/volatile-binds/volatile-binds.bb b/meta/recipes-core/volatile-binds/volatile-binds.bb
index 3c8b18291e..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"
@@ -33,9 +33,12 @@ def volatile_systemd_services(d):
33 services.append("%s.service" % what[1:].replace("/", "-")) 33 services.append("%s.service" % what[1:].replace("/", "-"))
34 return " ".join(services) 34 return " ".join(services)
35 35
36SYSTEMD_SERVICE_${PN} = "${@volatile_systemd_services(d)}" 36SYSTEMD_SERVICE:${PN} = "${@volatile_systemd_services(d)}"
37 37
38FILES_${PN} += "${systemd_unitdir}/system/*.service ${servicedir}" 38FILES:${PN} += "${systemd_system_unitdir}/*.service ${servicedir}"
39
40# Set to 1 to forcibly skip OverlayFS, and default to copy+bind
41AVOID_OVERLAYFS = "0"
39 42
40do_compile () { 43do_compile () {
41 while read spec mountpoint; do 44 while read spec mountpoint; do
@@ -43,21 +46,22 @@ do_compile () {
43 continue 46 continue
44 fi 47 fi
45 48
46 servicefile="${spec#/}" 49 servicefile="$(echo "${spec#/}" | tr / -).service"
47 servicefile="$(echo "$servicefile" | tr / -).service" 50 [ "$mountpoint" != ${localstatedir}/lib ] || var_lib_servicefile=$servicefile
48 sed -e "s#@what@#$spec#g; s#@where@#$mountpoint#g" \ 51 sed -e "s#@what@#$spec#g; s#@where@#$mountpoint#g" \
49 -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" \
50 volatile-binds.service.in >$servicefile 54 volatile-binds.service.in >$servicefile
51 done <<END 55 done <<END
52${@d.getVar('VOLATILE_BINDS').replace("\\n", "\n")} 56${@d.getVar('VOLATILE_BINDS').replace("\\n", "\n")}
53END 57END
54 58
55 if [ -e var-volatile-lib.service ]; then 59 if [ -e "$var_lib_servicefile" ]; then
56 # 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
57 # after the volatile /var/lib is mounted. 61 # after the volatile /var/lib is mounted.
58 sed -i -e "/^Before=/s/\$/ systemd-random-seed.service/" \ 62 sed -i -e "/^Before=/s/\$/ systemd-random-seed.service/" \
59 -e "/^WantedBy=/s/\$/ systemd-random-seed.service/" \ 63 -e "/^WantedBy=/s/\$/ systemd-random-seed.service/" \
60 var-volatile-lib.service 64 "$var_lib_servicefile"
61 fi 65 fi
62} 66}
63do_compile[dirs] = "${WORKDIR}" 67do_compile[dirs] = "${WORKDIR}"
@@ -67,14 +71,14 @@ do_install () {
67 install -d ${D}${servicedir} 71 install -d ${D}${servicedir}
68 install -m 0755 mount-copybind ${D}${base_sbindir}/ 72 install -m 0755 mount-copybind ${D}${base_sbindir}/
69 73
70 install -d ${D}${systemd_unitdir}/system 74 install -d ${D}${systemd_system_unitdir}
71 for service in ${SYSTEMD_SERVICE_${PN}}; do 75 for service in ${SYSTEMD_SERVICE:${PN}}; do
72 install -m 0644 $service ${D}${systemd_unitdir}/system/ 76 install -m 0644 $service ${D}${systemd_system_unitdir}/
73 done 77 done
74 78
75 # Suppress attempts to process some tmpfiles that are not temporary. 79 # Suppress attempts to process some tmpfiles that are not temporary.
76 # 80 #
77 install -d ${D}${sysconfdir}/tmpfiles.d ${D}/var/cache 81 install -d ${D}${sysconfdir}/tmpfiles.d ${D}${localstatedir}/cache
78 ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/etc.conf 82 ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/etc.conf
79 ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/home.conf 83 ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/home.conf
80} 84}