load configuration based on target

This commit is contained in:
Ray Elliott 2020-09-05 11:46:59 +01:00
parent b624a6e8cb
commit 40f17c5a8e
1 changed files with 35 additions and 30 deletions

View File

@ -9,9 +9,12 @@ if ! [ "$_target" = local ] && ! [ "$_target" = remote ] ; then
echo "Error: must specify 'local' or 'remote' target" echo "Error: must specify 'local' or 'remote' target"
exit 1 exit 1
fi fi
echo "Loading $_target configuration"
# source our config files # source our config files
for _file in ./config/local/* ; do for _file in ./config/$_target/* ; do
[ -e "$_file" ] || continue
echo " reading config: $_file"
. "$_file" . "$_file"
done done
@ -28,6 +31,8 @@ echo "Using Scripts in: $_script_dir"
# check we have ssh access # check we have ssh access
[ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5 [ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5
exit
# update # update
echo "Updating .." echo "Updating .."
ssh -T $ssh << EOSSH ssh -T $ssh << EOSSH
@ -37,32 +42,32 @@ EOSSH
echo "Update complete" echo "Update complete"
. "$_script_dir/install-user.sh" . "$_script_dir/install-user.sh"
. "$_script_dir/install-base.sh" # . "$_script_dir/install-base.sh"
#
if [ -n "$php_version" ] ; then # if [ -n "$php_version" ] ; then
. "$_script_dir/install-php.sh" # . "$_script_dir/install-php.sh"
fi # fi
#
if [ -n "$mariadb_version" ] ; then # if [ -n "$mariadb_version" ] ; then
. "$_script_dir/install-mariadb.sh" # . "$_script_dir/install-mariadb.sh"
elif [ -n "$mysql_version" ] ; then # elif [ -n "$mysql_version" ] ; then
. "$_script_dir/install-mysql.sh" # . "$_script_dir/install-mysql.sh"
fi # fi
#
if [ -n "$apache2_version" ] ; then # if [ -n "$apache2_version" ] ; then
. "$_script_dir/install-apache2.sh" # . "$_script_dir/install-apache2.sh"
elif [ -n "$nginx_version" ] ; then # elif [ -n "$nginx_version" ] ; then
# TODO nginx install script # # TODO nginx install script
echo 'TODO - nginx install script' # echo 'TODO - nginx install script'
elif [ -n "$litespeed_version" ] ; then # elif [ -n "$litespeed_version" ] ; then
# TODO # # TODO
echo 'TODO litespeed install script' # echo 'TODO litespeed install script'
fi # fi
#
if [ -n "$wp_user" ] ; then # if [ -n "$wp_user" ] ; then
. "$_script_dir/install-wordpress.sh" # . "$_script_dir/install-wordpress.sh"
fi # fi
#
if [ -n "$dev_env" ] ; then # if [ -n "$dev_env" ] ; then
. "$_script_dir/install-dev-base.sh" # . "$_script_dir/install-dev-base.sh"
fi # fi