combine install-local.sh and install-remote.sh
This commit is contained in:
parent
c6efac505c
commit
b16fe3f73c
|
@ -7,6 +7,4 @@ Development environment base packages:
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* combine install-local.sh and install-remote.sh into one script that takes
|
|
||||||
an argument of local/remote
|
|
||||||
* get remote working with cloudways
|
* get remote working with cloudways
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
_target="$1"
|
||||||
|
_target_os="$2"
|
||||||
# default scripts to use
|
# default scripts to use
|
||||||
_script_dir='./scripts/debian10'
|
_script_dir='./scripts/debian10'
|
||||||
|
|
||||||
if [ -n "$1" ] ; then
|
if ! [ "$_target" = local ] && ! [ "$_target" = remote ] ; then
|
||||||
_script_dir="./scripts/$1"
|
echo "Error: must specify 'local' or 'remote' target"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# source our config files
|
||||||
|
for _file in ./config/local/* ; do
|
||||||
|
. "$_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "$_target_os" ] ; then
|
||||||
|
_script_dir="./scripts/$_target_os"
|
||||||
if ! [ -d "$_script_dir" ] ; then
|
if ! [ -d "$_script_dir" ] ; then
|
||||||
echo "Error: script directory not found '$_script_dir'"
|
echo "Error: script directory not found '$_script_dir'"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -13,15 +25,10 @@ fi
|
||||||
|
|
||||||
echo "Using Scripts in: $_script_dir"
|
echo "Using Scripts in: $_script_dir"
|
||||||
|
|
||||||
# source our config files
|
|
||||||
for _file in ./config/local/* ; do
|
|
||||||
. "$_file"
|
|
||||||
done
|
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
# update local server
|
# update
|
||||||
echo "Updating .."
|
echo "Updating .."
|
||||||
ssh -T $ssh << EOSSH
|
ssh -T $ssh << EOSSH
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
@ -59,4 +66,3 @@ 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
|
||||||
|
|
Loading…
Reference in New Issue