Convert to new override syntax
[AGL/meta-agl.git] / meta-app-framework / recipes-security / security-manager / security-manager.inc
1 DESCRIPTION = "Security manager and utilities"
2 LICENSE = "Apache-2.0"
3 LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327;beginline=3"
4
5 inherit cmake
6
7 B = "${S}"
8
9 DEPENDS = " \
10    attr \
11    boost \
12    cynara \
13    icu \
14    libcap \
15    smack \
16    sqlite3 \
17    systemd \
18 "
19
20 PACKAGECONFIG ??= ""
21 PACKAGECONFIG[debug] = "-DCMAKE_BUILD_TYPE=DEBUG,-DCMAKE_BUILD_TYPE=RELEASE"
22
23 TZ_SYS_DB ?= "/var/db/security-manager"
24
25 EXTRA_OECMAKE = " \
26    -DCMAKE_VERBOSE_MAKEFILE=ON \
27    -DVERSION=${PV} \
28    -DSYSTEMD_INSTALL_DIR=${systemd_unitdir}/system \
29    -DBIN_INSTALL_DIR=${bindir} \
30    -DDB_INSTALL_DIR=${TZ_SYS_DB} \
31    -DLIB_INSTALL_DIR=${libdir} \
32    -DSHARE_INSTALL_PREFIX=${datadir} \
33    -DINCLUDE_INSTALL_DIR=${includedir} \
34 "
35
36 inherit systemd
37 SYSTEMD_SERVICE:${PN} = "security-manager.service"
38
39 inherit features_check
40 REQUIRED_DISTRO_FEATURES += "smack"
41
42 # The upstream source code contains the Tizen-specific policy configuration files.
43 # To replace them, create a security-manager.bbappend and set the following variable to a
44 # space-separated list of policy file names (not URIs!), for example:
45 # SECURITY_MANAGER_POLICY = "privilege-group.list usertype-system.profile"
46 #
47 # Leave it empty to use the upstream Tizen policy.
48 SECURITY_MANAGER_POLICY ?= ""
49 SRC_URI:append = " ${@' '.join(['file://' + x for x in d.getVar('SECURITY_MANAGER_POLICY', True).split()])}"
50 python do_patch:append () {
51     import os
52     import shutil
53     import glob
54     files = d.getVar('SECURITY_MANAGER_POLICY', True).split()
55     if files:
56         s = d.getVar('S', True)
57         workdir = d.getVar('WORKDIR', True)
58         for pattern in ['*.profile', '*.list']:
59             for old_file in glob.glob(s + '/policy/' + pattern):
60                 os.unlink(old_file)
61         for file in files:
62             shutil.copy(file, s + '/policy')
63 }
64
65 do_install:append () {
66    install -d ${D}/${systemd_unitdir}/system/multi-user.target.wants
67    ln -s ../security-manager.service ${D}/${systemd_unitdir}/system/multi-user.target.wants/security-manager.service
68    install -d ${D}/${systemd_unitdir}/system/sockets.target.wants
69    ln -s ../security-manager.socket ${D}/${systemd_unitdir}/system/sockets.target.wants/security-manager.socket
70 }
71
72 RDEPENDS:${PN} += "sqlite3 cynara"
73 FILES:${PN} += " \
74    ${systemd_unitdir} \
75    ${TZ_SYS_DB} \
76    ${bindir}/.security-manager-setup \
77 "
78
79 PACKAGES =+ "${PN}-policy"
80 FILES:${PN}-policy = " \
81    ${datadir}/${PN} \
82    ${bindir}/security-manager-policy-reload \
83 "