Invoke systemd operation on installation and removal 04/135204/1
authorHyeongsik Min <hyeongsik.min@samsung.com>
Wed, 21 Jun 2017 07:21:44 +0000 (16:21 +0900)
committerHyeongsik Min <hyeongsik.min@samsung.com>
Wed, 21 Jun 2017 07:25:15 +0000 (16:25 +0900)
Change-Id: Id3913e75679127586d9a38941b918c40d7979b81
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
packaging/peripheral-bus.spec

index 48039ac..489c6b6 100644 (file)
@@ -35,9 +35,24 @@ mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
 install -m 0644 %SOURCE2 %{buildroot}%{_unitdir}/peripheral-bus.service
 %install_service multi-user.target.wants peripheral-bus.service
 
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
+%post
+systemctl daemon-reload
+if [ $1 == 1 ]; then
+       # install
+       systemctl start %{name}.service
+elif [ $1 == 2 ]; then
+       # upgrade
+       systemctl restart %{name}.service
+fi
+
+%preun
+if [ $1 == 0 ]; then
+       # uninstall
+       systemctl stop %{name}.service
+fi
+
+%postun
+systemctl daemon-reload
 
 %files
 %manifest %{name}.manifest