diff options
author | Anton Gerasimov <anton@advancedtelematic.com> | 2016-12-09 17:31:23 +0100 |
---|---|---|
committer | Anton Gerasimov <anton@advancedtelematic.com> | 2016-12-20 14:02:34 +0100 |
commit | eff667c136570fa52ed51e2c8d3c38502272b4fb (patch) | |
tree | 7d28a575bd7f3ccbd9a3f605f8f904549bcbe074 /classes | |
parent | e562aef8830c6d6e12656d9414c35b30bf78b050 (diff) | |
download | meta-updater-eff667c136570fa52ed51e2c8d3c38502272b4fb.tar.gz |
Make systemd optional
Diffstat (limited to 'classes')
-rw-r--r-- | classes/image_types_ostree.bbclass | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 32ea98f..f88140c 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -14,6 +14,8 @@ RAMDISK_EXT_arm ?= ".ext4.gz.u-boot" | |||
14 | 14 | ||
15 | OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" | 15 | OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" |
16 | 16 | ||
17 | export SYSTEMD_USED = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', '', d)}" | ||
18 | |||
17 | IMAGE_CMD_ostree () { | 19 | IMAGE_CMD_ostree () { |
18 | if [ -z "$OSTREE_REPO" ]; then | 20 | if [ -z "$OSTREE_REPO" ]; then |
19 | bbfatal "OSTREE_REPO should be set in your local.conf" | 21 | bbfatal "OSTREE_REPO should be set in your local.conf" |
@@ -51,13 +53,21 @@ IMAGE_CMD_ostree () { | |||
51 | fi | 53 | fi |
52 | done | 54 | done |
53 | 55 | ||
54 | if [ ! -d "usr/etc/tmpfiles.d" ]; then | 56 | if [ -n "$SYSTEMD_USED" ]; then |
55 | mkdir usr/etc/tmpfiles.d | 57 | mkdir -p usr/etc/tmpfiles.d |
58 | tmpfiles_conf=usr/etc/tmpfiles.d/00ostree-tmpfiles.conf | ||
59 | echo "d /var/rootdirs 0755 root root -" >>${tmpfiles_conf} | ||
60 | echo "L /var/rootdirs/home - - - - /sysroot/home" >>${tmpfiles_conf} | ||
61 | else | ||
62 | mkdir -p usr/etc/init.d | ||
63 | tmpfiles_conf=usr/etc/init.d/tmpfiles.sh | ||
64 | echo '#!/bin/sh' > ${tmpfiles_conf} | ||
65 | echo "mkdir -p /var/rootdirs; chmod 755 /var/rootdirs" >> ${tmpfiles_conf} | ||
66 | echo "ln -sf /sysroot/home /var/rootdirs/home" >> ${tmpfiles_conf} | ||
67 | |||
68 | ln -s ../init.d/tmpfiles.sh usr/etc/rcS.d/S20tmpfiles.sh | ||
56 | fi | 69 | fi |
57 | tmpfiles_conf=usr/etc/tmpfiles.d/00ostree-tmpfiles.conf | ||
58 | 70 | ||
59 | echo "d /var/rootdirs 0755 root root -" >>${tmpfiles_conf} | ||
60 | echo "L /var/rootdirs/home - - - - /sysroot/home" >>${tmpfiles_conf} | ||
61 | # Preserve data in /home to be later copied to /sysroot/home by | 71 | # Preserve data in /home to be later copied to /sysroot/home by |
62 | # sysroot generating procedure | 72 | # sysroot generating procedure |
63 | mkdir -p usr/homedirs | 73 | mkdir -p usr/homedirs |
@@ -74,7 +84,12 @@ IMAGE_CMD_ostree () { | |||
74 | if [ "$(ls -A $dir)" ]; then | 84 | if [ "$(ls -A $dir)" ]; then |
75 | bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" | 85 | bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" |
76 | fi | 86 | fi |
77 | echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} | 87 | |
88 | if [ -n "$SYSTEMD_USED" ]; then | ||
89 | echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} | ||
90 | else | ||
91 | echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} | ||
92 | fi | ||
78 | rm -rf ${dir} | 93 | rm -rf ${dir} |
79 | ln -sf var/rootdirs/${dir} ${dir} | 94 | ln -sf var/rootdirs/${dir} ${dir} |
80 | fi | 95 | fi |
@@ -84,7 +99,13 @@ IMAGE_CMD_ostree () { | |||
84 | if [ "$(ls -A root)" ]; then | 99 | if [ "$(ls -A root)" ]; then |
85 | bberror "Data in /root directory is not preserved by OSTree." | 100 | bberror "Data in /root directory is not preserved by OSTree." |
86 | fi | 101 | fi |
87 | echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf} | 102 | |
103 | if [ -n "$SYSTEMD_USED" ]; then | ||
104 | echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf} | ||
105 | else | ||
106 | echo "mkdir -p /var/roothome; chown 755 /var/roothome" >>${tmpfiles_conf} | ||
107 | fi | ||
108 | |||
88 | rm -rf root | 109 | rm -rf root |
89 | ln -sf var/roothome root | 110 | ln -sf var/roothome root |
90 | fi | 111 | fi |