moya.patch 1.15 KB
--- a/generate_deploy_commands.sh
+++ b/generate_deploy_commands.sh
@@ -18,6 +18,30 @@
 # a single application exists in the $DEPLOY_DIR directory.
 ################################################################################
 
+if ls ${PAYARA_PATH}/glassfish/domains/${PAYARA_DOMAIN}/applications \
+    2>/dev/null | grep -qv '^__internal$'
+  then
+    > ${POSTBOOT_COMMANDS}
+else
+    if [ -x ${PAYARA_PATH}/bin/mkconf.sh ]
+      then
+        ${PAYARA_PATH}/bin/mkconf.sh
+    fi
+fi
+
+allapps=$(find "${DEPLOY_DIR}" -maxdepth 1 -type f \
+  \( -iname '*.ear' -or -iname '*.jar' -or -iname '*.war' \))
+
+CHECKSUMS=/tmp/sha512sums
+
+if [ -e $CHECKSUMS ]
+  then
+    apps=$(sha512sum -c $CHECKSUMS 2>/dev/null \
+      | grep ': FAILED$' | sed 's/: FAILED$//')
+else
+    apps=${allapps}
+fi
+
 if [ x$1 != x ]
   then
     DEPLOY_OPTS="$*"
@@ -24,7 +48,12 @@
 fi
 
 echo '# deployments after boot' >> $POSTBOOT_COMMANDS
-for deployment in "${DEPLOY_DIR}"/*
+for deployment in ${apps}
   do
     echo "deploy --force --enabled=true $DEPLOY_OPTS $deployment" >> $POSTBOOT_COMMANDS
 done
+
+if [ "x${apps}" != "x" ]
+  then
+    sha512sum ${allapps} > $CHECKSUMS
+fi