[DRE-commits] [diaspora-installer] 08/12: use DB=postgresql and cleanup
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Sun Aug 28 05:18:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository diaspora-installer.
commit 03150db9f90a40b8b991bcde4e387ebb8f1a1c5a
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Sun Aug 28 09:00:45 2016 +0530
use DB=postgresql and cleanup
---
debian/postinst | 48 ++++++++++++++++++++----------------------------
set-env-diaspora.sh | 5 ++++-
2 files changed, 24 insertions(+), 29 deletions(-)
diff --git a/debian/postinst b/debian/postinst
index 84104d5..8b9caf4 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -25,30 +25,6 @@ set -e
# installation fails and the `postinst' is called with `abort-upgrade',
# `abort-remove' or `abort-deconfigure'.
-# Run migrations are start diaspora
-
-migrate() {
- echo "Initializing database..."
- su diaspora -s /bin/sh -c 'bundle exec rake db:create db:schema:load'
-
- echo "Running migrations..."
- su diaspora -s /bin/sh -c 'bundle exec rake db:migrate'
- su diaspora -s /bin/sh -c 'bundle exec rake tmp:cache:clear assets:precompile'
- echo "Remove backup..."
- rm -rf ${diaspora_home}-backup.*
-
- echo "Starting diaspora..."
- service diaspora restart
-}
-
-install_gems() {
-# Needs latest bundler
-# Needs eye for init script
- gem install bundler
- ln -sf /usr/local/bin/bundle ${diaspora_home}/bin/bundle
- # https://github.com/hyperic/sigar/issues/60
- su diaspora -s /bin/sh -c "bundle config --local build.sigar '--with-cppflags=\"-fgnu89-inline\"'"
-}
case "$1" in
configure)
@@ -62,14 +38,30 @@ case "$1" in
. /usr/lib/diaspora-common/scripts/set-env-diaspora.sh
export RAILS_ENV=$RAILS_ENV DB=$DB ENVIRONMENT_URL=$ENVIRONMENT_URL
- # Install special case gems
- install_gems
+ echo "Installing latest version of bundler..."
+ gem install bundler
+ ln -sf /usr/local/bin/bundle ${diaspora_home}/bin/bundle
+
+ echo "Setting build flags for Sigar as workaround for \
+https://github.com/hyperic/sigar/issues/60 ..."
+ su diaspora -s /bin/sh -c "bundle config --local build.sigar '--with-cppflags=\"-fgnu89-inline\"'"
echo "Installing gems with rubygems ..."
- su diaspora -s /bin/sh -c "bundle install --path vendor/bundle --with postgresql --without development test"
+ su diaspora -s /bin/sh -c "bundle install --path vendor/bundle --with $DB --without development test"
+
+ echo "Initializing database..."
+ su diaspora -s /bin/sh -c 'bundle exec rake db:create db:schema:load'
echo "Running migrations..."
- migrate
+ su diaspora -s /bin/sh -c 'bundle exec rake db:migrate'
+
+ echo "Precompiling assets..."
+ su diaspora -s /bin/sh -c 'bundle exec rake tmp:cache:clear assets:precompile'
+ echo "Remove backup..."
+ rm -rf ${diaspora_home}-backup.*
+
+ echo "Starting diaspora..."
+ service diaspora start
echo "Running final rake tasks..."
. /usr/lib/diaspora-common/scripts/rake-tasks.sh
diff --git a/set-env-diaspora.sh b/set-env-diaspora.sh
index 1efb21c..df0e65d 100755
--- a/set-env-diaspora.sh
+++ b/set-env-diaspora.sh
@@ -8,7 +8,10 @@ if ! grep RAILS_ENV ${diaspora_conf_private}
fi
if ! grep DB ${diaspora_conf_private}
- then echo export DB=postgres >> ${diaspora_conf_private}
+ then echo export DB=postgresql >> ${diaspora_conf_private}
+ # Diaspora versions before 0.6 used DB=postgres
+ # Now it uses --with postgresql
+ else sed -i 's/postgres/postgresql/' ${diaspora_conf_private}
fi
# source diaspora variables
--
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