dev-scripts/install.sh

78 lines
1.7 KiB
Bash
Raw Normal View History

2020-09-03 13:46:19 +00:00
#!/bin/sh
_target="$1"
_target_os="$2"
2020-09-04 13:49:07 +00:00
# default scripts to use
2020-09-04 14:04:28 +00:00
_script_dir='./scripts/debian10'
2020-09-04 13:49:07 +00:00
if ! [ "$_target" = local ] && ! [ "$_target" = remote ] ; then
echo "Error: must specify 'local' or 'remote' target"
exit 1
fi
2020-09-05 11:01:33 +00:00
2020-09-05 10:46:59 +00:00
echo "Loading $_target configuration"
# source our config files
2020-09-05 10:46:59 +00:00
for _file in ./config/$_target/* ; do
[ -e "$_file" ] || continue
. "$_file"
done
2020-09-05 11:01:33 +00:00
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"
2020-09-04 13:49:07 +00:00
if ! [ -d "$_script_dir" ] ; then
echo "Error: script directory not found '$_script_dir'"
exit 1
fi
fi
echo "Using Scripts in: $_script_dir"
2020-09-03 13:46:19 +00:00
# check we have ssh access
[ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5
# update
2020-09-04 20:45:04 +00:00
echo "Updating .."
2020-09-03 13:46:19 +00:00
ssh -T $ssh << EOSSH
export DEBIAN_FRONTEND=noninteractive
2020-09-04 21:24:19 +00:00
apt-get -qq -y update && apt-get -qq -y upgrade
2020-09-03 13:46:19 +00:00
EOSSH
echo "Update complete"
2020-09-04 13:49:07 +00:00
. "$_script_dir/install-user.sh"
2020-09-05 10:46:59 +00:00
# . "$_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