install-eg.sh: do cleanup before installing dependencies, to avoid removing npm
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 15 Apr 2020 22:40:47 +0000 (15:40 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Tue, 21 Apr 2020 00:34:44 +0000 (17:34 -0700)
deployment/install-eg.sh

index 499b9f4..647b0cd 100755 (executable)
@@ -69,7 +69,11 @@ if [[ -n "$TARBALL" ]] ; then
   fi
   suwrap "cd /home/${INSTALL_USER} && tar xzf ${EGRELEASETGZ}" ${INSTALL_USER}
 else
-  if [[ -n "$CLEANINSTALL" ]] ; then rm -rf "${BUILDDIR}" ; fi
+  if [[ -n "$CLEANINSTALL" ]] ; then
+    rm -rf "${BUILDDIR}"
+    cd /usr/local/bin/ && rm ng node npm npx
+    cd /usr/local/lib/ && rm -rf node_modules/
+  fi
   # checkout EG source
   if [ ! -d "${BUILDDIR}" ]
   then
@@ -96,11 +100,6 @@ if [[ ! -n "$TARBALL" && ! -n "$SKIPWEBCLIENT" ]] ; then
     if [ -d "${BUILDDIR}/Open-ILS/web/js/ui/default/staff/build" ] ; then rm -rf ${BUILDDIR}/Open-ILS/web/js/ui/default/staff/build ; fi
     suwrap "cp -r /home/${INSTALL_USER}/web-client-deps/build ${BUILDDIR}/Open-ILS/web/js/ui/default/staff/build" ${INSTALL_USER}
   else
-    if [[ -n "$CLEANINSTALL" ]] ; then
-      cd /usr/local/bin/ && rm ng node npm npx
-      cd /usr/local/lib/ && rm -rf node_modules/
-      cd /home/${INSTALL_USER} # let's not end up in the wrong working directory
-    fi
     # install dependencies
     cd ${BUILDDIR}/Open-ILS/web/js/ui/default/staff/
     sed -i "s|'/openils/lib/javascript|'${INSTALLDIR}/lib/javascript|g" ${BUILDDIR}/Open-ILS/web/js/ui/default/staff/test/karma.conf.js