Adding script for early rules loading
authorZofia Abramowska <z.abramowska@samsung.com>
Fri, 21 Jun 2013 09:38:32 +0000 (11:38 +0200)
committerJanusz Kozerski <j.kozerski@samsung.com>
Mon, 8 Jul 2013 10:03:33 +0000 (12:03 +0200)
[Issue#] SSDWSSP-216
[Feature] Adding script and binary for early rules loading (for
applications needed by livebox)
[Cause] Some applications need to be properly loaded with
livebox
[Solution] Added script and binary which loades rules from early
rules directory
[Verification] this commit depends on
http://slp-info.sec.samsung.net/gerrit/#/c/224189/
when it will be merged livebox should start properly on target

Change-Id: I6ae711d10d90a9f8537b7c514db9cbbaa7bb49db

packaging/libprivilege-control.spec
rule_loader/CMakeLists.txt
rule_loader/load_rules.sh [deleted file]
rule_loader/smack-early-rules.service [new file with mode: 0644]
rule_loader/smack-late-rules.service [new file with mode: 0644]

index 706951c..294bb75 100644 (file)
@@ -60,21 +60,17 @@ mv %{buildroot}/opt/etc/group %{buildroot}/etc/group
 cp -a %{SOURCE1} %{buildroot}%{_datadir}/
 cp -a %{SOURCE2} %{buildroot}%{_datadir}/
 
-install -D -d %{buildroot}/etc/rc.d/rc3.d/
-install -D -d %{buildroot}/etc/rc.d/rc4.d/
-
-ln -sf ../init.d/smack_default_labeling %{buildroot}/etc/rc.d/rc3.d/S45smack_default_labeling
-ln -sf ../init.d/smack_default_labeling %{buildroot}/etc/rc.d/rc4.d/S45smack_default_labeling
-ln -sf ../init.d/smack_rules %{buildroot}/etc/rc.d/rc3.d/S02smack_rules
-ln -sf ../init.d/smack_rules %{buildroot}/etc/rc.d/rc4.d/S02smack_rules
-
-mkdir -p %{buildroot}/etc/rc.d/sdrc.d
-ln -sf /etc/init.d/load_rules.sh %{buildroot}/etc/rc.d/sdrc.d/S99load_rules
-
 mkdir -p %{buildroot}/usr/lib/systemd/system/basic.target.wants
 install -m 644 %{SOURCE2} %{buildroot}/usr/lib/systemd/system/
 ln -s ../smack-default-labeling.service %{buildroot}/usr/lib/systemd/system/basic.target.wants/
 
+mkdir -p %{buildroot}/usr/lib/systemd/system/multi-user.target.wants
+ln -sf /usr/lib/systemd/system/smack-late-rules.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/smack-late-rules.service
+ln -sf /usr/lib/systemd/system/smack-early-rules.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/smack-early-rules.service
+
+mkdir -p %{buildroot}/usr/lib/systemd/system/tizen-runtime.target.wants
+ln -s /usr/lib/systemd/system/smack-default-labeling.service %{buildroot}/usr/lib/systemd/system/multi-user.target.wants/smack-default-labeling.service
+
 %post
 if [ ! -e "/home/app" ]
 then
@@ -108,9 +104,13 @@ fi
 #%{udev_libdir}/rules.d/*
 #%attr(755,root,root) %{udev_libdir}/uname_env
 %{_datadir}/license/%{name}
-/etc/init.d/load_rules.sh
+#systemd service
+/usr/lib/systemd/system/smack-late-rules.service
+/usr/lib/systemd/system/smack-early-rules.service
 /usr/bin/rule_loader
-/etc/rc.d/sdrc.d/S99load_rules
+#link to activate systemd service
+/usr/lib/systemd/system/multi-user.target.wants/smack-late-rules.service
+/usr/lib/systemd/system/multi-user.target.wants/smack-early-rules.service
 
 %files conf
 /etc/group
@@ -119,6 +119,7 @@ fi
 /usr/share/smack-default-labeling.service
 /usr/lib/systemd/system/smack-default-labeling.service
 /usr/lib/systemd/system/basic.target.wants/smack-default-labeling.service
+/usr/lib/systemd/system/multi-user.target.wants/smack-default-labeling.service
 %manifest %{_datadir}/%{name}-conf.manifest
 /opt/dbspace/.privilege_control*.db
 
index 93ac71b..18e3867 100644 (file)
@@ -61,10 +61,19 @@ INSTALL(TARGETS ${TARGET}
     OWNER_EXECUTE
     )
 
-#place for additional script
+#place for additional systemd service
 INSTALL(FILES
-    ${PROJECT_SOURCE_DIR}/rule_loader/load_rules.sh
-    DESTINATION /etc/init.d
+    ${PROJECT_SOURCE_DIR}/rule_loader/smack-late-rules.service
+    DESTINATION /usr/lib/systemd/system
+    PERMISSIONS
+    OWNER_READ
+    OWNER_WRITE
+    OWNER_EXECUTE
+    )
+
+INSTALL(FILES
+    ${PROJECT_SOURCE_DIR}/rule_loader/smack-early-rules.service
+    DESTINATION /usr/lib/systemd/system
     PERMISSIONS
     OWNER_READ
     OWNER_WRITE
diff --git a/rule_loader/load_rules.sh b/rule_loader/load_rules.sh
deleted file mode 100644 (file)
index 7149ba7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#/bin/bash
-
-#load rules of all installed apps
-/usr/bin/rule_loader &
diff --git a/rule_loader/smack-early-rules.service b/rule_loader/smack-early-rules.service
new file mode 100644 (file)
index 0000000..ef4decb
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Late SMACK rules loading
+Before=starter.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/smackload /opt/etc/smack-app-early/accesses.d
+
+[Install]
+WantedBy=multi-user.target
diff --git a/rule_loader/smack-late-rules.service b/rule_loader/smack-late-rules.service
new file mode 100644 (file)
index 0000000..6796bfd
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Late SMACK rules loading
+After=starter.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/rule_loader
+
+[Install]
+WantedBy=multi-user.target