Compare commits
2 Commits
fad8de9d4e
...
c477713d94
Author | SHA1 | Date |
---|---|---|
Ray Elliott | c477713d94 | |
Ray Elliott | a2e534f552 |
|
@ -7,4 +7,4 @@ Development environment base packages:
|
|||
|
||||
## TODO
|
||||
|
||||
* get remote working with cloudways
|
||||
* make sure to use export in all config files (the newer ones aren't)
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
#!/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
|
||||
|
||||
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): "
|
||||
. "$_script_dir/reset-wordpress.sh"
|
||||
. "$_script_dir/install-wordpress.sh"
|
||||
fi
|
|
@ -21,7 +21,7 @@ else
|
|||
$_mysql_cmd "GRANT ALL PRIVILEGES ON $wp_db_name.* TO '$wp_db_user'@'localhost' IDENTIFIED BY '$wp_db_pass';"
|
||||
$_mysql_cmd "FLUSH PRIVILEGES;"
|
||||
else
|
||||
echo "ERROR: no installed database found - aborting WordPress install"
|
||||
echo "ERROR: mysql not found - aborting WordPress install"
|
||||
exit 40
|
||||
fi
|
||||
wp core download \
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
echo "Removing WordPress .."
|
||||
|
||||
_mysql_cmd="mysql -uroot -p$db_root_pass -e "
|
||||
|
||||
ssh -T $ssh << EOSSH
|
||||
# remove database
|
||||
if command -v mysql ; then
|
||||
$_mysql_cmd "DROP DATABASE $wp_db_name;"
|
||||
else
|
||||
echo "ERROR: no installed database found - aborting WordPress removal"
|
||||
exit 40
|
||||
fi
|
||||
# remove files
|
||||
rm -Rf $wp_path
|
||||
EOSSH
|
Loading…
Reference in New Issue