From b493530bffebef2c2887228304cb5e738abb9d29 Mon Sep 17 00:00:00 2001 From: Xin Ouyang Date: Fri, 4 Jan 2013 18:26:47 +0800 Subject: layer: add selinux/audit bbclasses Add bbclasses only for target packages to enable selinux support, not native/nativesdk/cross/crosssdk pacakges. Signed-off-by: Xin Ouyang --- classes/enable-audit.bbclass | 5 +++++ classes/enable-selinux.bbclass | 4 ++++ classes/selinux.bbclass | 12 ++++++++++++ classes/with-audit.bbclass | 5 +++++ classes/with-selinux.bbclass | 4 ++++ 5 files changed, 30 insertions(+) create mode 100644 classes/enable-audit.bbclass create mode 100644 classes/enable-selinux.bbclass create mode 100644 classes/selinux.bbclass create mode 100644 classes/with-audit.bbclass create mode 100644 classes/with-selinux.bbclass diff --git a/classes/enable-audit.bbclass b/classes/enable-audit.bbclass new file mode 100644 index 0000000..5820a38 --- /dev/null +++ b/classes/enable-audit.bbclass @@ -0,0 +1,5 @@ +# There is still no audit DISTRO_FEATURE, so enable audit when selinux feature enabled. +inherit selinux + +PACKAGECONFIG_append = " ${@target_selinux(d, 'audit')}" +PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit," diff --git a/classes/enable-selinux.bbclass b/classes/enable-selinux.bbclass new file mode 100644 index 0000000..de2a124 --- /dev/null +++ b/classes/enable-selinux.bbclass @@ -0,0 +1,4 @@ +inherit selinux + +PACKAGECONFIG_append = " ${@target_selinux(d)}" +PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux," diff --git a/classes/selinux.bbclass b/classes/selinux.bbclass new file mode 100644 index 0000000..87d4d59 --- /dev/null +++ b/classes/selinux.bbclass @@ -0,0 +1,12 @@ +def target_selinux(d, truevar = 'selinux', falsevar = ''): + if not base_contains("DISTRO_FEATURES", "selinux", True, False, d): + return falsevar + + pn = d.getVar("PN", True) + type = pn.replace(d.getVar("BPN", True), "") + if type in ("-native", "-nativesdk", "-cross", "-crosssdk"): + return falsevar + + return truevar + +LIBSELINUX = "${@target_selinux(d, 'libselinux')}" diff --git a/classes/with-audit.bbclass b/classes/with-audit.bbclass new file mode 100644 index 0000000..0c15312 --- /dev/null +++ b/classes/with-audit.bbclass @@ -0,0 +1,5 @@ +# There is still no audit DISTRO_FEATURE, so enable audit when selinux feature enabled. +inherit selinux + +PACKAGECONFIG_append = " ${@target_selinux(d, 'audit')}" +PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit," diff --git a/classes/with-selinux.bbclass b/classes/with-selinux.bbclass new file mode 100644 index 0000000..7873d9b --- /dev/null +++ b/classes/with-selinux.bbclass @@ -0,0 +1,4 @@ +inherit selinux + +PACKAGECONFIG_append = " ${@target_selinux(d)}" +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux," -- cgit v1.2.3-54-g00ecf