[DRE-commits] [diaspora-installer] 01/01: move db config, debconf to diaspora-common
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Sat May 2 10:41:24 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 bb59b099f943e70d432fba81ef9c869259b34bc6
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Sat May 2 16:08:47 2015 +0530
move db config, debconf to diaspora-common
- move env variable setup to diaspora-common
---
debian/{config => diaspora-common.config} | 6 +--
debian/diaspora-common.install | 1 +
debian/diaspora-common.postinst | 59 +++++++++++++++++++++++++
debian/{templates => diaspora-common.templates} | 2 +-
debian/postinst | 29 ++----------
set-env-diaspora.sh | 16 +++++++
6 files changed, 84 insertions(+), 29 deletions(-)
diff --git a/debian/config b/debian/diaspora-common.config
similarity index 83%
rename from debian/config
rename to debian/diaspora-common.config
index 85b22e9..dc0863b 100644
--- a/debian/config
+++ b/debian/diaspora-common.config
@@ -13,15 +13,15 @@ if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then
dbc_dbname="diaspora_production"
dbc_dbuser="diaspora"
- dbc_go diaspora-installer $@
+ dbc_go diaspora-common $@
fi
# What is your pod address?
-db_input high diaspora-installer/url || true
+db_input high diaspora-common/url || true
db_go
# Configure pod address.
-db_get diaspora-installer/url
+db_get diaspora-common/url
/usr/lib/diaspora-common/scripts/set-env-nginx.sh $RET
diff --git a/debian/diaspora-common.install b/debian/diaspora-common.install
index 28e7abc..af4844e 100644
--- a/debian/diaspora-common.install
+++ b/debian/diaspora-common.install
@@ -1,4 +1,5 @@
adduser.sh usr/lib/diaspora-common/scripts
grantpriv.sh usr/lib/diaspora-common/scripts
set-env-nginx.sh usr/lib/diaspora-common/scripts
+set-env-diaspora.sh usr/lib/diaspora-common/scripts
diaspora-common.conf /etc/diaspora
diff --git a/debian/diaspora-common.postinst b/debian/diaspora-common.postinst
new file mode 100755
index 0000000..b7ea57b
--- /dev/null
+++ b/debian/diaspora-common.postinst
@@ -0,0 +1,59 @@
+#! /bin/sh
+# postinst script for diaspora-installer
+# copied from postinst script for hplip
+# $Id: hplip.postinst,v 1.1 2005/10/15 21:39:04 hmh Exp $
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+# quoting from the policy:
+# Any necessary prompting should almost always be confined to the
+# post-installation script, and should be protected with a conditional
+# so that unnecessary prompting doesn't happen if a package's
+# installation fails and the `postinst' is called with `abort-upgrade',
+# `abort-remove' or `abort-deconfigure'.
+
+
+. /usr/share/debconf/confmodule
+. /usr/share/dbconfig-common/dpkg/postinst.pgsql
+
+dbc_dbname="diaspora_production"
+dbc_dbuser="diaspora"
+
+dbc_go diaspora-common $@
+
+case "$1" in
+ configure)
+ . /etc/diaspora/diaspora-common.conf
+ ${diaspora_scripts}/adduser.sh
+ ${diaspora_scripts}/grantpriv.sh
+ mkdir -p ${diaspora_nginx_log}
+ 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
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/templates b/debian/diaspora-common.templates
similarity index 93%
rename from debian/templates
rename to debian/diaspora-common.templates
index 0a2faa1..2351892 100644
--- a/debian/templates
+++ b/debian/diaspora-common.templates
@@ -1,4 +1,4 @@
-Template: diaspora-installer/url
+Template: diaspora-common/url
Type: string
Default: localhost
_Description: Host name for this instance of Diaspora:
diff --git a/debian/postinst b/debian/postinst
index b61345f..e8f8076 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -26,21 +26,9 @@ set -e
# `abort-remove' or `abort-deconfigure'.
-. /usr/share/debconf/confmodule
-. /usr/share/dbconfig-common/dpkg/postinst.pgsql
-
-dbc_dbname="diaspora_production"
-dbc_dbuser="diaspora"
-
-dbc_go diaspora-installer $@
-
case "$1" in
configure)
. /etc/diaspora/diaspora-common.conf
- ${diaspora_scripts}/adduser.sh
- ${diaspora_scripts}/grantpriv.sh
- mkdir -p ${diaspora_nginx_log}
- chown -R ${diaspora_user}: ${diaspora_home}
cd ${diaspora_home}
echo "Download diaspora tarball from github.com..."
mkdir -p ${diaspora_cache}
@@ -67,20 +55,12 @@ case "$1" in
fi
echo "Copying source tarball to ${diaspora_home}/public..."
sudo -u ${diaspora_user} cp ${diaspora_cache}/diaspora-${diaspora_version}.tar.gz ${diaspora_home}/public/source.tar.gz
- echo "Installing gems with rubygems ..."
- echo "Using ${diaspora_conf}..."
- if ! grep RAILS_ENV ${diaspora_conf}
- then echo export RAILS_ENV=production >> ${diaspora_conf}
- fi
-
- if ! grep DB ${diaspora_conf}
- then echo export DB=postgres >> ${diaspora_conf}
- fi
- # source diaspora variables
- . ${diaspora_conf}
+ echo "Setting up environment varibales..."
+ . /usr/lib/diaspora-common/scripts/set-env-diaspora.sh
echo RAILS_ENV=$RAILS_ENV DB=$DB ENVIRONMENT_URL=$ENVIRONMENT_URL
- echo "Verifying we have all required libraries..."
+
+ echo "Installing gems with rubygems ..."
sudo -u diaspora -E bundle install --path vendor/bundle
echo "Initializing database..."
sudo -u diaspora -E bundle exec rake db:create db:schema:load
@@ -108,7 +88,6 @@ case "$1" in
;;
esac
-db_stop
#DEBHELPER#
diff --git a/set-env-diaspora.sh b/set-env-diaspora.sh
new file mode 100755
index 0000000..23bf3bf
--- /dev/null
+++ b/set-env-diaspora.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+# Read configuration from file
+. /etc/diaspora/diaspora-common.conf
+echo "Using ${diaspora_conf}..."
+if ! grep RAILS_ENV ${diaspora_conf}
+ then echo export RAILS_ENV=production >> ${diaspora_conf}
+fi
+
+if ! grep DB ${diaspora_conf}
+ then echo export DB=postgres >> ${diaspora_conf}
+fi
+
+# source diaspora variables
+. ${diaspora_conf}
+
--
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