[DRE-commits] [diaspora-installer] 02/02: configure only for new installations
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Sun May 10 19:05:37 UTC 2015
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository diaspora-installer.
commit 07ce3509ecb33b4ddd81850c39ebf07271e35f08
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Mon May 11 00:34:53 2015 +0530
configure only for new installations
---
debian/changelog | 1 +
debian/diaspora-common.config | 24 -------------
debian/diaspora-common.postinst | 74 +++++++++++++++++++++++++++++------------
3 files changed, 53 insertions(+), 46 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 651ce06..0b54bfa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
diaspora-installer (0.5.0.1+debian2) UNRELEASED; urgency=medium
* Provide diaspora.conf from diaspora-common (so it gets removed when purged)
+ * Don't run postinstall if database exist already
-- Pirate Praveen <praveen at debian.org> Sun, 10 May 2015 22:20:38 +0530
diff --git a/debian/diaspora-common.config b/debian/diaspora-common.config
index ed708ca..870441b 100644
--- a/debian/diaspora-common.config
+++ b/debian/diaspora-common.config
@@ -6,7 +6,6 @@ set -e
# source debconf stuff
. /usr/share/debconf/confmodule
-
# What is your pod address?
db_input high diaspora-common/url || true
db_go
@@ -15,29 +14,6 @@ db_go
db_input high diaspora-common/ssl || true
db_go
-# Get ssl choice
-db_get diaspora-common/ssl
-if [ "${RET}" = "true" ]; then
- db_go
- # Configure pod address.
- db_get diaspora-common/url
- echo "SSL enabled, configuring nginx for ${RET}..."
- /usr/lib/diaspora-common/scripts/set-env-nginx.sh ${RET}
- db_go
-else
- db_go
- # Configure pod address.
- db_get diaspora-common/url
- echo "SSL disabled, skip nginx configuration for ${RET}..."
- if ! grep SERVERNAME /etc/diaspora.conf
- then
- echo export SERVERNAME=${RET} >> /etc/diaspora.conf
- export SERVERNAME=${RET}
- echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> /etc/diaspora.conf
- fi
-
-fi
-
# DB password can be left blank
db_input high diaspora-common/dbpass || true
db_go
diff --git a/debian/diaspora-common.postinst b/debian/diaspora-common.postinst
index 9d9a094..31242a0 100755
--- a/debian/diaspora-common.postinst
+++ b/debian/diaspora-common.postinst
@@ -25,35 +25,65 @@ set -e
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
+if su diaspora -s /bin/sh -c "psql diaspora_production -c ''"
+then
+ echo "You already have a PostgreSQL database named 'diaspora_production'."
+ echo "Updating an existing diaspora installation is not supported yet."
+else
-. /usr/share/debconf/confmodule
-. /usr/share/dbconfig-common/dpkg/postinst.pgsql
-dbc_dbname="diaspora_production"
-dbc_dbuser="diaspora"
+ . /usr/share/debconf/confmodule
+ . /usr/share/dbconfig-common/dpkg/postinst.pgsql
-dbc_go diaspora-common $@
+ dbc_dbname="diaspora_production"
+ dbc_dbuser="diaspora"
-case "$1" in
- configure)
- . /etc/diaspora/diaspora-common.conf
- ${diaspora_scripts}/adduser.sh
- ${diaspora_scripts}/grantpriv.sh
- mkdir -p ${diaspora_nginx_log}
- mkdir -p ${diaspora_home}
- chown -R ${diaspora_user}: ${diaspora_home}
- ;;
+ dbc_go diaspora-common $@
- abort-upgrade|abort-remove|abort-deconfigure)
- ;;
+ case "$1" in
+ configure)
+ . /etc/diaspora/diaspora-common.conf
+ # Get ssl choice
+ db_get diaspora-common/ssl
+ if [ "${RET}" = "true" ]; then
+ db_go
+ # Configure pod address.
+ db_get diaspora-common/url
+ echo "SSL enabled, configuring nginx for ${RET}..."
+ /usr/lib/diaspora-common/scripts/set-env-nginx.sh ${RET}
+ db_go
+ else
+ db_go
+ # Configure pod address.
+ db_get diaspora-common/url
+ echo "SSL disabled, skip nginx configuration for ${RET}..."
+ if ! grep SERVERNAME /etc/diaspora.conf
+ then
+ echo export SERVERNAME=${RET} >> /etc/diaspora.conf
+ export SERVERNAME=${RET}
+ echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> /etc/diaspora.conf
+ fi
- *)
- echo "postinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
-esac
+ fi
-db_stop
+ ${diaspora_scripts}/adduser.sh
+ ${diaspora_scripts}/grantpriv.sh
+ mkdir -p ${diaspora_nginx_log}
+ mkdir -p ${diaspora_home}
+ chown -R ${diaspora_user}: ${diaspora_home}
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+ esac
+
+ db_stop
+fi
#DEBHELPER#
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/diaspora-installer.git
More information about the Pkg-ruby-extras-commits
mailing list