From 00d4c44e28fdc2ea846d2de70a974cca990a25b5 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 8 Feb 2013 11:39:27 +0000 Subject: [PATCH] Add the search/execution base for starting daemons in a separate, optional, function. --- bootstrap-salt.sh | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index f3e8efe..a101575 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -541,12 +541,18 @@ __apt_get_noinput() { # 1. install___ # 2. install__ # -# Also optionally, define a post install function, one of: +# Optionally, define a post install function, one of: # 1. install____post # 2. install___post # 3. install___post # 4. install__post # +# Optionally, define a start daemons function, one of: +# 1. install____start_daemons +# 2. install___start_daemons +# 3. install___start_daemons +# 4. install__start_daemons +# ############################################################################## ############################################################################## @@ -1414,6 +1420,21 @@ for FUNC_NAME in $POST_FUNC_NAMES; do done +# Let's get the start daemons install function +STARTDAEMONS_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_VERSION_NO_DOTS}_${ITYPE}_start_daemons" +STARTDAEMONS_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_VERSION_NO_DOTS}_start_daemons" +STARTDAEMONS_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_start_daemons" +STARTDAEMONS_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_start_daemons" + +STARTDAEMONS_INSTALL_FUNC="null" +for FUNC_NAME in $STARTDAEMONS_FUNC_NAMES; do + if __function_defined $FUNC_NAME; then + STARTDAEMONS_INSTALL_FUNC=$FUNC_NAME + break + fi +done + + if [ $DEPS_INSTALL_FUNC = "null" ]; then echoerr " * ERROR: No dependencies installation function found. Exiting..." exit 1 @@ -1465,6 +1486,18 @@ if [ "$POST_INSTALL_FUNC" != "null" ]; then fi +# Run any start daemons function +if [ "$STARTDAEMONS_INSTALL_FUNC" != "null" ]; then + echo " * Running ${STARTDAEMONS_INSTALL_FUNC}()" + $STARTDAEMONS_INSTALL_FUNC + if [ $? -ne 0 ]; then + echoerr " * ERROR: Failed to run ${STARTDAEMONS_INSTALL_FUNC}()!!!" + exit 1 + fi +fi + + + # Done! echo " * Salt installed!" exit 0