import postinst from diaspora

This commit is contained in:
Praveen Arimbrathodiyil 2015-09-12 15:42:12 +05:30
parent 0a035406b7
commit 80939adbee
3 changed files with 91 additions and 0 deletions

7
debian/gitlab-debian.conf vendored Normal file
View file

@ -0,0 +1,7 @@
export gitlab_user=gitlab
export gitlab_conf=/etc/gitlab.conf
export gitlab_home=/usr/share/gitlab
export gitlab_scripts=/usr/lib/gitlab/scripts
export gitlab_nginx_log=/var/log/gitlab
export gitlab_ssl_path=/etc/gitlab/ssl

59
debian/postinst vendored Executable file
View file

@ -0,0 +1,59 @@
#! /bin/sh
# postinst script for gitlab
# 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'.
case "$1" in
configure)
. /etc/gitlab/gitlab-debian.conf
chown -R ${gitlab_user}: ${gitlab_home}
cd ${diaspora_home}
echo "Setting up environment varibales..."
export RAILS_ENV=production
export DB=postgres
echo "Verifying we have all required libraries..."
sudo -u diaspora -E bundle install --local
echo "Running final rake tasks..."
# Move these to rails-common
#. /usr/lib/diaspora-common/scripts/rake-tasks.sh
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

25
debian/rake-tasks.sh vendored Executable file
View file

@ -0,0 +1,25 @@
#! /bin/sh
# Read configuration values
. /etc/diaspora/diaspora-common.conf
echo "Initializing database..."
su diaspora -s /bin/sh -c 'bundle exec rake db:create db:schema:load'
echo "Precompiling assets..."
su diaspora -s /bin/sh -c 'bundle exec rake assets:precompile'
su diaspora -s /bin/sh -c 'touch public/source.tar.gz'
#Starting diaspora service...
invoke-rc.d diaspora start
if grep https ${diaspora_conf}
then
mkdir -p ${diaspora_ssl_path}
echo "Copy $SERVERNAME-bundle.pem and $SERVERNAME.key to /etc/diaspora/ssl"
echo "And reload nginx, run # /etc/init.d/nginx reload"
fi
echo "To stop diaspora, run # /etc/init.d/diaspora stop"
echo "To see the service status, run # /etc/init.d/diaspora status"
echo "To start diaspora service, run # /etc/init.d/diaspora start"
echo "Visit your pod at $ENVIRONMENT_URL"