[DRE-commits] [diaspora-installer] 11/13: changes for big upstream update

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Tue May 19 13:29:49 UTC 2015


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

praveen pushed a commit to branch 04x-05x_update
in repository diaspora-installer.

commit d01ebc5826c5fafcea5dc1a45aa9af847ffc71d4
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Tue May 19 18:56:46 2015 +0530

    changes for big upstream update
---
 debian/postinst | 80 +++++++++++++++++++++++++++++++--------------------------
 1 file changed, 43 insertions(+), 37 deletions(-)

diff --git a/debian/postinst b/debian/postinst
index 71c38d6..07aac2c 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -33,53 +33,59 @@ case "$1" in
 	cd ${diaspora_home}
         if ! test -z $2
         then
-            installed_diaspora_version=`echo $2|cut -d+ -f1`
-            installed_diaspora_minor_version=`echo ${installed_diaspora_version} |cut -d. -f3,4`
-            diaspora_minor_version=`echo ${diaspora_version} |cut -d. -f3,4`
-            if test $(echo "${installed_diaspora_minor_version} < ${diaspora_minor_version}" |bc) -eq 1
-            then
-                echo "Running migrations..."
-                echo "Some migrations may take upto 2 hours in large pods..."
+            # Find our major and minor versions of diaspora
+            . /usr/lib/diaspora-common/scripts/diaspora-versions.sh
 
+            if test $(echo "${installed_diaspora_major_version} < 0.5" |bc) -eq 1
+            then
                 # source diaspora variables	
                 . ${diaspora_conf}
-                su diaspora -s /bin/sh -c 'bundle install --without development test'
+                echo "This update involves long running migrations..."
+                echo "Some migrations may take upto 2 hours in large pods..."
+               # Download diaspora from github
+                . /usr/lib/diaspora-common/scripts/diaspora-download.sh
+
+	        cd ${diaspora_home}
+                # Update bundler
+                gem install bundler
+
+                su diaspora -s /bin/sh -c 'bundle install'
+                echo "Running migrations..."
                 su diaspora -s /bin/sh -c 'bundle exec rake db:migrate'
-                su diaspora -s /bin/sh -c 'bundle exec rake assets:precompile'
+                su diaspora -s /bin/sh -c 'bundle exec rake tmp:cache:clear assets:precompile'
+                su diaspora -s /bin/sh -c "sed -i s/Rails.application.config.secret_token/Diaspora::Application.config.secret_key_base/ ${diaspora_hme}/config/initializers/secret_token.rb"
+                 
             else
-                echo "This version is already installed..."
+                if test $(echo "${installed_diaspora_minor_version} < ${diaspora_minor_version}" |bc) -eq 1
+                then
+                    # Download diaspora from github
+                    . /usr/lib/diaspora-common/scripts/diaspora-download.sh
+
+	            cd ${diaspora_home}
+                    # source diaspora variables	
+                    . ${diaspora_conf}
+                    # Update bundler
+                    gem install bundler
+
+                    su diaspora -s /bin/sh -c 'bundle install --without development test'
+                    echo "Running migrations..."
+                    su diaspora -s /bin/sh -c 'bundle exec rake db:migrate'
+                    su diaspora -s /bin/sh -c 'bundle exec rake assets:precompile'
+                else
+                    echo "This version is already installed..."
+                fi
             fi
         else
-    	    echo "Download diaspora tarball from github.com..."
-	    mkdir -p ${diaspora_cache}
-	    if ! test -f ${diaspora_cache}/diaspora-${diaspora_version}.tar.gz
-	    then 
-	        if test ${diaspora_release_type} = "branch"
-		then
-		    wget -O ${diaspora_cache}/diaspora-${diaspora_version}.tar.gz ${github_archive_url}/release/${diaspora_version}.tar.gz
-		    export diaspora_archive="diaspora-release-${diaspora_version}"
-		else
-		    wget -O ${diaspora_cache}/diaspora-${diaspora_version}.tar.gz ${github_archive_url}/v${diaspora_version}.tar.gz
-		    export diaspora_archive="diaspora-${diaspora_version}"
-		fi
-            fi
-            echo "Already downloaded..."
-            echo "Extracting files..."
-            tar -C ${diaspora_cache} -zxvf ${diaspora_cache}/diaspora-${diaspora_version}.tar.gz >/dev/null
-            echo "Copying files to ${diaspora_home}..."
-	    # Use system binaries from /usr/bin
-            echo "diaspora archive: ${diaspora_archive}"
-	    rm -rf ${diaspora_cache}/${diaspora_archive}/bin
-	    cp -r ${diaspora_cache}/${diaspora_archive}/* ${diaspora_home}
-	    chown -R ${diaspora_user}: ${diaspora_home}
-
-	    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 "Setting up environment varibales..."
+            # Download diaspora from github
+            . /usr/lib/diaspora-common/scripts/diaspora-download.sh
+	    cd ${diaspora_home}
+            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
 
+            # Update bundler
+             gem install bundler
+
 	    echo "Installing gems with rubygems ..."
 	    sudo -u diaspora -E -H bundle install --path vendor/bundle --without development test
 

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