From 6fb1e12ca6edf1748f77bbf9081f9d7b15a5a9b6 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 27 Oct 2018 15:33:22 +0200 Subject: [PATCH] Add uninstall scripts --- activemq/uninstall.sh | 6 ++++++ ckan-datapusher/uninstall.sh | 6 ++++++ ckan/uninstall.sh | 25 +++++++++++++++++++++++++ crisiscleanup/uninstall.sh | 12 ++++++++++++ cts/uninstall.sh | 12 ++++++++++++ frontlinesms/uninstall.sh | 7 +++++++ gnuhealth/uninstall.sh | 12 ++++++++++++ kanboard/uninstall.sh | 15 +++++++++++++++ mariadb/uninstall.sh | 6 ++++++ mifosx/uninstall.sh | 12 ++++++++++++ motech/uninstall.sh | 14 ++++++++++++++ opendatakit-build/uninstall.sh | 12 ++++++++++++ opendatakit/uninstall.sh | 12 ++++++++++++ openmapkit/uninstall.sh | 12 ++++++++++++ pandora/uninstall.sh | 18 ++++++++++++++++++ postgres/uninstall.sh | 6 ++++++ rabbitmq/uninstall.sh | 6 ++++++ redis/uninstall.sh | 6 ++++++ sahana-demo/uninstall.sh | 12 ++++++++++++ sahana/uninstall.sh | 12 ++++++++++++ sambro/uninstall.sh | 12 ++++++++++++ seeddms/uninstall.sh | 15 +++++++++++++++ sigmah/uninstall.sh | 12 ++++++++++++ solr/uninstall.sh | 6 ++++++ ushahidi/uninstall.sh | 15 +++++++++++++++ 25 files changed, 283 insertions(+) create mode 100755 activemq/uninstall.sh create mode 100755 ckan-datapusher/uninstall.sh create mode 100755 ckan/uninstall.sh create mode 100755 crisiscleanup/uninstall.sh create mode 100755 cts/uninstall.sh create mode 100755 frontlinesms/uninstall.sh create mode 100755 gnuhealth/uninstall.sh create mode 100755 kanboard/uninstall.sh create mode 100755 mariadb/uninstall.sh create mode 100755 mifosx/uninstall.sh create mode 100755 motech/uninstall.sh create mode 100755 opendatakit-build/uninstall.sh create mode 100755 opendatakit/uninstall.sh create mode 100755 openmapkit/uninstall.sh create mode 100755 pandora/uninstall.sh create mode 100755 postgres/uninstall.sh create mode 100755 rabbitmq/uninstall.sh create mode 100755 redis/uninstall.sh create mode 100755 sahana-demo/uninstall.sh create mode 100755 sahana/uninstall.sh create mode 100755 sambro/uninstall.sh create mode 100755 seeddms/uninstall.sh create mode 100755 sigmah/uninstall.sh create mode 100755 solr/uninstall.sh create mode 100755 ushahidi/uninstall.sh diff --git a/activemq/uninstall.sh b/activemq/uninstall.sh new file mode 100755 index 0000000..56006d1 --- /dev/null +++ b/activemq/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +# Remove service +rm /etc/init.d/activemq +rc-update -u diff --git a/ckan-datapusher/uninstall.sh b/ckan-datapusher/uninstall.sh new file mode 100755 index 0000000..2e93aac --- /dev/null +++ b/ckan-datapusher/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +# Remove service +rm /etc/init.d/ckan-datapusher +rc-update -u diff --git a/ckan/uninstall.sh b/ckan/uninstall.sh new file mode 100755 index 0000000..2601d2f --- /dev/null +++ b/ckan/uninstall.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +# Remove cronjob +rm /etc/periodic/hourly/ckan + +# Remove service +rc-update del ckan || true +rm /etc/init.d/ckan +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE ckan; DROP ROLE ckan;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop + +# Remove redis data +[ ! -e /run/openrc/started/redis ] && service redis start && STOP_REDIS=1 +lxc-attach redis -- redis-cli -n 0 flushdb +[ ! -z ${STOP_REDIS} ] && service redis stop + +# Remove solr core +[ -e /run/openrc/started/solr ] && service solr stop && START_SOLR=1 +rm -rf /srv/solr/data/ckan +[ ! -z ${START_SOLR} ] && service solr start diff --git a/crisiscleanup/uninstall.sh b/crisiscleanup/uninstall.sh new file mode 100755 index 0000000..123a0e0 --- /dev/null +++ b/crisiscleanup/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del crisiscleanup || true +rm /etc/init.d/crisiscleanup +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE crisiscleanup; DROP ROLE crisiscleanup;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/cts/uninstall.sh b/cts/uninstall.sh new file mode 100755 index 0000000..07f5954 --- /dev/null +++ b/cts/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del cts || true +rm /etc/init.d/cts +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE cts; DROP ROLE cts;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/frontlinesms/uninstall.sh b/frontlinesms/uninstall.sh new file mode 100755 index 0000000..3c565bb --- /dev/null +++ b/frontlinesms/uninstall.sh @@ -0,0 +1,7 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del frontlinesms || true +rm /etc/init.d/frontlinesms +rc-update -u diff --git a/gnuhealth/uninstall.sh b/gnuhealth/uninstall.sh new file mode 100755 index 0000000..4532ede --- /dev/null +++ b/gnuhealth/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del gnuhealth || true +rm /etc/init.d/gnuhealth +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE gnuhealth; DROP DATABASE gnuhealth_demo; DROP ROLE gnuhealth;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/kanboard/uninstall.sh b/kanboard/uninstall.sh new file mode 100755 index 0000000..e68764a --- /dev/null +++ b/kanboard/uninstall.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +# Remove cronjob +rm /etc/periodic/daily/kanboard + +# Remove service +rc-update del kanboard || true +rm /etc/init.d/kanboard +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE kanboard; DROP ROLE kanboard;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/mariadb/uninstall.sh b/mariadb/uninstall.sh new file mode 100755 index 0000000..075a1c8 --- /dev/null +++ b/mariadb/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +# Remove service +rm /etc/init.d/mariadb +rc-update -u diff --git a/mifosx/uninstall.sh b/mifosx/uninstall.sh new file mode 100755 index 0000000..5eff897 --- /dev/null +++ b/mifosx/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del mifosx || true +rm /etc/init.d/mifosx +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1 +echo 'DROP DATABASE mifosplatform-tenants; DROP DATABASE mifostenant-default; DROP USER mifosx;' | lxc-attach mariadb -- mysql +[ ! -z ${STOP_MARIADB} ] && service mariadb stop diff --git a/motech/uninstall.sh b/motech/uninstall.sh new file mode 100755 index 0000000..75cf53c --- /dev/null +++ b/motech/uninstall.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del motech || true +rm /etc/init.d/motech +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE motech; DROP DATABASE motechdata; DROP DATABASE motechquartz; DROP DATABASE motechschema; DROP ROLE motech;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop + +# TODO: Clear ActiveMQ config diff --git a/opendatakit-build/uninstall.sh b/opendatakit-build/uninstall.sh new file mode 100755 index 0000000..ae95be9 --- /dev/null +++ b/opendatakit-build/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del opendatakit-build || true +rm /etc/init.d/opendatakit-build +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE opendatakit-build; DROP ROLE opendatakit-build;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/opendatakit/uninstall.sh b/opendatakit/uninstall.sh new file mode 100755 index 0000000..83f1ebb --- /dev/null +++ b/opendatakit/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del opendatakit || true +rm /etc/init.d/opendatakit +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE opendatakit; DROP ROLE opendatakit;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/openmapkit/uninstall.sh b/openmapkit/uninstall.sh new file mode 100755 index 0000000..660d214 --- /dev/null +++ b/openmapkit/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del openmapkit || true +rm /etc/init.d/openmapkit +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE openmapkit; DROP ROLE openmapkit;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/pandora/uninstall.sh b/pandora/uninstall.sh new file mode 100755 index 0000000..0547db1 --- /dev/null +++ b/pandora/uninstall.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del pandora || true +rm /etc/init.d/pandora +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE pandora; DROP ROLE pandora;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop + +# Remove RabbitMQ vhost and user +[ ! -e /run/openrc/started/rabbitmq ] && service rabbitmq start && STOP_RABBITMQ=1 +lxc-attach rabbitmq -- rabbitmqctl delete_vhost /pandora +lxc-attach rabbitmq -- rabbitmqctl delete_user pandora +[ ! -z ${STOP_RABBITMQ} ] && service rabbitmq stop diff --git a/postgres/uninstall.sh b/postgres/uninstall.sh new file mode 100755 index 0000000..1c33fa8 --- /dev/null +++ b/postgres/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +# Remove service +rm /etc/init.d/postgres +rc-update -u diff --git a/rabbitmq/uninstall.sh b/rabbitmq/uninstall.sh new file mode 100755 index 0000000..d745352 --- /dev/null +++ b/rabbitmq/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +# Remove service +rm /etc/init.d/rabbitmq +rc-update -u diff --git a/redis/uninstall.sh b/redis/uninstall.sh new file mode 100755 index 0000000..b195463 --- /dev/null +++ b/redis/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +# Remove service +rm /etc/init.d/redis +rc-update -u diff --git a/sahana-demo/uninstall.sh b/sahana-demo/uninstall.sh new file mode 100755 index 0000000..831fa8f --- /dev/null +++ b/sahana-demo/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del sahana-demo || true +rm /etc/init.d/sahana-demo +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE sahanademo; DROP ROLE sahanademo;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/sahana/uninstall.sh b/sahana/uninstall.sh new file mode 100755 index 0000000..3b545bd --- /dev/null +++ b/sahana/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del sahana || true +rm /etc/init.d/sahana +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE sahana; DROP ROLE sahana;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/sambro/uninstall.sh b/sambro/uninstall.sh new file mode 100755 index 0000000..7f38b10 --- /dev/null +++ b/sambro/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del sambro || true +rm /etc/init.d/sambro +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE sambro; DROP ROLE sambro;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/seeddms/uninstall.sh b/seeddms/uninstall.sh new file mode 100755 index 0000000..2f95e2a --- /dev/null +++ b/seeddms/uninstall.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +# Remove cronjob +/etc/periodic/hourly/seeddms + +# Remove service +rc-update del seeddms || true +rm /etc/init.d/seeddms +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE seeddms; DROP ROLE seeddms;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/sigmah/uninstall.sh b/sigmah/uninstall.sh new file mode 100755 index 0000000..a38a9d7 --- /dev/null +++ b/sigmah/uninstall.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +# Remove service +rc-update del sigmah || true +rm /etc/init.d/sigmah +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE sigmah; DROP ROLE sigmah;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop diff --git a/solr/uninstall.sh b/solr/uninstall.sh new file mode 100755 index 0000000..84a4a3f --- /dev/null +++ b/solr/uninstall.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +# Remove service +rm /etc/init.d/solr +rc-update -u diff --git a/ushahidi/uninstall.sh b/ushahidi/uninstall.sh new file mode 100755 index 0000000..8c37e70 --- /dev/null +++ b/ushahidi/uninstall.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +# Remove cronjob +rm /etc/periodic/15min/ushahidi + +# Remove service +rc-update del ushahidi || true +rm /etc/init.d/ushahidi +rc-update -u + +# Drop database and user +[ ! -e /run/openrc/started/mariadb ] && service mariadb start && STOP_MARIADB=1 +echo 'DROP DATABASE ushahidi; DROP USER ushahidi;' | lxc-attach mariadb -- mysql +[ ! -z ${STOP_MARIADB} ] && service mariadb stop