changeset 16:c2b62c4b9110

Erase pre-existing web-client dir in WEB_GATEWAY_ROOT. Reviewed-by: almac Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-August/024707.html
author Severin Gehwolf <sgehwolf@redhat.com>
date Mon, 28 Aug 2017 16:13:53 +0200
parents 2135485b81c7
children 85d12e67675d
files thermostat-ng.sh
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/thermostat-ng.sh	Mon Aug 28 08:20:07 2017 -0400
+++ b/thermostat-ng.sh	Mon Aug 28 16:13:53 2017 +0200
@@ -349,8 +349,15 @@
 
 # deploy web-client resources statically, more info at http://icedtea.classpath.org/pipermail/thermostat/2017-May/023164.html
 copy_web_client_to_web_gateway() {
-  local dist_dir="${WEB_CLIENT_ROOT}/dist";
+  local dist_dir="${WEB_CLIENT_ROOT}/dist"
+  local web_client_deploy_dir="$WEB_GATEWAY_ROOT/distribution/target/image/web-client"
   if [ -d "$dist_dir" ]; then
+    # Be sure to erase pre-existing web-client dir in WEB_GATEWAY_ROOT so as to not
+    # copy web-client to $WEB_GATEWAY_ROOT/distribution/target/image/web-client/dist
+    # instead of the expected $WEB_GATEWAY_ROOT/distribution/target/image/web-client
+    if [ -d "$web_client_deploy_dir" ]; then
+      rm -rf "$web_client_deploy_dir"
+    fi
     cp -r $dist_dir $WEB_GATEWAY_ROOT/distribution/target/image/web-client;
     echo "Web client copied to web-gateway."
   else