[DRE-commits] [diaspora-installer] 24/55: use variables for paths

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Mon Dec 8 12:41:24 UTC 2014


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository diaspora-installer.

commit 4f87e925209ee18a6d3903ef5b494f6be01e8018
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Tue Dec 2 20:24:19 2014 +0530

    use variables for paths
---
 debian/postinst | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/debian/postinst b/debian/postinst
index a10cf06..666e2ef 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -37,34 +37,42 @@ dbc_go diaspora-installer $@
 case "$1" in
     configure)
 	export diaspora_version=0.4.1.2
-	/usr/lib/diaspora-installer/scripts/adduser.sh
-	/usr/lib/diaspora-installer/scripts/grantpriv.sh
-	mkdir -p /var/log/diaspora
-	chown -R diaspora: /usr/share/diaspora
-	cd /usr/share/diaspora
+	export diaspora_user=diaspora
+	export diaspora_conf=/etc/diaspora.conf
+	export diaspora_home=/usr/share/diaspora
+	export diaspora_cache=/var/cache/diaspora-installer
+	export diaspora_scripts=/usr/lib/diaspora-installer/scripts
+	export diaspora_nginx_log=/var/log/diaspora
+
+	${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 /var/cache/diaspora-installer
-	if ! test -f /var/cache/diaspora-installer/diaspora-${diaspora_version}.tar.gz
+	mkdir -p ${diaspora_cache}
+	if ! test -f ${diaspora_cache}/diaspora-${diaspora_version}.tar.gz
 		then 
-			wget -O /var/cache/diaspora-installer/diaspora-${diaspora_version}.tar.gz https://github.com/diaspora/diaspora/archive/v${diaspora_version}.tar.gz
+			wget -O ${diaspora_cache}/diaspora-${diaspora_version}.tar.gz https://github.com/diaspora/diaspora/archive/v${diaspora_version}.tar.gz
 	fi
 	echo "Already downloaded..."
 	echo "Extracting files..."
-	tar -C /var/cache/diaspora-installer -zxvf /var/cache/diaspora-installer/diaspora-${diaspora_version}.tar.gz
-	echo "Copying files to /usr/share/diaspora..."
-	sudo -u diaspora cp -r /var/cache/diaspora-installer/diaspora-${diaspora_version}/* /usr/share/diaspora
+	tar -C ${diaspora_cache} -zxvf ${diaspora_cache}/diaspora-${diaspora_version}.tar.gz >/dev/null
+	echo "Copying files to ${diaspora_home}..."
+	sudo -u ${diaspora_user} cp -r ${diaspora_cache}/diaspora-${diaspora_version}/* ${diaspora_home}
 	echo "Installing gems with rubygems ..."
-	
-	if ! grep RAILS_ENV /etc/diaspora.conf
-		then echo export RAILS_ENV=production >> /etc/diaspora.conf
+	echo "Using ${diaspora_conf}..."
+	if ! grep RAILS_ENV ${diaspora_conf}
+		then echo export RAILS_ENV=production >> ${diaspora_conf}
 	fi
 
-	if ! grep DB /etc/diaspora-diaspora.conf 
-		then echo export DB=postgres >> /etc/diaspora.conf
+	if ! grep DB ${diaspora_conf} 
+		then echo export DB=postgres >> ${diaspora_conf}
 	fi
 	
 	# source diaspora variables	
-	. /etc/diaspora.conf
+	. ${diaspora_conf}
+	echo RAILS_ENV=$RAILS_ENV DB=$DB ENVIRONMENT_URL=$ENVIRONMENT_URL
 	echo "Verifying we have all required libraries..."
 	sudo -u diaspora -E bundle install --path vendor/bundle
 	echo "Initializing database..."
@@ -77,7 +85,7 @@ case "$1" in
 	echo "And reload nginx, run # /etc/init.d  nginx reload"
 	echo "visit your pod at $ENVIRONMENT_URL"
 	echo "To stop diaspora, run # killall -9 unicorn_rails foreman sidekiq"
-	echo "To see the service status, run # tail -f /usr/share/diaspora/nohup.out"
+	echo "To see the service status, run # tail -f ${diaspora_home}/nohup.out"
    ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

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