[DRE-commits] [diaspora-installer] 15/21: only preinst should check for staledb

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Mon May 11 12:36:49 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 e8eebc6b8a0edce743447f212114036e488053a0
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Mon May 11 16:22:04 2015 +0530

    only preinst should check for staledb
---
 debian/diaspora-common.postinst |  3 ---
 debian/diaspora-common.preinst  | 23 ++++++++++++++++-------
 debian/postinst                 |  3 ---
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/debian/diaspora-common.postinst b/debian/diaspora-common.postinst
index a737e70..38b64b0 100755
--- a/debian/diaspora-common.postinst
+++ b/debian/diaspora-common.postinst
@@ -43,9 +43,6 @@ case "$1" in
                 then
 	            echo "Trying update from ${installed_diaspora_version}..."
                 fi
-            else
-                ${diaspora_scripts}/messages.sh staledb 
-                exit 1
             fi
 
         else
diff --git a/debian/diaspora-common.preinst b/debian/diaspora-common.preinst
index da74de1..4d98dac 100755
--- a/debian/diaspora-common.preinst
+++ b/debian/diaspora-common.preinst
@@ -3,16 +3,25 @@ set -e
 
 case "$1" in
     upgrade)
+        # Check if PostgreSQL database diaspora_production exist
         if su diaspora -s /bin/sh -c "psql  diaspora_production -c ''"
         then
-            echo "You already have a PostgreSQL database named 'diaspora_production'."
-            # Show current version of package
-            installed_diaspora_version=`echo $2|cut -d+ -f1`
-            installed_diaspora_major_version=`echo ${installed_diaspora_version} |cut -d. -f1,2`
-            if test $(echo "${installed_diaspora_major_version} < 0.5" |bc) -eq 1
+            # Check if its an upgrade
+            if ! test -z $2
             then
-                echo "Updating from 0.4.x is not supported yet."
-	        exit 1
+                echo "You already have a PostgreSQL database named 'diaspora_production'."
+                # Show current version of package
+                installed_diaspora_version=`echo $2|cut -d+ -f1`
+                installed_diaspora_major_version=`echo ${installed_diaspora_version} |cut -d. -f1,2`
+                if test $(echo "${installed_diaspora_major_version} < 0.5" |bc) -eq 1
+                then
+                    echo "Updating from 0.4.x is not supported yet."
+	            exit 1
+                fi
+            else
+                # new install should not see existing database
+                ${diaspora_scripts}/messages.sh staledb 
+                exit 1
             fi
         fi
         ;;
diff --git a/debian/postinst b/debian/postinst
index 226355b..df6c38f 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -49,9 +49,6 @@ case "$1" in
                 else
                     echo "This version is already installed..."
                 fi
-            else
-                ${diaspora_scripts}/messages.sh staledb 
-                exit 1
             fi
         else
     	    echo "Download diaspora tarball from github.com..."

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