Start TEF simulator on install 43/171843/6
authorLukasz Kostyra <l.kostyra@samsung.com>
Wed, 7 Mar 2018 14:51:39 +0000 (15:51 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 26 Mar 2018 09:01:49 +0000 (09:01 +0000)
Change-Id: Iab1da43900b7077921c77d2852a0f4354e17b39d
Signed-off-by: Lukasz Kostyra <l.kostyra@samsung.com>
packaging/tef-simulator.spec

index 8cab70e..ce39efe 100644 (file)
@@ -105,20 +105,34 @@ cp rapidxml/license.txt LICENSE.MIT
 cp include/include/LICENSE LICENSE.BSD
 
 %pre
+if [ $1 -gt 1 ] ; then
+    systemctl stop tef-simulator.socket
+    systemctl stop tef-simulator.service
+fi
 
 %post
-systemctl stop tef-simulator
-rm -rf %{link_tastore_dir}
-mkdir -p `dirname %{link_tastore_dir}`
-ln -sf %{tastore_dir} %{link_tastore_dir}
-tef-update.sh simulator
-systemctl enable tef-simulator
+if [ $1 -eq 1 ] ; then
+    rm -rf %{link_tastore_dir}
+    mkdir -p `dirname %{link_tastore_dir}`
+    ln -sf %{tastore_dir} %{link_tastore_dir}
+    tef-update.sh simulator
+fi
+
+systemctl daemon-reload
+systemctl enable tef-simulator.socket
+systemctl start tef-simulator.socket
 
 %preun
+if [ $1 -eq 0 ] ; then
+    systemctl stop tef-simulator.socket
+    systemctl stop tef-simulator.service
+    systemctl disable tef-simulator.socket
+fi
 
 %postun
-if [ $1 = 0 ] ; then
+if [ $1 -eq 0 ] ; then
     tef-update.sh
+    systemctl daemon-reload
 fi
 
 %files -n %{name}