[AAF-21] Initial code import
[aaf/authz.git] / authz-test / src / main / swm / common / deinstall.sh
diff --git a/authz-test/src/main/swm/common/deinstall.sh b/authz-test/src/main/swm/common/deinstall.sh
new file mode 100644 (file)
index 0000000..740564c
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh\r
+##############################################################################\r
+# - Copyright 2012, 2016 AT&T Intellectual Properties\r
+##############################################################################
+umask 022\r
+ROOT_DIR=${INSTALL_ROOT}/${distFilesRootDirPath}\r
+\r
+# Grab the IID of all resources running under the name and same version(s) we're working on and stop those instances\r
+${LRM_HOME}/bin/lrmcli -running | \\r
+       grep ${artifactId} | \\r
+       grep ${version} | \\r
+       cut -f1 | \\r
+while read _iid\r
+do\r
+       if [ -n "${_iid}" ]; then\r
+               ${LRM_HOME}/bin/lrmcli -shutdown -iid ${_iid} | grep SUCCESS\r
+               if [ $? -ne 0 ]; then\r
+                       echo "$LRMID-{_iid} Shutdown failed"\r
+               fi\r
+       fi\r
+done\r
+       \r
+# Grab the resources configured under the name and same version we're working on and delete those instances\r
+${LRM_HOME}/bin/lrmcli -configured | \\r
+       grep ${artifactId} | \\r
+       grep ${version} | \\r
+       cut -f1,2,3 | \\r
+while read _name _version _routeoffer\r
+do\r
+       if [ -n "${_name}" ]; then\r
+               ${LRM_HOME}/bin/lrmcli -delete -name ${_name} -version ${_version} -routeoffer ${_routeoffer} | grep SUCCESS\r
+               if [ $? -ne 0 ]; then\r
+                       echo "${_version} Delete failed"\r
+               fi\r
+       fi\r
+done   \r
+\r
+rm -rf ${ROOT_DIR}\r
+\r
+exit 0\r