Option for interactive install function

This commit is contained in:
Bob Mottram 2016-09-30 11:25:05 +01:00
parent 383c94810d
commit dce19538ac
3 changed files with 17 additions and 3 deletions

View File

@ -164,7 +164,7 @@ function install_apps_interactive {
# install the apps
read_configuration
install_apps
install_apps interactive
}
${PROJECT_NAME}-tests

View File

@ -30,10 +30,17 @@
function function_check {
if [ ! "$(type ${1} 2>/dev/null)" ]; then
echo $"Dependency error: The function ${1} has not been defined"
exit 72528
echo $"Dependency error: The function ${1} has not been defined"
exit 72528
fi
}
function function_exists {
if [ ! "$(type ${1} 2>/dev/null)" ]; then
echo "0"
else
echo "1"
fi
}
# NOTE: deliberately there is no "exit 0"

View File

@ -202,11 +202,18 @@ function remove_apps {
}
function install_apps {
is_interactive=$1
app_index=0
for a in "${APPS_AVAILABLE[@]}"
do
if [[ ${APPS_INSTALLED[$app_index]} == "0" ]]; then
if [[ ${APPS_CHOSEN[$app_index]} == "1" ]]; then
if [ ${is_interactive} ]; then
# interactively obtain settings for this app
if [[ $(function_exists install_interactive_${a}) == "1" ]]; then
install_interactive_${a}
fi
fi
echo $"Installing application: ${a}"
install_${a}
echo $"${a} was installed"