From 61fab326c39840418c734b1133cc8ebed3291de0 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Wed, 31 Oct 2018 09:42:01 +0100 Subject: [PATCH] Revert "Update uninstall script not to fail on clean installation" This reverts commit a339c8e8ff8b0fdcde1d3367afd26ea980b1149e. --- ckan/uninstall.sh | 24 +++++++++--------------- crisiscleanup/uninstall.sh | 8 +++----- cts/uninstall.sh | 8 +++----- gnuhealth/uninstall.sh | 8 +++----- kanboard/uninstall.sh | 8 +++----- mifosx/uninstall.sh | 8 +++----- motech/uninstall.sh | 8 +++----- opendatakit-build/uninstall.sh | 8 +++----- opendatakit/uninstall.sh | 8 +++----- openmapkit/uninstall.sh | 8 +++----- pandora/uninstall.sh | 18 +++++++----------- sahana-demo/uninstall.sh | 8 +++----- sahana/uninstall.sh | 8 +++----- sambro/uninstall.sh | 8 +++----- seeddms/uninstall.sh | 8 +++----- sigmah/uninstall.sh | 8 +++----- ushahidi/uninstall.sh | 8 +++----- 17 files changed, 61 insertions(+), 101 deletions(-) diff --git a/ckan/uninstall.sh b/ckan/uninstall.sh index 830b45b..7db5212 100755 --- a/ckan/uninstall.sh +++ b/ckan/uninstall.sh @@ -10,24 +10,18 @@ rm -f /etc/init.d/ckan rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 - echo 'DROP DATABASE ckan; DROP DATABASE ckan_datastore; DROP ROLE ckan; DROP ROLE ckan_datastore;' | lxc-attach -u 5432 -g 5432 postgres -- psql - [ ! -z ${STOP_POSTGRES} ] && service postgres stop -fi +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE ckan; DROP DATABASE ckan_datastore; DROP ROLE ckan; DROP ROLE ckan_datastore;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop # Remove redis data -if [ -e /etc/init.d/redis ]; then - [ ! -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 -fi +[ ! -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 -if [ -e /etc/init.d/solr ]; then - [ -e /run/openrc/started/solr ] && service solr stop && START_SOLR=1 - rm -rf /srv/solr/data/ckan - [ ! -z ${START_SOLR} ] && service solr start -fi +[ -e /run/openrc/started/solr ] && service solr stop && START_SOLR=1 +rm -rf /srv/solr/data/ckan +[ ! -z ${START_SOLR} ] && service solr start exit 0 diff --git a/crisiscleanup/uninstall.sh b/crisiscleanup/uninstall.sh index c7b6a72..19c990a 100755 --- a/crisiscleanup/uninstall.sh +++ b/crisiscleanup/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/crisiscleanup rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/cts/uninstall.sh b/cts/uninstall.sh index 8124f0b..5475ba9 100755 --- a/cts/uninstall.sh +++ b/cts/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/cts rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/gnuhealth/uninstall.sh b/gnuhealth/uninstall.sh index a2e8552..5655cd8 100755 --- a/gnuhealth/uninstall.sh +++ b/gnuhealth/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/gnuhealth rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/kanboard/uninstall.sh b/kanboard/uninstall.sh index 03c3a21..3cd36c2 100755 --- a/kanboard/uninstall.sh +++ b/kanboard/uninstall.sh @@ -10,10 +10,8 @@ rm -f /etc/init.d/kanboard rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/mifosx/uninstall.sh b/mifosx/uninstall.sh index 36d08a5..84fef6c 100755 --- a/mifosx/uninstall.sh +++ b/mifosx/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/mifosx rc-update -u # Drop database and user -if [ -e /etc/init.d/mariadb ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/motech/uninstall.sh b/motech/uninstall.sh index d471ecb..96017ca 100755 --- a/motech/uninstall.sh +++ b/motech/uninstall.sh @@ -7,11 +7,9 @@ rm -f /etc/init.d/motech rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 index 29997e8..8447063 100755 --- a/opendatakit-build/uninstall.sh +++ b/opendatakit-build/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/opendatakit-build rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 - echo 'DROP DATABASE opendatakitbuild; DROP ROLE opendatakitbuild;' | lxc-attach -u 5432 -g 5432 postgres -- psql - [ ! -z ${STOP_POSTGRES} ] && service postgres stop -fi +[ ! -e /run/openrc/started/postgres ] && service postgres start && STOP_POSTGRES=1 +echo 'DROP DATABASE opendatakitbuild; DROP ROLE opendatakitbuild;' | lxc-attach -u 5432 -g 5432 postgres -- psql +[ ! -z ${STOP_POSTGRES} ] && service postgres stop exit 0 diff --git a/opendatakit/uninstall.sh b/opendatakit/uninstall.sh index 9004707..c6dea64 100755 --- a/opendatakit/uninstall.sh +++ b/opendatakit/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/opendatakit rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/openmapkit/uninstall.sh b/openmapkit/uninstall.sh index f68eee5..9bb73da 100755 --- a/openmapkit/uninstall.sh +++ b/openmapkit/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/openmapkit rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/pandora/uninstall.sh b/pandora/uninstall.sh index 2443e9a..8fbdeca 100755 --- a/pandora/uninstall.sh +++ b/pandora/uninstall.sh @@ -7,18 +7,14 @@ rm -f /etc/init.d/pandora rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 -if [ -e /etc/init.d/rabbitmq ]; then - [ ! -e /run/openrc/started/rabbitmq ] && service rabbitmq start && STOP_RABBITMQ=1 - lxc-attach rabbitmq -- rabbitmqctl delete_vhost /pandora || true - lxc-attach rabbitmq -- rabbitmqctl delete_user pandora || true - [ ! -z ${STOP_RABBITMQ} ] && service rabbitmq stop -fi +[ ! -e /run/openrc/started/rabbitmq ] && service rabbitmq start && STOP_RABBITMQ=1 +lxc-attach rabbitmq -- rabbitmqctl delete_vhost /pandora || true +lxc-attach rabbitmq -- rabbitmqctl delete_user pandora || true +[ ! -z ${STOP_RABBITMQ} ] && service rabbitmq stop exit 0 diff --git a/sahana-demo/uninstall.sh b/sahana-demo/uninstall.sh index 6926e2c..9c70ccd 100755 --- a/sahana-demo/uninstall.sh +++ b/sahana-demo/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/sahana-demo rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/sahana/uninstall.sh b/sahana/uninstall.sh index 98a859f..2e281e4 100755 --- a/sahana/uninstall.sh +++ b/sahana/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/sahana rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/sambro/uninstall.sh b/sambro/uninstall.sh index 121c969..ffcd3fc 100755 --- a/sambro/uninstall.sh +++ b/sambro/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/sambro rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/seeddms/uninstall.sh b/seeddms/uninstall.sh index fbcc680..25d487b 100755 --- a/seeddms/uninstall.sh +++ b/seeddms/uninstall.sh @@ -10,10 +10,8 @@ rm -f /etc/init.d/seeddms rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/sigmah/uninstall.sh b/sigmah/uninstall.sh index 83dbc3d..ada1474 100755 --- a/sigmah/uninstall.sh +++ b/sigmah/uninstall.sh @@ -7,10 +7,8 @@ rm -f /etc/init.d/sigmah rc-update -u # Drop database and user -if [ -e /etc/init.d/postgres ]; then - [ ! -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 -fi +[ ! -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 exit 0 diff --git a/ushahidi/uninstall.sh b/ushahidi/uninstall.sh index 8a59676..4403b34 100755 --- a/ushahidi/uninstall.sh +++ b/ushahidi/uninstall.sh @@ -10,10 +10,8 @@ rm -f /etc/init.d/ushahidi rc-update -u # Drop database and user -if [ -e /etc/init.d/mariadb ]; then - [ ! -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 -fi +[ ! -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 exit 0