summaryrefslogtreecommitdiffstats
path: root/meta-app-framework/recipes-core/af-main
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2016-12-14 18:24:09 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2016-12-14 18:24:09 +0000
commit6bcddb9900436c82b08039fa97de9bb057810c4e (patch)
treefb578d47ca75f50352b72f83f314091a98fe47d2 /meta-app-framework/recipes-core/af-main
parentb6960b346e4efc0f74a0618744d4decc05358258 (diff)
parent524e55787139d2eb728106871499023daa95aba6 (diff)
Merge "Move all writable data used by security-manager and appfw to /var"
Diffstat (limited to 'meta-app-framework/recipes-core/af-main')
-rw-r--r--meta-app-framework/recipes-core/af-main/af-main/init-afm-dirs.service15
-rw-r--r--meta-app-framework/recipes-core/af-main/af-main/init-afm-dirs.sh7
-rw-r--r--meta-app-framework/recipes-core/af-main/af-main_1.0.bb22
-rw-r--r--meta-app-framework/recipes-core/af-main/nativesdk-af-main_1.0.bb2
4 files changed, 39 insertions, 7 deletions
diff --git a/meta-app-framework/recipes-core/af-main/af-main/init-afm-dirs.service b/meta-app-framework/recipes-core/af-main/af-main/init-afm-dirs.service
new file mode 100644
index 0000000..7e3b9e4
--- /dev/null
+++ b/meta-app-framework/recipes-core/af-main/af-main/init-afm-dirs.service
@@ -0,0 +1,15 @@
+#
+# Install security-manager DB to /var
+
+[Unit]
+Description=Deploy AFM directories to /var
+After=sysinit.target
+Before=afm-system-daemon.service
+Before=afm-user-daemon.service
+
+[Install]
+WantedBy=default.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/init-afm-dirs.sh
diff --git a/meta-app-framework/recipes-core/af-main/af-main/init-afm-dirs.sh b/meta-app-framework/recipes-core/af-main/af-main/init-afm-dirs.sh
new file mode 100644
index 0000000..97cf272
--- /dev/null
+++ b/meta-app-framework/recipes-core/af-main/af-main/init-afm-dirs.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ ! -e "/var/lib/afm" ]; then
+ mkdir -p /var/lib
+ cp -ra /usr/share/afm /var/lib
+fi
+
diff --git a/meta-app-framework/recipes-core/af-main/af-main_1.0.bb b/meta-app-framework/recipes-core/af-main/af-main_1.0.bb
index 611307f..834e293 100644
--- a/meta-app-framework/recipes-core/af-main/af-main_1.0.bb
+++ b/meta-app-framework/recipes-core/af-main/af-main_1.0.bb
@@ -16,7 +16,8 @@ DEPENDS_class-native = "openssl libxml2 xmlsec1 libzip"
afm_name = "afm"
afm_confdir = "${sysconfdir}/${afm_name}"
-afm_datadir = "${datadir}/${afm_name}"
+afm_datadir = "/var/lib/${afm_name}"
+afm_init_datadir = "${datadir}/${afm_name}"
afb_binding_dir = "${libdir}/afb"
EXTRA_OECMAKE_class-native = "\
@@ -46,8 +47,12 @@ GROUPADD_PARAM_${PN} = "-r ${afm_name}"
SYSTEMD_SERVICE_${PN} = "afm-system-daemon.service"
SYSTEMD_AUTO_ENABLE = "enable"
+SRC_URI_append = "file://init-afm-dirs.sh \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://init-afm-dirs.service', '', d)}"
+
FILES_${PN} += "\
- ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/afm-user-daemon.service', '', d)} \
+ ${bindir}/init-afm-dirs.sh \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/afm-user-daemon.service ${systemd_unitdir}/system/init-afm-dirs.service', '', d)} \
"
RDEPENDS_${PN}_append_smack = " smack-userspace"
@@ -60,9 +65,14 @@ SRC_URI += "\
"
do_install_append() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/init-afm-dirs.sh ${D}${bindir}
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
mkdir -p ${D}${sysconfdir}/systemd/user/default.target.wants
+ mkdir -p ${D}${sysconfdir}/systemd/system/default.target.wants
ln -sf ${systemd_user_unitdir}/afm-user-daemon.service ${D}${sysconfdir}/systemd/user/default.target.wants
+ install -p -D ${WORKDIR}/init-afm-dirs.service ${D}${systemd_unitdir}/system/init-afm-dirs.service
+ ln -sf ${systemd_unitdir}/system/init-afm-dirs.service ${D}${sysconfdir}/systemd/system/default.target.wants
fi
}
@@ -79,15 +89,15 @@ EOF
}
pkg_postinst_${PN}() {
- mkdir -p $D${afm_datadir}/applications $D${afm_datadir}/icons
+ mkdir -p $D${afm_init_datadir}/applications $D${afm_init_datadir}/icons
setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
setcap cap_mac_override,cap_mac_admin,cap_setgid=ep $D${bindir}/afm-user-daemon
}
pkg_postinst_${PN}_smack() {
- mkdir -p $D${afm_datadir}/applications $D${afm_datadir}/icons
- chown ${afm_name}:${afm_name} $D${afm_datadir} $D${afm_datadir}/applications $D${afm_datadir}/icons
- chsmack -a 'System::Shared' -t $D${afm_datadir} $D${afm_datadir}/applications $D${afm_datadir}/icons
+ mkdir -p $D${afm_init_datadir}/applications $D${afm_init_datadir}/icons
+ chown ${afm_name}:${afm_name} $D${afm_init_datadir} $D${afm_init_datadir}/applications $D${afm_init_datadir}/icons
+ chsmack -a 'System::Shared' -t $D${afm_init_datadir} $D${afm_init_datadir}/applications $D${afm_init_datadir}/icons
setcap cap_mac_override,cap_dac_override=ep $D${bindir}/afm-system-daemon
setcap cap_mac_override,cap_mac_admin,cap_setgid=ep $D${bindir}/afm-user-daemon
}
diff --git a/meta-app-framework/recipes-core/af-main/nativesdk-af-main_1.0.bb b/meta-app-framework/recipes-core/af-main/nativesdk-af-main_1.0.bb
index 0169e6b..ba70c59 100644
--- a/meta-app-framework/recipes-core/af-main/nativesdk-af-main_1.0.bb
+++ b/meta-app-framework/recipes-core/af-main/nativesdk-af-main_1.0.bb
@@ -8,7 +8,7 @@ DEPENDS = "nativesdk-openssl nativesdk-libxml2 nativesdk-xmlsec1 nativesdk-libzi
afm_name = "afm"
afm_confdir = "${sysconfdir}/${afm_name}"
-afm_datadir = "${datadir}/${afm_name}"
+afm_datadir = "/var/lib/${afm_name}"
EXTRA_OECMAKE = "\
-DUSE_LIBZIP=1 \