Support arbitrary container init scripts 78/94378/1
authorjhh <jorge.hernandez-herrero@att.com>
Tue, 27 Aug 2019 20:30:23 +0000 (15:30 -0500)
committerjhh <jorge.hernandez-herrero@att.com>
Tue, 27 Aug 2019 20:30:23 +0000 (15:30 -0500)
Issue-ID: POLICY-1371
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: Ic1c15e6f36fe3eead937d4595b994747e830eb7a

controlloop/packages/docker-controlloop/src/main/resources/docker-entrypoint.sh

index 7378161..0c7fab9 100644 (file)
@@ -63,13 +63,15 @@ function scripts {
         set -x
     fi
 
-    if ! ls "${POLICY_INSTALL_INIT}"/*.sh 2>&1; then
+    local scriptExtSuffix=${1:-"sh"}
+
+    if ! ls "${POLICY_INSTALL_INIT}"/*."${scriptExtSuffix}" 2>&1; then
         return 0
     fi
 
     source "${POLICY_HOME}"/etc/profile.d/env.sh
 
-    for s in $(ls "${POLICY_INSTALL_INIT}"/*.sh 2> /dev/null); do
+    for s in $(ls "${POLICY_INSTALL_INIT}"/*."${scriptExtSuffix}" 2> /dev/null); do
         echo "executing script: ${s}"
         source "${s}"
     done
@@ -206,7 +208,7 @@ function reload {
     features
     security
     properties
-    scripts
+    scripts "pre.sh"
 }
 
 function start {
@@ -238,6 +240,7 @@ function vmBoot {
     reload
     db
     start
+    scripts "post.sh"
 }
 
 function dockerBoot {
@@ -268,6 +271,8 @@ case "${operation}" in
                 ;;
     configure)  configure
                 ;;
+    nexus)      nexus
+                ;;
     *)          exec "$@"
                 ;;
 esac