dev-scripts/reset.sh

43 lines
1015 B
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
# 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
if [ -n "$wp_user" ] ; then
# TODO - confirmation prompt
echo "IMPORTANT - we need a confirmation prompt here"
echo "You are about to reinstall the $_target WordPress installation"
echo "Reinstall WordPress (y/N): "
. "./scripts/reset-wordpress.sh"
. "$_script_dir/install-wordpress.sh"
fi