Add uninstall script

This commit is contained in:
VirtuBox
2019-07-29 11:23:23 +02:00
parent 9c0eda3877
commit 5c90b7952b
3 changed files with 127 additions and 109 deletions

View File

@@ -54,3 +54,4 @@ script:
- sudo wo update --travis - sudo wo update --travis
- sudo wo stack status - sudo wo stack status
- echo "yes" | sudo wo stack purge --all - echo "yes" | sudo wo stack purge --all
- sudo bash install --purge

24
install
View File

@@ -7,7 +7,7 @@
# Copyright (c) 2019 - WordOps # Copyright (c) 2019 - WordOps
# This script is licensed under M.I.T # This script is licensed under M.I.T
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Version 3.9.6.3 - 2019-07-25 # Version 3.9.6.3 - 2019-07-29
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
readonly wo_version_old="2.2.3" readonly wo_version_old="2.2.3"
readonly wo_version_new="3.9.6.3" readonly wo_version_new="3.9.6.3"
@@ -73,6 +73,9 @@ while [ "$#" -gt 0 ]; do
-s | --silent) -s | --silent)
wo_force_install="y" wo_force_install="y"
;; ;;
--purge | --uninstall)
wo_purge="y"
;;
*) # positional args *) # positional args
;; ;;
esac esac
@@ -620,15 +623,15 @@ wo_git_init() {
} }
wo_backup_ee() { wo_backup_ee() {
/bin/tar -I pigz -cf "$EE_BACKUP_FILE" /etc/nginx /usr/local/bin/ee /usr/lib/ee/templates /usr/local/lib/python3.6/dist-packages/ee-*.egg /etc/ee /var/lib/ee /etc/letsencrypt >> /var/log/wo/install.log 2>&1 /bin/tar -I pigz -cf "$EE_BACKUP_FILE" /etc/nginx /usr/local/bin/ee /usr/lib/ee/templates /usr/local/lib/python3.*/dist-packages/ee-*.egg /etc/ee /var/lib/ee /etc/letsencrypt >> /var/log/wo/install.log 2>&1
} }
wo_backup_wo() { wo_backup_wo() {
/bin/tar -I pigz -cf "$WO_BACKUP_FILE" /etc/nginx /usr/local/lib/python3.6/dist-packages/wo-*.egg /etc/wo /var/lib/wo /etc/letsencrypt >> /var/log/wo/install.log 2>&1 /bin/tar -I pigz -cf "$WO_BACKUP_FILE" /etc/nginx /usr/local/lib/python3.*/dist-packages/wo-*.egg /etc/wo /var/lib/wo /etc/letsencrypt >> /var/log/wo/install.log 2>&1
} }
wo_clean_ee() { wo_clean_ee() {
rm -f /usr/local/bin/ee /etc/bash_completion.d/ee_auto.rc /usr/lib/ee/templates /usr/local/lib/python3.6/dist-packages/ee-*.egg /etc/ee /var/lib/ee >> /var/log/wo/install.log 2>&1 rm -f /usr/local/bin/ee /etc/bash_completion.d/ee_auto.rc /usr/lib/ee/templates /usr/local/lib/python3.*/dist-packages/ee-*.egg /etc/ee /var/lib/ee >> /var/log/wo/install.log 2>&1
} }
wo_remove_ee_cron() { wo_remove_ee_cron() {
@@ -672,10 +675,21 @@ wo_tweak_kernel() {
} }
wo_uninstall() {
rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates >> /var/log/wo/install.log 2>&1
}
### ###
# 4 - WO MAIN SETUP # 4 - WO MAIN SETUP
### ###
if [ $wo_purge = "y" ]; then
wo_lib_echo "Backing-up WO install" | tee -ai $wo_install_log
wo_backup_wo | tee -ai $wo_install_log
wo_lib_echo "Uninstalling WordOps" | tee -ai $wo_install_log
wo_uninstall | tee -ai $wo_install_log
wo_lib_echo "The WordOps backup files can be found in $WO_BACKUP_FILE"
else
# 1 - WO already installed # 1 - WO already installed
if [ -x /usr/local/bin/wo ]; then if [ -x /usr/local/bin/wo ]; then
if ! { if ! {
@@ -797,3 +811,5 @@ echo
wo_lib_echo "WordOps Documentation : https://docs.wordops.net" wo_lib_echo "WordOps Documentation : https://docs.wordops.net"
wo_lib_echo "WordOps Community Forum : https://community.wordops.net" wo_lib_echo "WordOps Community Forum : https://community.wordops.net"
echo echo
fi

View File

@@ -1486,6 +1486,7 @@ class WOStackController(CementBaseController):
"/master/mysqltuner.pl", "/master/mysqltuner.pl",
"/usr/bin/mysqltuner", "/usr/bin/mysqltuner",
"MySQLTuner"]] "MySQLTuner"]]
else: else:
Log.debug(self, "MySQL connection is already alive") Log.debug(self, "MySQL connection is already alive")
Log.info(self, "MySQL connection is already alive") Log.info(self, "MySQL connection is already alive")