79753a2d6d186fa9f4fe9d2840e25835423546dd
[AGL/meta-agl.git] / meta-security / recipes-core / systemd / systemd_234.bbappend
1 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3 ##################################################################################
4 # What follows is temporary.
5 # This patch is still needed for systemd 234 but is normally upstreamed
6 # and thus should be removed in later versions.
7 ##################################################################################
8 SRC_URI_append_with-lsm-smack = "\
9     file://0001-Switch-Smack-label-earlier.patch \
10 "
11
12 # Ensures systemd runs with label "System"
13 EXTRA_OECONF_append_with-lsm-smack = " --with-smack-run-label=System"
14
15 ##################################################################################
16 # Maintaining trivial, non-upstreamable configuration changes as patches
17 # is tedious. But in same cases (like early mounting of special directories)
18 # the configuration has to be in code. We make these changes here directly.
19 ##################################################################################
20 do_patch[prefuncs] += "patch_systemd"
21 do_patch[vardeps] += "patch_systemd"
22 patch_systemd() {
23     # Handling of /run and /sys/fs/cgroup. Make /run a transmuting directory to
24     # enable systemd communications with services in the User domain.
25     # Original patch by Michael Demeter <michael.demeter@intel.com>.
26     #
27     # We simplify the patching by touching only lines which check the result of
28     # mac_smack_use(). Those are the ones which are used when Smack is active.
29     #
30     # smackfsroot=* on /sys/fs/cgroup may be upstreamable, but smackfstransmute=System::Run
31     # is too distro specific (depends on Smack rules) and thus has to remain here.
32     sed -i -e 's;\("/sys/fs/cgroup", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfsroot=*\2;' \
33            -e 's;\("/run", *"[^"]*", *"[^"]*\)\(.*mac_smack_use.*\);\1,smackfstransmute=System::Run\2;' \
34            ${S}/src/core/mount-setup.c
35 }
36
37 ##################################################################################
38 # What follows is temporary.
39 # This is a solution to the Bug-AGL SPEC-539
40 # (see https://jira.automotivelinux.org/browse/SPEC-539).
41 #
42 # It renames the file "touchscreen.rules" to "55-touchscreen.rules"
43 # This comes with the recipe systemd_230/234 of poky (meta/recipes-core/systemd)
44 # It should be removed when poky changes.
45 ##################################################################################
46 do_install_prepend() {
47         mv ${WORKDIR}/touchscreen.rules ${WORKDIR}/55-touchscreen.rules || true
48 }
49