diff options
author | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2015-10-09 22:59:03 +0200 |
commit | 972dcfcdbfe75dcfeb777150c136576cf1a71e99 (patch) | |
tree | 97a61cd7e293d7ae9d56ef7ed0f81253365bb026 /meta/recipes-core/volatile-binds/volatile-binds.bb | |
download | poky-972dcfcdbfe75dcfeb777150c136576cf1a71e99.tar.gz |
initial commit for Enea Linux 5.0 arm
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/recipes-core/volatile-binds/volatile-binds.bb')
-rw-r--r-- | meta/recipes-core/volatile-binds/volatile-binds.bb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/meta/recipes-core/volatile-binds/volatile-binds.bb b/meta/recipes-core/volatile-binds/volatile-binds.bb new file mode 100644 index 0000000000..694ba1e487 --- /dev/null +++ b/meta/recipes-core/volatile-binds/volatile-binds.bb | |||
@@ -0,0 +1,69 @@ | |||
1 | SUMMARY = "Volatile bind mount setup and configuration for read-only-rootfs" | ||
2 | DESCRIPTION = "${SUMMARY}" | ||
3 | LICENSE = "MIT" | ||
4 | LIC_FILES_CHKSUM = "file://../COPYING.MIT;md5=5750f3aa4ea2b00c2bf21b2b2a7b714d" | ||
5 | |||
6 | SRC_URI = "\ | ||
7 | file://mount-copybind \ | ||
8 | file://COPYING.MIT \ | ||
9 | file://volatile-binds.service.in \ | ||
10 | " | ||
11 | |||
12 | inherit allarch systemd distro_features_check | ||
13 | |||
14 | REQUIRED_DISTRO_FEATURES = "systemd" | ||
15 | |||
16 | VOLATILE_BINDS ?= "\ | ||
17 | /var/volatile/lib /var/lib\n\ | ||
18 | " | ||
19 | VOLATILE_BINDS[type] = "list" | ||
20 | VOLATILE_BINDS[separator] = "\n" | ||
21 | |||
22 | def volatile_systemd_services(d): | ||
23 | services = [] | ||
24 | for line in oe.data.typed_value("VOLATILE_BINDS", d): | ||
25 | if not line: | ||
26 | continue | ||
27 | what, where = line.split(None, 1) | ||
28 | services.append("%s.service" % what[1:].replace("/", "-")) | ||
29 | return " ".join(services) | ||
30 | |||
31 | SYSTEMD_SERVICE_${PN} = "${@volatile_systemd_services(d)}" | ||
32 | |||
33 | FILES_${PN} += "${systemd_unitdir}/system/*.service" | ||
34 | |||
35 | do_compile () { | ||
36 | while read spec mountpoint; do | ||
37 | if [ -z "$spec" ]; then | ||
38 | continue | ||
39 | fi | ||
40 | |||
41 | servicefile="${spec#/}" | ||
42 | servicefile="$(echo "$servicefile" | tr / -).service" | ||
43 | sed -e "s#@what@#$spec#g; s#@where@#$mountpoint#g" \ | ||
44 | -e "s#@whatparent@#${spec%/*}#g; s#@whereparent@#${mountpoint%/*}#g" \ | ||
45 | volatile-binds.service.in >$servicefile | ||
46 | done <<END | ||
47 | ${@d.getVar('VOLATILE_BINDS', True).replace("\\n", "\n")} | ||
48 | END | ||
49 | |||
50 | if [ -e var-volatile-lib.service ]; then | ||
51 | # As the seed is stored under /var/lib, ensure that this service runs | ||
52 | # after the volatile /var/lib is mounted. | ||
53 | sed -i -e "/^Before=/s/\$/ systemd-random-seed.service/" \ | ||
54 | -e "/^WantedBy=/s/\$/ systemd-random-seed.service/" \ | ||
55 | var-volatile-lib.service | ||
56 | fi | ||
57 | } | ||
58 | do_compile[dirs] = "${WORKDIR}" | ||
59 | |||
60 | do_install () { | ||
61 | install -d ${D}${base_sbindir} | ||
62 | install -m 0755 mount-copybind ${D}${base_sbindir}/ | ||
63 | |||
64 | install -d ${D}${systemd_unitdir}/system | ||
65 | for service in ${SYSTEMD_SERVICE_volatile-binds}; do | ||
66 | install -m 0644 $service ${D}${systemd_unitdir}/system/ | ||
67 | done | ||
68 | } | ||
69 | do_install[dirs] = "${WORKDIR}" | ||