summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2017-09-08 10:44:23 -0500
committerMark Hatle <mark.hatle@windriver.com>2017-09-14 08:29:01 -0500
commit4fefe83c3203c11fadbe43637a3058284b60427b (patch)
treeaf4b33f05100c12ed16851f5dd4129f0e176da25
parent694b8d1f1a590083e4445d6941f24b412ec0f206 (diff)
downloadmeta-selinux-4fefe83c3203c11fadbe43637a3058284b60427b.tar.gz
Refactor to conform to YP Compat requirements
Change the references to check for the distribution flag of 'selinux' being set before taking any action within the bbappends. This prevents the signature from being modified. Also remove PR changes, as they are no longer allowed. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-rw-r--r--meta-python/recipes-extended/augeas/augeas/augeas_%.bbappend2
-rw-r--r--networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_%.bbappend2
-rw-r--r--networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_selinux.inc1
-rw-r--r--recipes-connectivity/bind/bind_%.bbappend14
-rw-r--r--recipes-connectivity/bind/bind_selinux.inc11
-rw-r--r--recipes-connectivity/dhcp/dhcp_%.bbappend4
-rw-r--r--recipes-connectivity/dhcp/dhcp_selinux.inc3
-rw-r--r--recipes-connectivity/iproute2/iproute2_%.bbappend10
-rw-r--r--recipes-connectivity/iproute2/iproute2_selinux.inc5
-rw-r--r--recipes-connectivity/openssh/openssh_%.bbappend14
-rw-r--r--recipes-connectivity/openssh/openssh_selinux.inc9
-rw-r--r--recipes-core/busybox/busybox_%.bbappend88
-rw-r--r--recipes-core/busybox/busybox_selinux.inc85
-rw-r--r--recipes-core/coreutils/coreutils_%.bbappend3
-rw-r--r--recipes-core/dbus/dbus_%.bbappend3
-rw-r--r--recipes-core/eudev/eudev_%.bbappend3
-rw-r--r--recipes-core/eudev/eudev_selinux.inc3
-rw-r--r--recipes-core/eudev/files/init (renamed from recipes-core/eudev/eudev/init)0
-rw-r--r--recipes-core/eudev/files/udev-cache (renamed from recipes-core/eudev/eudev/udev-cache)0
-rw-r--r--recipes-core/glib-2.0/glib-2.0_%.bbappend2
-rwxr-xr-xrecipes-core/initscripts/files/devpts.sh (renamed from recipes-core/initscripts/initscripts/devpts.sh)0
-rw-r--r--recipes-core/initscripts/initscripts-1.0_selinux.inc11
-rw-r--r--recipes-core/initscripts/initscripts_1.0.bbappend14
-rw-r--r--recipes-core/libcgroup/libcgroup_%.bbappend13
-rw-r--r--recipes-core/libcgroup/libcgroup_selinux.inc10
-rw-r--r--recipes-core/systemd/systemd_%.bbappend2
-rw-r--r--recipes-core/sysvinit/files/sysvinit-fix-is_selinux_enabled.patch (renamed from recipes-core/sysvinit/sysvinit-2.88dsf/sysvinit-fix-is_selinux_enabled.patch)0
-rw-r--r--recipes-core/sysvinit/sysvinit-2.88dsf_selinux.inc11
-rw-r--r--recipes-core/sysvinit/sysvinit_2.88dsf.bbappend15
-rw-r--r--recipes-core/util-linux/util-linux_%.bbappend4
-rw-r--r--recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend3
-rw-r--r--recipes-devtools/e2fsprogs/e2fsprogs_selinux.inc3
-rw-r--r--recipes-devtools/e2fsprogs/files/lib-ext2fs-ext2_ext_attr.h-add-xattr-index.patch (renamed from recipes-devtools/e2fsprogs/e2fsprogs/lib-ext2fs-ext2_ext_attr.h-add-xattr-index.patch)0
-rw-r--r--recipes-devtools/e2fsprogs/files/misc_create_inode.c-label_rootfs.patch (renamed from recipes-devtools/e2fsprogs/e2fsprogs/misc_create_inode.c-label_rootfs.patch)0
-rw-r--r--recipes-devtools/prelink/prelink_git.bbappend4
-rw-r--r--recipes-devtools/python/files/sitecustomize.py (renamed from recipes-devtools/python/python/sitecustomize.py)0
-rw-r--r--recipes-devtools/python/python_%.bbappend4
-rw-r--r--recipes-devtools/python/python_selinux.inc5
-rw-r--r--recipes-devtools/rpm/rpm_%.bbappend5
-rw-r--r--recipes-devtools/rpm/rpm_selinux.inc2
-rw-r--r--recipes-extended/at/at_%.bbappend2
-rw-r--r--recipes-extended/cronie/cronie_%.bbappend5
-rw-r--r--recipes-extended/findutils/findutils_4.6.%.bbappend3
-rw-r--r--recipes-extended/logrotate/logrotate_%.bbappend6
-rw-r--r--recipes-extended/logrotate/logrotate_selinux.inc5
-rw-r--r--recipes-extended/lsof/lsof_%.bbappend17
-rw-r--r--recipes-extended/lsof/lsof_selinux.inc14
-rw-r--r--recipes-extended/net-tools/files/netstat-selinux-support.patch (renamed from recipes-extended/net-tools/net-tools/netstat-selinux-support.patch)0
-rw-r--r--recipes-extended/net-tools/net-tools_%.bbappend12
-rw-r--r--recipes-extended/net-tools/net-tools_selinux.inc9
-rw-r--r--recipes-extended/pam/libpam_%.bbappend4
-rw-r--r--recipes-extended/pam/libpam_selinux.inc3
-rw-r--r--recipes-extended/parted/parted_%.bbappend4
-rw-r--r--recipes-extended/psmisc/psmisc_%.bbappend6
-rw-r--r--recipes-extended/sed/sed_4.2.2.bbappend4
-rw-r--r--recipes-extended/shadow/shadow_%.bbappend8
-rw-r--r--recipes-extended/shadow/shadow_selinux.inc6
-rw-r--r--recipes-extended/sudo/sudo_%.bbappend4
-rw-r--r--recipes-extended/sysklogd/sysklogd_%.bbappend2
-rw-r--r--recipes-extended/sysklogd/sysklogd_selinux.inc1
-rw-r--r--recipes-extended/tar/tar_%.bbappend7
-rw-r--r--recipes-extended/tar/tar_selinux.inc3
-rw-r--r--recipes-graphics/mesa/mesa_%.bbappend6
-rw-r--r--recipes-graphics/mesa/mesa_selinux.inc6
-rw-r--r--recipes-graphics/xcb/libxcb_%.bbappend9
-rw-r--r--recipes-graphics/xcb/libxcb_selinux.inc6
-rw-r--r--recipes-kernel/linux/files/selinux.cfg (renamed from recipes-kernel/linux/linux-yocto/selinux.cfg)0
-rw-r--r--recipes-kernel/linux/linux-yocto_4.%.bbappend9
-rw-r--r--recipes-kernel/linux/linux-yocto_selinux.inc4
-rw-r--r--recipes-kernel/perf/perf.bbappend3
-rw-r--r--recipes-kernel/perf/perf_selinux.inc1
-rw-r--r--recipes-support/attr/attr_%.bbappend6
-rw-r--r--recipes-support/attr/attr_selinux.inc5
-rw-r--r--recipes-support/attr/files/fix-ptest-failures-when-selinux-enabled.patch (renamed from recipes-support/attr/attr/fix-ptest-failures-when-selinux-enabled.patch)0
-rw-r--r--recipes-support/gnupg/gnupg_2.%.bbappend4
-rw-r--r--recipes-support/gnupg/gnupg_selinux.inc3
-rw-r--r--recipes-support/libpcre/libpcre_%.bbappend15
-rw-r--r--recipes-support/libpcre/libpcre_selinux.inc12
-rw-r--r--virtualization-layer/recipes-containers/lxc/lxc_%.bbappend2
79 files changed, 283 insertions, 301 deletions
diff --git a/meta-python/recipes-extended/augeas/augeas/augeas_%.bbappend b/meta-python/recipes-extended/augeas/augeas/augeas_%.bbappend
index c1e8ed6..b01ad25 100644
--- a/meta-python/recipes-extended/augeas/augeas/augeas_%.bbappend
+++ b/meta-python/recipes-extended/augeas/augeas/augeas_%.bbappend
@@ -1 +1 @@
inherit with-selinux inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
diff --git a/networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_%.bbappend b/networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_%.bbappend
index 81fe7b7..7719d3b 100644
--- a/networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_%.bbappend
+++ b/networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_%.bbappend
@@ -1 +1 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
diff --git a/networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_selinux.inc b/networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_selinux.inc
new file mode 100644
index 0000000..81fe7b7
--- /dev/null
+++ b/networking-layer/recipes-daemons/iscsi-initiator-utils/iscsi-initiator-utils_selinux.inc
@@ -0,0 +1 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
diff --git a/recipes-connectivity/bind/bind_%.bbappend b/recipes-connectivity/bind/bind_%.bbappend
index a15e045..7719d3b 100644
--- a/recipes-connectivity/bind/bind_%.bbappend
+++ b/recipes-connectivity/bind/bind_%.bbappend
@@ -1,13 +1 @@
1PR .= ".3" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
4
5SRC_URI += "file://volatiles.04_bind"
6
7do_install_append() {
8 install -d ${D}${sysconfdir}/default/volatiles
9 install -m 0644 ${WORKDIR}/volatiles.04_bind ${D}${sysconfdir}/default/volatiles/volatiles.04_bind
10
11 sed -i '/^\s*\/usr\/sbin\/rndc-confgen/a\
12 [ -x /sbin/restorecon ] && /sbin/restorecon -F /etc/bind/rndc.key' ${D}${sysconfdir}/init.d/bind
13}
diff --git a/recipes-connectivity/bind/bind_selinux.inc b/recipes-connectivity/bind/bind_selinux.inc
new file mode 100644
index 0000000..1dfef8a
--- /dev/null
+++ b/recipes-connectivity/bind/bind_selinux.inc
@@ -0,0 +1,11 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3SRC_URI += "file://volatiles.04_bind"
4
5do_install_append() {
6 install -d ${D}${sysconfdir}/default/volatiles
7 install -m 0644 ${WORKDIR}/volatiles.04_bind ${D}${sysconfdir}/default/volatiles/volatiles.04_bind
8
9 sed -i '/^\s*\/usr\/sbin\/rndc-confgen/a\
10 [ -x /sbin/restorecon ] && /sbin/restorecon -F /etc/bind/rndc.key' ${D}${sysconfdir}/init.d/bind
11}
diff --git a/recipes-connectivity/dhcp/dhcp_%.bbappend b/recipes-connectivity/dhcp/dhcp_%.bbappend
index 2d2232c..7719d3b 100644
--- a/recipes-connectivity/dhcp/dhcp_%.bbappend
+++ b/recipes-connectivity/dhcp/dhcp_%.bbappend
@@ -1,3 +1 @@
1inherit selinux require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3FILESEXTRAPATHS_prepend := "${@target_selinux(d, '${THISDIR}/files:')}"
diff --git a/recipes-connectivity/dhcp/dhcp_selinux.inc b/recipes-connectivity/dhcp/dhcp_selinux.inc
new file mode 100644
index 0000000..08389f1
--- /dev/null
+++ b/recipes-connectivity/dhcp/dhcp_selinux.inc
@@ -0,0 +1,3 @@
1inherit selinux
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
diff --git a/recipes-connectivity/iproute2/iproute2_%.bbappend b/recipes-connectivity/iproute2/iproute2_%.bbappend
index c866b54..7719d3b 100644
--- a/recipes-connectivity/iproute2/iproute2_%.bbappend
+++ b/recipes-connectivity/iproute2/iproute2_%.bbappend
@@ -1,9 +1 @@
1inherit with-selinux require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3do_configure_append() {
4 if ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'true', 'false', d)}; then
5 sed -i 's/\(HAVE_SELINUX:=\).*/\1y/' ${B}/Config
6 else
7 sed -i 's/\(HAVE_SELINUX:=\).*/\1n/' ${B}/Config
8 fi
9}
diff --git a/recipes-connectivity/iproute2/iproute2_selinux.inc b/recipes-connectivity/iproute2/iproute2_selinux.inc
new file mode 100644
index 0000000..b0a7ffe
--- /dev/null
+++ b/recipes-connectivity/iproute2/iproute2_selinux.inc
@@ -0,0 +1,5 @@
1inherit with-selinux
2
3do_configure_append() {
4 sed -i 's/\(HAVE_SELINUX:=\).*/\1y/' ${B}/Config
5}
diff --git a/recipes-connectivity/openssh/openssh_%.bbappend b/recipes-connectivity/openssh/openssh_%.bbappend
index 223b8cf..7719d3b 100644
--- a/recipes-connectivity/openssh/openssh_%.bbappend
+++ b/recipes-connectivity/openssh/openssh_%.bbappend
@@ -1,13 +1 @@
1PR .= ".5" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3inherit with-selinux
4
5FILESEXTRAPATHS_prepend := "${@target_selinux(d, '${THISDIR}/files:')}"
6
7# There is no distro feature just for audit. If we want it,
8# uncomment the following.
9#
10#PACKAGECONFIG += "${@target_selinux(d, 'audit')}"
11
12PACKAGECONFIG[audit] = "--with-audit=linux,--without-audit,audit,"
13
diff --git a/recipes-connectivity/openssh/openssh_selinux.inc b/recipes-connectivity/openssh/openssh_selinux.inc
new file mode 100644
index 0000000..ebd2721
--- /dev/null
+++ b/recipes-connectivity/openssh/openssh_selinux.inc
@@ -0,0 +1,9 @@
1inherit with-selinux
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
4
5# There is no distro feature just for audit.
6PACKAGECONFIG_append = " audit"
7
8PACKAGECONFIG[audit] = "--with-audit=linux,--without-audit,audit,"
9
diff --git a/recipes-core/busybox/busybox_%.bbappend b/recipes-core/busybox/busybox_%.bbappend
index b4935b2..7719d3b 100644
--- a/recipes-core/busybox/busybox_%.bbappend
+++ b/recipes-core/busybox/busybox_%.bbappend
@@ -1,87 +1 @@
1PR .= ".1" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3FILES_${PN} += "${libdir}/${PN}"
4
5# We should use sh wrappers instead of links so the commands could get correct
6# security labels
7python create_sh_wrapper_reset_alternative_vars () {
8 # We need to load the full set of busybox provides from the /etc/busybox.links
9 # Use this to see the update-alternatives with the right information
10
11 dvar = d.getVar('D', True)
12 pn = d.getVar('PN', True)
13
14 def create_sh_alternative_vars(links, target, mode):
15 import shutil
16 # Create sh wrapper template
17 fwp = open("busybox_wrapper", 'w')
18 fwp.write("#!%s" % (target))
19 os.fchmod(fwp.fileno(), mode)
20 fwp.close()
21 # Install the sh wrappers and alternatives reset to link to them
22 wpdir = os.path.join(d.getVar('libdir', True), pn)
23 wpdir_dest = '%s%s' % (dvar, wpdir)
24 if not os.path.exists(wpdir_dest):
25 os.makedirs(wpdir_dest)
26 f = open('%s%s' % (dvar, links), 'r')
27 for alt_link_name in f:
28 alt_link_name = alt_link_name.strip()
29 alt_name = os.path.basename(alt_link_name)
30 # Copy script wrapper to wp_path
31 alt_wppath = '%s%s' % (wpdir, alt_link_name)
32 alt_wppath_dest = '%s%s' % (wpdir_dest, alt_link_name)
33 alt_wpdir_dest = os.path.dirname(alt_wppath_dest)
34 if not os.path.exists(alt_wpdir_dest):
35 os.makedirs(alt_wpdir_dest)
36 shutil.copy2("busybox_wrapper", alt_wppath_dest)
37 # Re-set alternatives
38 # Match coreutils
39 if alt_name == '[':
40 alt_name = 'lbracket'
41 d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name)
42 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
43 if os.path.exists(alt_wppath_dest):
44 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, alt_wppath)
45 f.close()
46
47 os.remove("busybox_wrapper")
48 return
49
50 if os.path.exists('%s/etc/busybox.links' % (dvar)):
51 create_sh_alternative_vars("/etc/busybox.links", "/bin/busybox", 0o0755)
52 else:
53 create_sh_alternative_vars("/etc/busybox.links.nosuid", "/bin/busybox.nosuid", 0o0755)
54 create_sh_alternative_vars("/etc/busybox.links.suid", "/bin/busybox.suid", 0o4755)
55}
56
57# Add to PACKAGEBUILDPKGD so it could override the alternatives, which are set in
58# do_package_prepend() section of busybox_*.bb.
59PACKAGEBUILDPKGD_prepend = "create_sh_wrapper_reset_alternative_vars "
60
61# Use sh wrappers instead of links
62pkg_postinst_${PN} () {
63 # This part of code is dedicated to the on target upgrade problem.
64 # It's known that if we don't make appropriate symlinks before update-alternatives calls,
65 # there will be errors indicating missing commands such as 'sed'.
66 # These symlinks will later be updated by update-alternatives calls.
67 test -n 2 > /dev/null || alias test='busybox test'
68 if test "x$D" = "x"; then
69 # Remove busybox.nosuid if it's a symlink, because this situation indicates
70 # that we're installing or upgrading to a one-binary busybox.
71 if test -h /bin/busybox.nosuid; then
72 rm -f /bin/busybox.nosuid
73 fi
74 for suffix in "" ".nosuid" ".suid"; do
75 if test -e /etc/busybox.links$suffix; then
76 while read link; do
77 if test ! -e "$link"; then
78 # we can use busybox here because even if we are using splitted busybox
79 # we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
80 busybox echo "#!/bin/busybox$suffix" > $link
81 fi
82 done < /etc/busybox.links$suffix
83 fi
84 done
85 fi
86}
87
diff --git a/recipes-core/busybox/busybox_selinux.inc b/recipes-core/busybox/busybox_selinux.inc
new file mode 100644
index 0000000..3f20815
--- /dev/null
+++ b/recipes-core/busybox/busybox_selinux.inc
@@ -0,0 +1,85 @@
1FILES_${PN} += "${libdir}/${PN}"
2
3# We should use sh wrappers instead of links so the commands could get correct
4# security labels
5python create_sh_wrapper_reset_alternative_vars () {
6 # We need to load the full set of busybox provides from the /etc/busybox.links
7 # Use this to see the update-alternatives with the right information
8
9 dvar = d.getVar('D', True)
10 pn = d.getVar('PN', True)
11
12 def create_sh_alternative_vars(links, target, mode):
13 import shutil
14 # Create sh wrapper template
15 fwp = open("busybox_wrapper", 'w')
16 fwp.write("#!%s" % (target))
17 os.fchmod(fwp.fileno(), mode)
18 fwp.close()
19 # Install the sh wrappers and alternatives reset to link to them
20 wpdir = os.path.join(d.getVar('libdir', True), pn)
21 wpdir_dest = '%s%s' % (dvar, wpdir)
22 if not os.path.exists(wpdir_dest):
23 os.makedirs(wpdir_dest)
24 f = open('%s%s' % (dvar, links), 'r')
25 for alt_link_name in f:
26 alt_link_name = alt_link_name.strip()
27 alt_name = os.path.basename(alt_link_name)
28 # Copy script wrapper to wp_path
29 alt_wppath = '%s%s' % (wpdir, alt_link_name)
30 alt_wppath_dest = '%s%s' % (wpdir_dest, alt_link_name)
31 alt_wpdir_dest = os.path.dirname(alt_wppath_dest)
32 if not os.path.exists(alt_wpdir_dest):
33 os.makedirs(alt_wpdir_dest)
34 shutil.copy2("busybox_wrapper", alt_wppath_dest)
35 # Re-set alternatives
36 # Match coreutils
37 if alt_name == '[':
38 alt_name = 'lbracket'
39 d.appendVar('ALTERNATIVE_%s' % (pn), ' ' + alt_name)
40 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, alt_link_name)
41 if os.path.exists(alt_wppath_dest):
42 d.setVarFlag('ALTERNATIVE_TARGET', alt_name, alt_wppath)
43 f.close()
44
45 os.remove("busybox_wrapper")
46 return
47
48 if os.path.exists('%s/etc/busybox.links' % (dvar)):
49 create_sh_alternative_vars("/etc/busybox.links", "/bin/busybox", 0o0755)
50 else:
51 create_sh_alternative_vars("/etc/busybox.links.nosuid", "/bin/busybox.nosuid", 0o0755)
52 create_sh_alternative_vars("/etc/busybox.links.suid", "/bin/busybox.suid", 0o4755)
53}
54
55# Add to PACKAGEBUILDPKGD so it could override the alternatives, which are set in
56# do_package_prepend() section of busybox_*.bb.
57PACKAGEBUILDPKGD_prepend = "create_sh_wrapper_reset_alternative_vars "
58
59# Use sh wrappers instead of links
60pkg_postinst_${PN} () {
61 # This part of code is dedicated to the on target upgrade problem.
62 # It's known that if we don't make appropriate symlinks before update-alternatives calls,
63 # there will be errors indicating missing commands such as 'sed'.
64 # These symlinks will later be updated by update-alternatives calls.
65 test -n 2 > /dev/null || alias test='busybox test'
66 if test "x$D" = "x"; then
67 # Remove busybox.nosuid if it's a symlink, because this situation indicates
68 # that we're installing or upgrading to a one-binary busybox.
69 if test -h /bin/busybox.nosuid; then
70 rm -f /bin/busybox.nosuid
71 fi
72 for suffix in "" ".nosuid" ".suid"; do
73 if test -e /etc/busybox.links$suffix; then
74 while read link; do
75 if test ! -e "$link"; then
76 # we can use busybox here because even if we are using splitted busybox
77 # we've made a symlink from /bin/busybox to /bin/busybox.nosuid.
78 busybox echo "#!/bin/busybox$suffix" > $link
79 fi
80 done < /etc/busybox.links$suffix
81 fi
82 done
83 fi
84}
85
diff --git a/recipes-core/coreutils/coreutils_%.bbappend b/recipes-core/coreutils/coreutils_%.bbappend
index c1e8ed6..7b9a2dc 100644
--- a/recipes-core/coreutils/coreutils_%.bbappend
+++ b/recipes-core/coreutils/coreutils_%.bbappend
@@ -1 +1,2 @@
1inherit with-selinux 1inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
2
diff --git a/recipes-core/dbus/dbus_%.bbappend b/recipes-core/dbus/dbus_%.bbappend
index 8c11cac..ee221e2 100644
--- a/recipes-core/dbus/dbus_%.bbappend
+++ b/recipes-core/dbus/dbus_%.bbappend
@@ -1 +1,2 @@
1inherit enable-selinux 1inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
2
diff --git a/recipes-core/eudev/eudev_%.bbappend b/recipes-core/eudev/eudev_%.bbappend
index e1e7cd1..b0b03ec 100644
--- a/recipes-core/eudev/eudev_%.bbappend
+++ b/recipes-core/eudev/eudev_%.bbappend
@@ -1,3 +1,2 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 1require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2 2
3inherit enable-selinux
diff --git a/recipes-core/eudev/eudev_selinux.inc b/recipes-core/eudev/eudev_selinux.inc
new file mode 100644
index 0000000..2ad6b13
--- /dev/null
+++ b/recipes-core/eudev/eudev_selinux.inc
@@ -0,0 +1,3 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3inherit enable-selinux
diff --git a/recipes-core/eudev/eudev/init b/recipes-core/eudev/files/init
index ee64f86..ee64f86 100644
--- a/recipes-core/eudev/eudev/init
+++ b/recipes-core/eudev/files/init
diff --git a/recipes-core/eudev/eudev/udev-cache b/recipes-core/eudev/files/udev-cache
index 6898577..6898577 100644
--- a/recipes-core/eudev/eudev/udev-cache
+++ b/recipes-core/eudev/files/udev-cache
diff --git a/recipes-core/glib-2.0/glib-2.0_%.bbappend b/recipes-core/glib-2.0/glib-2.0_%.bbappend
index 8c11cac..74e22b3 100644
--- a/recipes-core/glib-2.0/glib-2.0_%.bbappend
+++ b/recipes-core/glib-2.0/glib-2.0_%.bbappend
@@ -1 +1 @@
inherit enable-selinux inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
diff --git a/recipes-core/initscripts/initscripts/devpts.sh b/recipes-core/initscripts/files/devpts.sh
index a0b037f..a0b037f 100755
--- a/recipes-core/initscripts/initscripts/devpts.sh
+++ b/recipes-core/initscripts/files/devpts.sh
diff --git a/recipes-core/initscripts/initscripts-1.0_selinux.inc b/recipes-core/initscripts/initscripts-1.0_selinux.inc
new file mode 100644
index 0000000..6e8a9b6
--- /dev/null
+++ b/recipes-core/initscripts/initscripts-1.0_selinux.inc
@@ -0,0 +1,11 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3do_install_append () {
4 cat <<-EOF >> ${D}${sysconfdir}/init.d/populate-volatile.sh
5touch /var/log/lastlog
6test ! -x /sbin/restorecon || /sbin/restorecon -iRF /var/volatile/ /var/lib /run \
7 /etc/resolv.conf /etc/adjtime
8EOF
9 sed -i '/mount -n -o remount,$rootmode/i\test ! -x /sbin/restorecon || /sbin/restorecon -iRF /run' \
10 ${D}${sysconfdir}/init.d/checkroot.sh
11}
diff --git a/recipes-core/initscripts/initscripts_1.0.bbappend b/recipes-core/initscripts/initscripts_1.0.bbappend
index 0fc7a5e..4f9950b 100644
--- a/recipes-core/initscripts/initscripts_1.0.bbappend
+++ b/recipes-core/initscripts/initscripts_1.0.bbappend
@@ -1,13 +1 @@
1PR .= ".3" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'initscripts-1.0_selinux.inc', '', d)}
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
4
5do_install_append () {
6 cat <<-EOF >> ${D}${sysconfdir}/init.d/populate-volatile.sh
7touch /var/log/lastlog
8test ! -x /sbin/restorecon || /sbin/restorecon -iRF /var/volatile/ /var/lib /run \
9 /etc/resolv.conf /etc/adjtime
10EOF
11 sed -i '/mount -n -o remount,$rootmode/i\test ! -x /sbin/restorecon || /sbin/restorecon -iRF /run' \
12 ${D}${sysconfdir}/init.d/checkroot.sh
13}
diff --git a/recipes-core/libcgroup/libcgroup_%.bbappend b/recipes-core/libcgroup/libcgroup_%.bbappend
index b7e0c5f..7719d3b 100644
--- a/recipes-core/libcgroup/libcgroup_%.bbappend
+++ b/recipes-core/libcgroup/libcgroup_%.bbappend
@@ -1,12 +1 @@
1PR .= ".3" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3EXTRA_OECONF_virtclass-native = "--enable-pam=no"
4
5do_install_append() {
6 test ! -f ${D}${base_libdir}/security/pam_cgroup.so.0.0.0 || {
7 mv -f ${D}${base_libdir}/security/pam_cgroup.so.0.0.0 ${D}${base_libdir}/security/pam_cgroup.so
8 rm -f ${D}${base_libdir}/security/pam_cgroup.so.*
9 }
10}
11
12BBCLASSEXTEND = "native"
diff --git a/recipes-core/libcgroup/libcgroup_selinux.inc b/recipes-core/libcgroup/libcgroup_selinux.inc
new file mode 100644
index 0000000..f81188f
--- /dev/null
+++ b/recipes-core/libcgroup/libcgroup_selinux.inc
@@ -0,0 +1,10 @@
1EXTRA_OECONF_virtclass-native = "--enable-pam=no"
2
3do_install_append() {
4 test ! -f ${D}${base_libdir}/security/pam_cgroup.so.0.0.0 || {
5 mv -f ${D}${base_libdir}/security/pam_cgroup.so.0.0.0 ${D}${base_libdir}/security/pam_cgroup.so
6 rm -f ${D}${base_libdir}/security/pam_cgroup.so.*
7 }
8}
9
10BBCLASSEXTEND = "native"
diff --git a/recipes-core/systemd/systemd_%.bbappend b/recipes-core/systemd/systemd_%.bbappend
index f1bdaf8..5ac3adb 100644
--- a/recipes-core/systemd/systemd_%.bbappend
+++ b/recipes-core/systemd/systemd_%.bbappend
@@ -1 +1 @@
inherit enable-audit inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-audit', '', d)}
diff --git a/recipes-core/sysvinit/sysvinit-2.88dsf/sysvinit-fix-is_selinux_enabled.patch b/recipes-core/sysvinit/files/sysvinit-fix-is_selinux_enabled.patch
index 62703b1..62703b1 100644
--- a/recipes-core/sysvinit/sysvinit-2.88dsf/sysvinit-fix-is_selinux_enabled.patch
+++ b/recipes-core/sysvinit/files/sysvinit-fix-is_selinux_enabled.patch
diff --git a/recipes-core/sysvinit/sysvinit-2.88dsf_selinux.inc b/recipes-core/sysvinit/sysvinit-2.88dsf_selinux.inc
new file mode 100644
index 0000000..fcfbdb7
--- /dev/null
+++ b/recipes-core/sysvinit/sysvinit-2.88dsf_selinux.inc
@@ -0,0 +1,11 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3B = "${S}"
4
5SRC_URI += "file://sysvinit-fix-is_selinux_enabled.patch"
6
7inherit selinux
8
9DEPENDS += "${LIBSELINUX}"
10
11EXTRA_OEMAKE += "${@target_selinux(d, 'WITH_SELINUX=\"yes\"')}"
diff --git a/recipes-core/sysvinit/sysvinit_2.88dsf.bbappend b/recipes-core/sysvinit/sysvinit_2.88dsf.bbappend
index 636dc5e..9df30b6 100644
--- a/recipes-core/sysvinit/sysvinit_2.88dsf.bbappend
+++ b/recipes-core/sysvinit/sysvinit_2.88dsf.bbappend
@@ -1,14 +1 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'sysvinit-2.88dsf_selinux.inc', '', d)}
2
3B = "${S}"
4
5SRC_URI += "file://sysvinit-fix-is_selinux_enabled.patch"
6
7inherit selinux
8
9DEPENDS += "${LIBSELINUX}"
10
11EXTRA_OEMAKE += "${@target_selinux(d, 'WITH_SELINUX=\"yes\"')}"
12
13PR .= ".2"
14
diff --git a/recipes-core/util-linux/util-linux_%.bbappend b/recipes-core/util-linux/util-linux_%.bbappend
index 7695b77..b01ad25 100644
--- a/recipes-core/util-linux/util-linux_%.bbappend
+++ b/recipes-core/util-linux/util-linux_%.bbappend
@@ -1,3 +1 @@
1PR .= ".3" inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
2
3inherit with-selinux
diff --git a/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend b/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend
index 7acaf48..7719d3b 100644
--- a/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend
+++ b/recipes-devtools/e2fsprogs/e2fsprogs_%.bbappend
@@ -1,2 +1 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2SRC_URI += "file://misc_create_inode.c-label_rootfs.patch"
diff --git a/recipes-devtools/e2fsprogs/e2fsprogs_selinux.inc b/recipes-devtools/e2fsprogs/e2fsprogs_selinux.inc
new file mode 100644
index 0000000..9cbb7fe
--- /dev/null
+++ b/recipes-devtools/e2fsprogs/e2fsprogs_selinux.inc
@@ -0,0 +1,3 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3SRC_URI += "file://misc_create_inode.c-label_rootfs.patch"
diff --git a/recipes-devtools/e2fsprogs/e2fsprogs/lib-ext2fs-ext2_ext_attr.h-add-xattr-index.patch b/recipes-devtools/e2fsprogs/files/lib-ext2fs-ext2_ext_attr.h-add-xattr-index.patch
index b87c414..b87c414 100644
--- a/recipes-devtools/e2fsprogs/e2fsprogs/lib-ext2fs-ext2_ext_attr.h-add-xattr-index.patch
+++ b/recipes-devtools/e2fsprogs/files/lib-ext2fs-ext2_ext_attr.h-add-xattr-index.patch
diff --git a/recipes-devtools/e2fsprogs/e2fsprogs/misc_create_inode.c-label_rootfs.patch b/recipes-devtools/e2fsprogs/files/misc_create_inode.c-label_rootfs.patch
index 1de0dde..1de0dde 100644
--- a/recipes-devtools/e2fsprogs/e2fsprogs/misc_create_inode.c-label_rootfs.patch
+++ b/recipes-devtools/e2fsprogs/files/misc_create_inode.c-label_rootfs.patch
diff --git a/recipes-devtools/prelink/prelink_git.bbappend b/recipes-devtools/prelink/prelink_git.bbappend
index 366fdf5..74e22b3 100644
--- a/recipes-devtools/prelink/prelink_git.bbappend
+++ b/recipes-devtools/prelink/prelink_git.bbappend
@@ -1,3 +1 @@
1PR .= ".2" inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
2
3inherit enable-selinux
diff --git a/recipes-devtools/python/python/sitecustomize.py b/recipes-devtools/python/files/sitecustomize.py
index d2b71fa..d2b71fa 100644
--- a/recipes-devtools/python/python/sitecustomize.py
+++ b/recipes-devtools/python/files/sitecustomize.py
diff --git a/recipes-devtools/python/python_%.bbappend b/recipes-devtools/python/python_%.bbappend
index 9eefd2d..7719d3b 100644
--- a/recipes-devtools/python/python_%.bbappend
+++ b/recipes-devtools/python/python_%.bbappend
@@ -1,3 +1 @@
1inherit selinux require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2# If selinux enabled, disable handlers to rw command history file
3FILESEXTRAPATHS_prepend := "${@target_selinux(d, '${THISDIR}/${PN}:')}"
diff --git a/recipes-devtools/python/python_selinux.inc b/recipes-devtools/python/python_selinux.inc
new file mode 100644
index 0000000..bb54a90
--- /dev/null
+++ b/recipes-devtools/python/python_selinux.inc
@@ -0,0 +1,5 @@
1# If selinux enabled, disable handlers to rw command history file
2FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
3
4inherit selinux
5
diff --git a/recipes-devtools/rpm/rpm_%.bbappend b/recipes-devtools/rpm/rpm_%.bbappend
index 9f3ec90..7719d3b 100644
--- a/recipes-devtools/rpm/rpm_%.bbappend
+++ b/recipes-devtools/rpm/rpm_%.bbappend
@@ -1,4 +1 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3inherit with-selinux
4PACKAGECONFIG[selinux] = "${WITH_SELINUX},${WITHOUT_SELINUX},libsemanage,"
diff --git a/recipes-devtools/rpm/rpm_selinux.inc b/recipes-devtools/rpm/rpm_selinux.inc
new file mode 100644
index 0000000..983dda7
--- /dev/null
+++ b/recipes-devtools/rpm/rpm_selinux.inc
@@ -0,0 +1,2 @@
1inherit with-selinux
2PACKAGECONFIG[selinux] = "${WITH_SELINUX},${WITHOUT_SELINUX},libsemanage,"
diff --git a/recipes-extended/at/at_%.bbappend b/recipes-extended/at/at_%.bbappend
index c1e8ed6..b01ad25 100644
--- a/recipes-extended/at/at_%.bbappend
+++ b/recipes-extended/at/at_%.bbappend
@@ -1 +1 @@
inherit with-selinux inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
diff --git a/recipes-extended/cronie/cronie_%.bbappend b/recipes-extended/cronie/cronie_%.bbappend
index a398bec..cfa56ca 100644
--- a/recipes-extended/cronie/cronie_%.bbappend
+++ b/recipes-extended/cronie/cronie_%.bbappend
@@ -1,3 +1,2 @@
1PR .= ".2" 1inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-audit', '', d)}
2 2inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
3inherit with-selinux with-audit
diff --git a/recipes-extended/findutils/findutils_4.6.%.bbappend b/recipes-extended/findutils/findutils_4.6.%.bbappend
index a24a14f..b01ad25 100644
--- a/recipes-extended/findutils/findutils_4.6.%.bbappend
+++ b/recipes-extended/findutils/findutils_4.6.%.bbappend
@@ -1,2 +1 @@
1inherit with-selinux inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
2
diff --git a/recipes-extended/logrotate/logrotate_%.bbappend b/recipes-extended/logrotate/logrotate_%.bbappend
index 1bdca98..7719d3b 100644
--- a/recipes-extended/logrotate/logrotate_%.bbappend
+++ b/recipes-extended/logrotate/logrotate_%.bbappend
@@ -1,5 +1 @@
1inherit selinux require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3DEPENDS += "${LIBSELINUX}"
4
5EXTRA_OEMAKE += "${@target_selinux(d, 'WITH_SELINUX=\"yes\"')}"
diff --git a/recipes-extended/logrotate/logrotate_selinux.inc b/recipes-extended/logrotate/logrotate_selinux.inc
new file mode 100644
index 0000000..1bdca98
--- /dev/null
+++ b/recipes-extended/logrotate/logrotate_selinux.inc
@@ -0,0 +1,5 @@
1inherit selinux
2
3DEPENDS += "${LIBSELINUX}"
4
5EXTRA_OEMAKE += "${@target_selinux(d, 'WITH_SELINUX=\"yes\"')}"
diff --git a/recipes-extended/lsof/lsof_%.bbappend b/recipes-extended/lsof/lsof_%.bbappend
index 793b13f..7719d3b 100644
--- a/recipes-extended/lsof/lsof_%.bbappend
+++ b/recipes-extended/lsof/lsof_%.bbappend
@@ -1,16 +1 @@
1PR .= ".2" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3inherit selinux
4
5DEPENDS += "${LIBSELINUX}"
6
7do_configure_prepend () {
8 export LINUX_HASSELINUX="${@target_selinux(d, 'Y', 'N')}"
9 export LSOF_CFGF="${CFLAGS}"
10 export LSOF_CFGL="${LDFLAGS}"
11 export LSOF_CC="${BUILD_CC}"
12}
13
14do_compile () {
15 oe_runmake 'CC=${CC}' 'DEBUG='
16}
diff --git a/recipes-extended/lsof/lsof_selinux.inc b/recipes-extended/lsof/lsof_selinux.inc
new file mode 100644
index 0000000..6691b4c
--- /dev/null
+++ b/recipes-extended/lsof/lsof_selinux.inc
@@ -0,0 +1,14 @@
1inherit selinux
2
3DEPENDS += "${LIBSELINUX}"
4
5do_configure_prepend () {
6 export LINUX_HASSELINUX="${@target_selinux(d, 'Y', 'N')}"
7 export LSOF_CFGF="${CFLAGS}"
8 export LSOF_CFGL="${LDFLAGS}"
9 export LSOF_CC="${BUILD_CC}"
10}
11
12do_compile () {
13 oe_runmake 'CC=${CC}' 'DEBUG='
14}
diff --git a/recipes-extended/net-tools/net-tools/netstat-selinux-support.patch b/recipes-extended/net-tools/files/netstat-selinux-support.patch
index f089041..f089041 100644
--- a/recipes-extended/net-tools/net-tools/netstat-selinux-support.patch
+++ b/recipes-extended/net-tools/files/netstat-selinux-support.patch
diff --git a/recipes-extended/net-tools/net-tools_%.bbappend b/recipes-extended/net-tools/net-tools_%.bbappend
index e99a5bc..7719d3b 100644
--- a/recipes-extended/net-tools/net-tools_%.bbappend
+++ b/recipes-extended/net-tools/net-tools_%.bbappend
@@ -1,11 +1 @@
1PR .= ".2" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
4
5SRC_URI += "file://netstat-selinux-support.patch"
6
7inherit selinux
8
9DEPENDS += "${LIBSELINUX}"
10
11EXTRA_OEMAKE += "${@target_selinux(d, 'HAVE_SELINUX=1', 'HAVE_SELINUX=0')}"
diff --git a/recipes-extended/net-tools/net-tools_selinux.inc b/recipes-extended/net-tools/net-tools_selinux.inc
new file mode 100644
index 0000000..cc3196f
--- /dev/null
+++ b/recipes-extended/net-tools/net-tools_selinux.inc
@@ -0,0 +1,9 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3SRC_URI += "file://netstat-selinux-support.patch"
4
5inherit selinux
6
7DEPENDS += "${LIBSELINUX}"
8
9EXTRA_OEMAKE += "${@target_selinux(d, 'HAVE_SELINUX=1', 'HAVE_SELINUX=0')}"
diff --git a/recipes-extended/pam/libpam_%.bbappend b/recipes-extended/pam/libpam_%.bbappend
index adcf938..7719d3b 100644
--- a/recipes-extended/pam/libpam_%.bbappend
+++ b/recipes-extended/pam/libpam_%.bbappend
@@ -1,3 +1 @@
1inherit enable-selinux require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3RDEPENDS_${PN}-runtime += "${@target_selinux(d, 'pam-plugin-selinux')}"
diff --git a/recipes-extended/pam/libpam_selinux.inc b/recipes-extended/pam/libpam_selinux.inc
new file mode 100644
index 0000000..adcf938
--- /dev/null
+++ b/recipes-extended/pam/libpam_selinux.inc
@@ -0,0 +1,3 @@
1inherit enable-selinux
2
3RDEPENDS_${PN}-runtime += "${@target_selinux(d, 'pam-plugin-selinux')}"
diff --git a/recipes-extended/parted/parted_%.bbappend b/recipes-extended/parted/parted_%.bbappend
index 366fdf5..74e22b3 100644
--- a/recipes-extended/parted/parted_%.bbappend
+++ b/recipes-extended/parted/parted_%.bbappend
@@ -1,3 +1 @@
1PR .= ".2" inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
2
3inherit enable-selinux
diff --git a/recipes-extended/psmisc/psmisc_%.bbappend b/recipes-extended/psmisc/psmisc_%.bbappend
index bbb84f4..74e22b3 100644
--- a/recipes-extended/psmisc/psmisc_%.bbappend
+++ b/recipes-extended/psmisc/psmisc_%.bbappend
@@ -1,5 +1 @@
1PR .= ".2" inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
4
5inherit enable-selinux
diff --git a/recipes-extended/sed/sed_4.2.2.bbappend b/recipes-extended/sed/sed_4.2.2.bbappend
index 7695b77..b01ad25 100644
--- a/recipes-extended/sed/sed_4.2.2.bbappend
+++ b/recipes-extended/sed/sed_4.2.2.bbappend
@@ -1,3 +1 @@
1PR .= ".3" inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
2
3inherit with-selinux
diff --git a/recipes-extended/shadow/shadow_%.bbappend b/recipes-extended/shadow/shadow_%.bbappend
index b7ccf40..7719d3b 100644
--- a/recipes-extended/shadow/shadow_%.bbappend
+++ b/recipes-extended/shadow/shadow_%.bbappend
@@ -1,7 +1 @@
1PR .= ".1" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3inherit with-selinux with-audit
4
5PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage,"
6
7FILESEXTRAPATHS_prepend := "${@target_selinux(d, '${THISDIR}/files:')}"
diff --git a/recipes-extended/shadow/shadow_selinux.inc b/recipes-extended/shadow/shadow_selinux.inc
new file mode 100644
index 0000000..496ea6a
--- /dev/null
+++ b/recipes-extended/shadow/shadow_selinux.inc
@@ -0,0 +1,6 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3inherit with-selinux with-audit
4
5PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage,"
6
diff --git a/recipes-extended/sudo/sudo_%.bbappend b/recipes-extended/sudo/sudo_%.bbappend
index 5ad8973..b01ad25 100644
--- a/recipes-extended/sudo/sudo_%.bbappend
+++ b/recipes-extended/sudo/sudo_%.bbappend
@@ -1,3 +1 @@
1PR .= ".2" inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'with-selinux', '', d)}
2
3inherit with-selinux
diff --git a/recipes-extended/sysklogd/sysklogd_%.bbappend b/recipes-extended/sysklogd/sysklogd_%.bbappend
index 81fe7b7..7719d3b 100644
--- a/recipes-extended/sysklogd/sysklogd_%.bbappend
+++ b/recipes-extended/sysklogd/sysklogd_%.bbappend
@@ -1 +1 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
diff --git a/recipes-extended/sysklogd/sysklogd_selinux.inc b/recipes-extended/sysklogd/sysklogd_selinux.inc
new file mode 100644
index 0000000..81fe7b7
--- /dev/null
+++ b/recipes-extended/sysklogd/sysklogd_selinux.inc
@@ -0,0 +1 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
diff --git a/recipes-extended/tar/tar_%.bbappend b/recipes-extended/tar/tar_%.bbappend
index 4b48777..7719d3b 100644
--- a/recipes-extended/tar/tar_%.bbappend
+++ b/recipes-extended/tar/tar_%.bbappend
@@ -1,6 +1 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3inherit with-selinux
4
5
6PACKAGECONFIG += "${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)}"
diff --git a/recipes-extended/tar/tar_selinux.inc b/recipes-extended/tar/tar_selinux.inc
new file mode 100644
index 0000000..341df8b
--- /dev/null
+++ b/recipes-extended/tar/tar_selinux.inc
@@ -0,0 +1,3 @@
1inherit with-selinux
2
3PACKAGECONFIG_append = "${@bb.utils.contains('DISTRO_FEATURES', 'acl', ' acl', '', d)}"
diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend
index 0004f71..b0b03ec 100644
--- a/recipes-graphics/mesa/mesa_%.bbappend
+++ b/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,6 +1,2 @@
1inherit enable-selinux 1require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2 2
3# But wait! There's more! mesa builds a host program named builtin_compiler
4# and it needs selinux, too. We replace the PACKAGECONFIG[] in the bbclass.
5#
6PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux libselinux-native,"
diff --git a/recipes-graphics/mesa/mesa_selinux.inc b/recipes-graphics/mesa/mesa_selinux.inc
new file mode 100644
index 0000000..0004f71
--- /dev/null
+++ b/recipes-graphics/mesa/mesa_selinux.inc
@@ -0,0 +1,6 @@
1inherit enable-selinux
2
3# But wait! There's more! mesa builds a host program named builtin_compiler
4# and it needs selinux, too. We replace the PACKAGECONFIG[] in the bbclass.
5#
6PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux libselinux-native,"
diff --git a/recipes-graphics/xcb/libxcb_%.bbappend b/recipes-graphics/xcb/libxcb_%.bbappend
index f1bd5a8..7719d3b 100644
--- a/recipes-graphics/xcb/libxcb_%.bbappend
+++ b/recipes-graphics/xcb/libxcb_%.bbappend
@@ -1,8 +1 @@
1PR .= ".1" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3inherit enable-selinux
4# libxcb-xselinux will not build with libselinux, so remove the depend
5PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,,"
6
7PACKAGES += "${PN}-xselinux"
8FILES_${PN}-xselinux += "${libdir}/libxcb-xselinux.so.*"
diff --git a/recipes-graphics/xcb/libxcb_selinux.inc b/recipes-graphics/xcb/libxcb_selinux.inc
new file mode 100644
index 0000000..29bdadb
--- /dev/null
+++ b/recipes-graphics/xcb/libxcb_selinux.inc
@@ -0,0 +1,6 @@
1inherit enable-selinux
2# libxcb-xselinux will not build with libselinux, so remove the depend
3PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,,"
4
5PACKAGES += "${PN}-xselinux"
6FILES_${PN}-xselinux += "${libdir}/libxcb-xselinux.so.*"
diff --git a/recipes-kernel/linux/linux-yocto/selinux.cfg b/recipes-kernel/linux/files/selinux.cfg
index 2edd366..2edd366 100644
--- a/recipes-kernel/linux/linux-yocto/selinux.cfg
+++ b/recipes-kernel/linux/files/selinux.cfg
diff --git a/recipes-kernel/linux/linux-yocto_4.%.bbappend b/recipes-kernel/linux/linux-yocto_4.%.bbappend
index a8c0647..7719d3b 100644
--- a/recipes-kernel/linux/linux-yocto_4.%.bbappend
+++ b/recipes-kernel/linux/linux-yocto_4.%.bbappend
@@ -1,8 +1 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3# Enable selinux support in the kernel if the feature is enabled
4SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'file://selinux.cfg', '', d)}"
5
6# For inconsistent kallsyms data bug on ARM
7# http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/thread.html#89718
8EXTRA_OEMAKE += "${@bb.utils.contains('TARGET_ARCH', 'arm', ' KALLSYMS_EXTRA_PASS=1', '', d)}"
diff --git a/recipes-kernel/linux/linux-yocto_selinux.inc b/recipes-kernel/linux/linux-yocto_selinux.inc
new file mode 100644
index 0000000..3312e06
--- /dev/null
+++ b/recipes-kernel/linux/linux-yocto_selinux.inc
@@ -0,0 +1,4 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
2
3# Enable selinux support in the kernel if the feature is enabled
4SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'file://selinux.cfg', '', d)}"
diff --git a/recipes-kernel/perf/perf.bbappend b/recipes-kernel/perf/perf.bbappend
index 93df43e..b0b03ec 100644
--- a/recipes-kernel/perf/perf.bbappend
+++ b/recipes-kernel/perf/perf.bbappend
@@ -1 +1,2 @@
1DEPENDS += " ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'audit', '', d)}" 1require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
diff --git a/recipes-kernel/perf/perf_selinux.inc b/recipes-kernel/perf/perf_selinux.inc
new file mode 100644
index 0000000..bed3cc2
--- /dev/null
+++ b/recipes-kernel/perf/perf_selinux.inc
@@ -0,0 +1 @@
DEPENDS .= "${@bb.utils.contains('DISTRO_FEATURES', 'selinux', ' audit', '', d)}"
diff --git a/recipes-support/attr/attr_%.bbappend b/recipes-support/attr/attr_%.bbappend
index 6be8191..7719d3b 100644
--- a/recipes-support/attr/attr_%.bbappend
+++ b/recipes-support/attr/attr_%.bbappend
@@ -1,5 +1 @@
1inherit selinux require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
4
5SRC_URI += "${@target_selinux(d, 'file://fix-ptest-failures-when-selinux-enabled.patch')}"
diff --git a/recipes-support/attr/attr_selinux.inc b/recipes-support/attr/attr_selinux.inc
new file mode 100644
index 0000000..ba0314e
--- /dev/null
+++ b/recipes-support/attr/attr_selinux.inc
@@ -0,0 +1,5 @@
1inherit selinux
2
3FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
4
5SRC_URI += "file://fix-ptest-failures-when-selinux-enabled.patch"
diff --git a/recipes-support/attr/attr/fix-ptest-failures-when-selinux-enabled.patch b/recipes-support/attr/files/fix-ptest-failures-when-selinux-enabled.patch
index e1eefa7..e1eefa7 100644
--- a/recipes-support/attr/attr/fix-ptest-failures-when-selinux-enabled.patch
+++ b/recipes-support/attr/files/fix-ptest-failures-when-selinux-enabled.patch
diff --git a/recipes-support/gnupg/gnupg_2.%.bbappend b/recipes-support/gnupg/gnupg_2.%.bbappend
index 12571b4..7719d3b 100644
--- a/recipes-support/gnupg/gnupg_2.%.bbappend
+++ b/recipes-support/gnupg/gnupg_2.%.bbappend
@@ -1,3 +1 @@
1inherit enable-selinux require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2# gnupg will not build with libselinux, so remove the depend
3PACKAGECONFIG[selinux] = "--enable-selinux-support,--disable-selinux-support,,"
diff --git a/recipes-support/gnupg/gnupg_selinux.inc b/recipes-support/gnupg/gnupg_selinux.inc
new file mode 100644
index 0000000..12571b4
--- /dev/null
+++ b/recipes-support/gnupg/gnupg_selinux.inc
@@ -0,0 +1,3 @@
1inherit enable-selinux
2# gnupg will not build with libselinux, so remove the depend
3PACKAGECONFIG[selinux] = "--enable-selinux-support,--disable-selinux-support,,"
diff --git a/recipes-support/libpcre/libpcre_%.bbappend b/recipes-support/libpcre/libpcre_%.bbappend
index ad18d61..7719d3b 100644
--- a/recipes-support/libpcre/libpcre_%.bbappend
+++ b/recipes-support/libpcre/libpcre_%.bbappend
@@ -1,14 +1 @@
1PR .= "9" require ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${BPN}_selinux.inc', '', d)}
2
3do_install_append () {
4 if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
5 realsofile=`readlink ${D}${libdir}/libpcre.so`
6 mkdir -p ${D}/${base_libdir}/
7 mv -f ${D}${libdir}/libpcre.so.* ${D}${base_libdir}/
8 relpath=${@os.path.relpath("${base_libdir}", "${libdir}")}
9 ln -sf ${relpath}/${realsofile} ${D}${libdir}/libpcre.so
10 ln -sf ${relpath}/${realsofile} ${D}${libdir}/libpcre.so.1
11 fi
12}
13
14FILES_${PN} += "${base_libdir}/libpcre.so.*"
diff --git a/recipes-support/libpcre/libpcre_selinux.inc b/recipes-support/libpcre/libpcre_selinux.inc
new file mode 100644
index 0000000..59c0184
--- /dev/null
+++ b/recipes-support/libpcre/libpcre_selinux.inc
@@ -0,0 +1,12 @@
1do_install_append () {
2 if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
3 realsofile=`readlink ${D}${libdir}/libpcre.so`
4 mkdir -p ${D}/${base_libdir}/
5 mv -f ${D}${libdir}/libpcre.so.* ${D}${base_libdir}/
6 relpath=${@os.path.relpath("${base_libdir}", "${libdir}")}
7 ln -sf ${relpath}/${realsofile} ${D}${libdir}/libpcre.so
8 ln -sf ${relpath}/${realsofile} ${D}${libdir}/libpcre.so.1
9 fi
10}
11
12FILES_${PN} += "${base_libdir}/libpcre.so.*"
diff --git a/virtualization-layer/recipes-containers/lxc/lxc_%.bbappend b/virtualization-layer/recipes-containers/lxc/lxc_%.bbappend
index 8c11cac..74e22b3 100644
--- a/virtualization-layer/recipes-containers/lxc/lxc_%.bbappend
+++ b/virtualization-layer/recipes-containers/lxc/lxc_%.bbappend
@@ -1 +1 @@
inherit enable-selinux inherit ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'enable-selinux', '', d)}