From b16fe3f73cb7ff3071c0a49451cddf6514abd4d5 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 5 Sep 2020 11:10:14 +0100 Subject: [PATCH] combine install-local.sh and install-remote.sh --- README.md | 2 -- install-remote.sh | 0 install-local.sh => install.sh | 24 +++++++++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) delete mode 100755 install-remote.sh rename install-local.sh => install.sh (84%) diff --git a/README.md b/README.md index 58c2907..21fd7ab 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,4 @@ Development environment base packages: ## TODO -* combine install-local.sh and install-remote.sh into one script that takes - an argument of local/remote * get remote working with cloudways diff --git a/install-remote.sh b/install-remote.sh deleted file mode 100755 index e69de29..0000000 diff --git a/install-local.sh b/install.sh similarity index 84% rename from install-local.sh rename to install.sh index a1f0f41..6167c04 100755 --- a/install-local.sh +++ b/install.sh @@ -1,10 +1,22 @@ #!/bin/sh +_target="$1" +_target_os="$2" # default scripts to use _script_dir='./scripts/debian10' -if [ -n "$1" ] ; then - _script_dir="./scripts/$1" +if ! [ "$_target" = local ] && ! [ "$_target" = remote ] ; then + 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 echo "Error: script directory not found '$_script_dir'" exit 1 @@ -13,15 +25,10 @@ fi echo "Using Scripts in: $_script_dir" -# source our config files -for _file in ./config/local/* ; do - . "$_file" -done - # check we have ssh access [ -z "$ssh" ] && echo "Error: no ssh configuration specified" && exit 5 -# update local server +# update echo "Updating .." ssh -T $ssh << EOSSH export DEBIAN_FRONTEND=noninteractive @@ -59,4 +66,3 @@ fi if [ -n "$dev_env" ] ; then . "$_script_dir/install-dev-base.sh" fi -