[Dbconfig-common-devel] dbconfig-common/dpkg common,1.25,1.26

xerakko-guest@haydn.debian.org xerakko-guest@haydn.debian.org


Update of /cvsroot/dbconfig-common/dbconfig-common/dpkg
In directory haydn:/tmp/cvs-serv24209/dpkg

Modified Files:
	common 
Log Message:


Initial works on retry/abort when install/upgrade/remove fails


Index: common
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/common,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- common	7 May 2005 23:05:53 -0000	1.25
+++ common	13 May 2005 16:04:33 -0000	1.26
@@ -316,15 +316,27 @@
 	db_subst $dbc_package/install-error error $dbc_error
 	db_input critical $dbc_package/install-error || true
 	db_go || true
+	db_get $dbc_package/install-error
+	_dbc_on_error_option="$RET"
+	
 	# forget that we've seen all the debconf questions
 	for f in $dbc_register_templates; do
 		db_fset $dbc_package/$f seen false
 	done
 	# and blank the password
-	dbc_forget_dbadmin_password
-	dbc_forget_app_password
-	dbc_postinst_cleanup
+	# dbc_forget_dbadmin_password
+	# dbc_forget_app_password
+	
+	if [ "$_dbc_on_error_option" = "abort" ]; then
+	echo "$dbc_package $dbc_command: aborted." >&2
+        dbc_postinst_cleanup
 	exit 1
+	fi
+	
+	if [ "$_dbc_on_error_option" = "retry" ]; then
+	echo "$dbc_package $dbc_command: retrying." >&2
+	dbc_go $dbc_package $dbc_command $dbc_oldversion 
+	fi
 }
 
 ##
@@ -338,7 +350,28 @@
 	db_subst $dbc_package/upgrade-error dbfile $dbc_dbfile
 	db_input critical $dbc_package/upgrade-error || true
 	db_go || true
-	dbc_postinst_cleanup
+        db_get $dbc_package/upgrade-error
+        _dbc_on_error_option="$RET"
+
+        # forget that we've seen all the debconf questions
+        for f in $dbc_register_templates; do
+               db_fset $dbc_package/$f seen false
+        done
+        # and blank the password
+        # dbc_forget_dbadmin_password
+        # dbc_forget_app_password
+	
+        if [ "$_dbc_on_error_option" = "abort" ]; then
+        echo "$dbc_package $dbc_command: aborted." >&2
+        dbc_postinst_cleanup
+        exit 1
+        fi
+
+        if [ "$_dbc_on_error_option" = "retry" ]; then
+        echo "$dbc_package $dbc_command: retrying." >&2
+        dbc_go $dbc_package $dbc_command $dbc_oldversion
+        fi
+
 	exit 1
 }
 
@@ -352,7 +385,26 @@
 	db_subst $dbc_package/remove-error error $dbc_error
 	db_input critical $dbc_package/remove-error || true
 	db_go || true
-	dbc_postinst_cleanup
+
+        db_get $dbc_package/remove-error
+        _dbc_on_error_option="$RET"
+
+        # forget that we've seen all the debconf questions
+        for f in $dbc_register_templates; do
+               db_fset $dbc_package/$f seen false
+        done
+        
+	if [ "$_dbc_on_error_option" = "abort" ]; then
+        echo "$dbc_package $dbc_command: aborted." >&2
+        dbc_postinst_cleanup
+        exit 1
+        fi
+
+        if [ "$_dbc_on_error_option" = "retry" ]; then
+        echo "$dbc_package $dbc_command: retrying." >&2
+        dbc_go $dbc_package $dbc_command $dbc_oldversion
+        fi
+	
 	exit 1
 }