[SPEC] fix for error while uninstalling webapi-plugins on emulator 61/166061/4
authorLukasz Bardeli <l.bardeli@samsung.com>
Fri, 5 Jan 2018 12:42:13 +0000 (13:42 +0100)
committerLukasz Bardeli <l.bardeli@samsung.com>
Fri, 5 Jan 2018 12:42:13 +0000 (13:42 +0100)
On emulator there are two packages webapi-plugins-<profile>-extension-emulator and
webapi-plugins-profile_<profile>. Uninstalling one of them causes error
rm: cannot remove `/usr/lib/tizen-extensions-crosswalk/libtizen*.so': No such file or directory
rm: cannot remove `/usr/lib/tizen-extensions-crosswalk/plugins.json': No such file or directory
That's why it is needed to be check if file exists before remove

Change-Id: I25cf8d854a019637bcd05a3c686d86f4020a1cc2
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
packaging/webapi-plugins.spec

index 0ff1d17..77d8911 100644 (file)
@@ -1266,8 +1266,12 @@ ln -sf %{crosswalk_extensions_path}/mobile/* %{crosswalk_extensions_path}
 %preun profile_mobile
 # This is an un-installation.
 if [ "$1" == "0" ]; then
-  rm %{crosswalk_extensions_path}/libtizen*.so
-  rm %{crosswalk_extensions_path}/plugins.json
+  if [ -n "$(ls %{crosswalk_extensions_path}/ | grep libtizen*.so)" ]; then
+    rm %{crosswalk_extensions_path}/libtizen*.so
+  fi
+  if [ -f %{crosswalk_extensions_path}/plugins.json ]; then
+    rm %{crosswalk_extensions_path}/plugins.json
+  fi
 fi
 %files profile_mobile
 %dir %{crosswalk_extensions_path}/mobile/
@@ -1282,8 +1286,12 @@ ln -sf %{crosswalk_extensions_path}/mobile_emulator/* %{crosswalk_extensions_pat
 %preun mobile-extension-emulator
 # This is an un-installation.
 if [ "$1" == "0" ]; then
-  rm %{crosswalk_extensions_path}/libtizen*.so
-  rm %{crosswalk_extensions_path}/plugins.json
+  if [ -n "$(ls %{crosswalk_extensions_path}/ | grep libtizen*.so)" ]; then
+    rm %{crosswalk_extensions_path}/libtizen*.so
+  fi
+  if [ -f %{crosswalk_extensions_path}/plugins.json ]; then
+    rm %{crosswalk_extensions_path}/plugins.json
+  fi
 fi
 %files mobile-extension-emulator
 %dir %{crosswalk_extensions_path}/mobile_emulator/
@@ -1299,8 +1307,12 @@ ln -sf %{crosswalk_extensions_path}/wearable/* %{crosswalk_extensions_path}
 %preun profile_wearable
 # This is an un-installation.
 if [ "$1" == "0" ]; then
-  rm %{crosswalk_extensions_path}/libtizen*.so
-  rm %{crosswalk_extensions_path}/plugins.json
+  if [ -n "$(ls %{crosswalk_extensions_path}/ | grep libtizen*.so)" ]; then
+    rm %{crosswalk_extensions_path}/libtizen*.so
+  fi
+  if [ -f %{crosswalk_extensions_path}/plugins.json ]; then
+    rm %{crosswalk_extensions_path}/plugins.json
+  fi
 fi
 %files profile_wearable
 %dir %{crosswalk_extensions_path}/wearable/
@@ -1315,8 +1327,12 @@ ln -sf %{crosswalk_extensions_path}/wearable_emulator/* %{crosswalk_extensions_p
 %preun wearable-extension-emulator
 # This is an un-installation.
 if [ "$1" == "0" ]; then
-  rm %{crosswalk_extensions_path}/libtizen*.so
-  rm %{crosswalk_extensions_path}/plugins.json
+  if [ -n "$(ls %{crosswalk_extensions_path}/ | grep libtizen*.so)" ]; then
+    rm %{crosswalk_extensions_path}/libtizen*.so
+  fi
+  if [ -f %{crosswalk_extensions_path}/plugins.json ]; then
+    rm %{crosswalk_extensions_path}/plugins.json
+  fi
 fi
 %files wearable-extension-emulator
 %dir %{crosswalk_extensions_path}/wearable_emulator/