Revert "Update uninstall script not to fail on clean installation"

This reverts commit a339c8e8ff.
This commit is contained in:
Disassembler 2018-10-31 09:42:01 +01:00
parent 237342254f
commit 61fab326c3
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
17 changed files with 61 additions and 101 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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