4bbc8aa04e9091651e66e9fd1c558f312837bb60
[AGL/meta-agl.git] / meta-security / recipes-core / systemd / systemd_234.bbappend
1 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3 SYSTEMD_SMACK_PATCHES_216 = " \
4 file://0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup-v216.patch \
5 file://0004-tizen-smack-Handling-of-dev-v216.patch \
6 file://0005-tizen-smack-Handling-network-v216.patch \
7 file://0007-tizen-smack-Runs-systemd-journald-with-v216.patch \
8 "
9
10 SYSTEMD_SMACK_PATCHES_219 = " \
11 file://0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup.patch \
12 file://0004-tizen-smack-Handling-of-dev.patch \
13 file://0005-tizen-smack-Handling-network.patch \
14 file://0007-tizen-smack-Runs-systemd-journald-with.patch \
15 "
16 SYSTEMD_SMACK_PATCHES_225 = " \
17 file://0003-tizen-smack-Handling-of-run-and-sys-fs-cgroup.patch \
18 file://0004-tizen-smack-Handling-of-dev.patch \
19 file://0005-tizen-smack-Handling-network-v225.patch \
20 file://0007-tizen-smack-Runs-systemd-journald-with.patch \
21 "
22
23 SYSTEMD_SMACK_PATCHES_228 = " \
24 file://0005-tizen-smack-Handling-network-v228.patch \
25 file://mount-setup.c-fix-handling-of-symlink-Smack-labellin-v228.patch \
26 "
27
28 SYSTEMD_SMACK_PATCHES_234 = " \
29 file://0001-Switch-Smack-label-earlier.patch \
30 "
31
32 # Most patches from sandbox/jobol/v219. Cannot be applied unconditionally
33 # because systemd panics when booted without Smack support:
34 # systemd[1]: Cannot determine cgroup we are running in: No such file or directory
35 # systemd[1]: Failed to allocate manager object: No such file or directory
36 # [!!!!!!] Failed to allocate manager object, freezing.
37 #
38 # There's a slight dependency on the base systemd in 0005-tizen-smack-Handling-network.
39 # We use the beginning of PV (unexpanded here to prevent a cyclic dependency
40 # during resolution apparently caused by ${SRCPV}) to pick the right set of
41 # patches.
42 #
43 # Patches are optional. Hopefully we won't need any for systemd >= 229.
44 SRC_URI_append_with-lsm-smack = " ${SYSTEMD_SMACK_PATCHES_234}"
45
46 # A workaround for a missing space in a SRC_URI_append in a private layer elsewhere:
47 SRC_URI += ""
48
49 # Ensures systemd runs with label "System"
50 EXTRA_OECONF_append_with-lsm-smack = " --with-smack-run-label=System"
51
52 # Maintaining trivial, non-upstreamable configuration changes as patches
53 # is tedious. But in same cases (like early mounting of special directories)
54 # the configuration has to be in code. We make these changes here directly.
55 do_patch[prefuncs] += "patch_systemd"
56 do_patch[vardeps] += "patch_systemd"
57 patch_systemd() {
58     # Handling of /run and /sys/fs/cgroup. Make /run a transmuting directory to
59     # enable systemd communications with services in the User domain.
60     # Original patch by Michael Demeter <michael.demeter@intel.com>.
61     #
62     # We simplify the patching by touching only lines which check the result of
63     # mac_smack_use(). Those are the ones which are used when Smack is active.
64     #
65     # smackfsroot=* on /sys/fs/cgroup may be upstreamable, but smackfstransmute=System::Run
66     # is too distro specific (depends on Smack rules) and thus has to remain here.
67     sed -i -e 's;\("/sys/fs/cgroup", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfsroot=*\2;' \
68            -e 's;\("/run", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfstransmute=System::Run\2;' \
69            ${S}/src/core/mount-setup.c
70 }
71
72 ##################################################################################
73 # What follows is temporary.
74 # This is a solution to the Bug-AGL SPEC-539
75 # (see https://jira.automotivelinux.org/browse/SPEC-539).
76 #
77 # It renames the file "touchscreen.rules" to "55-touchscreen.rules"
78 # This comes with the recipe systemd_230/234 of poky (meta/recipes-core/systemd)
79 # It should be removed when poky changes.
80 ##################################################################################
81 do_install_prepend() {
82         mv ${WORKDIR}/touchscreen.rules ${WORKDIR}/55-touchscreen.rules || true
83 }
84