78 lines
1.7 KiB
Bash
Executable File
78 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
_target="$1"
|
|
_target_os="$2"
|
|
# default scripts to use
|
|
_script_dir='./scripts/debian10'
|
|
|
|
if ! [ "$_target" = local ] && ! [ "$_target" = remote ] ; then
|
|
echo "Error: must specify 'local' or 'remote' target"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Loading $_target configuration"
|
|
|
|
# source our config files
|
|
for _file in ./config/$_target/* ; do
|
|
[ -e "$_file" ] || continue
|
|
. "$_file"
|
|
done
|
|
|
|
if [ "$_target" = remote ] && [ -n "$cloudways_user" ] ; then
|
|
echo "Using Cloudways - nothing to install"
|
|
exit
|
|
fi
|
|
|
|
# source script files
|
|
if [ -n "$_target_os" ] ; then
|
|
_script_dir="./scripts/$_target_os"
|
|
if ! [ -d "$_script_dir" ] ; then
|
|
echo "Error: script directory not found '$_script_dir'"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "Using Scripts in: $_script_dir"
|
|
|
|
# check we have ssh access
|
|
[ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5
|
|
|
|
# update
|
|
echo "Updating .."
|
|
ssh -T $ssh << EOSSH
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get -qq -y update && apt-get -qq -y upgrade
|
|
EOSSH
|
|
echo "Update complete"
|
|
|
|
. "$_script_dir/install-user.sh"
|
|
# . "$_script_dir/install-base.sh"
|
|
#
|
|
# if [ -n "$php_version" ] ; then
|
|
# . "$_script_dir/install-php.sh"
|
|
# fi
|
|
#
|
|
# if [ -n "$mariadb_version" ] ; then
|
|
# . "$_script_dir/install-mariadb.sh"
|
|
# elif [ -n "$mysql_version" ] ; then
|
|
# . "$_script_dir/install-mysql.sh"
|
|
# fi
|
|
#
|
|
# if [ -n "$apache2_version" ] ; then
|
|
# . "$_script_dir/install-apache2.sh"
|
|
# elif [ -n "$nginx_version" ] ; then
|
|
# # TODO nginx install script
|
|
# echo 'TODO - nginx install script'
|
|
# elif [ -n "$litespeed_version" ] ; then
|
|
# # TODO
|
|
# echo 'TODO litespeed install script'
|
|
# fi
|
|
#
|
|
# if [ -n "$wp_user" ] ; then
|
|
# . "$_script_dir/install-wordpress.sh"
|
|
# fi
|
|
#
|
|
# if [ -n "$dev_env" ] ; then
|
|
# . "$_script_dir/install-dev-base.sh"
|
|
# fi
|