[Dbconfig-common-devel] dbconfig-common/dpkg common,1.30,1.31 postinst,1.12,1.13 prerm,1.9,1.10
seanius@haydn.debian.org
seanius@haydn.debian.org
Update of /cvsroot/dbconfig-common/dbconfig-common/dpkg
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv3218/dpkg
Modified Files:
common postinst prerm
Log Message:
if you retried, the code past the part where you retried would get
executed twice. i think this should fix it
Index: common
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/common,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- common 18 May 2005 19:56:15 -0000 1.30
+++ common 18 May 2005 20:19:37 -0000 1.31
@@ -343,13 +343,16 @@
dbc_go $dbc_package configure $dbc_oldversion
. /usr/share/dbconfig-common/dpkg/postinst
dbc_go $dbc_package $dbc_command $dbc_oldversion
+ dbc_tried_again="yes"
fi
if [ "$_dbc_on_error_option" = "retry (skip questions)" ]; then
echo "dbconfig-common: $dbc_package $dbc_command: trying again (skip questions)." >&2
. /usr/share/dbconfig-common/dpkg/postinst
dbc_go $dbc_package $dbc_command $dbc_oldversion
+ dbc_tried_again="yes"
fi
+
}
##
@@ -386,12 +389,14 @@
dbc_go $dbc_package configure $dbc_oldversion
. /usr/share/dbconfig-common/dpkg/postinst
dbc_go $dbc_package $dbc_command $dbc_oldversion
+ dbc_tried_again="yes"
fi
if [ "$_dbc_on_error_option" = "retry (skip questions)" ]; then
echo "dbconfig-common: $dbc_package $dbc_command: trying again." >&2
. /usr/share/dbconfig-common/dpkg/postinst
dbc_go $dbc_package $dbc_command $dbc_oldversion
+ dbc_tried_again="yes"
fi
}
@@ -429,6 +434,7 @@
dbc_go $dbc_package configure $dbc_oldversion
. /usr/share/dbconfig-common/dpkg/postinst
dbc_go $dbc_package $dbc_command $dbc_oldversion
+ dbc_tried_again="yes"
fi
}
Index: postinst
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/postinst,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- postinst 18 May 2005 19:49:38 -0000 1.12
+++ postinst 18 May 2005 20:19:37 -0000 1.13
@@ -59,12 +59,13 @@
### now, create the app user account
###
$dbc_createuser_cmd || dbc_install_error "creating user"
- # that was easy, now, wasn't it? :)
+ [ "$dbc_tried_again" = "yes" ] && return 0
###
### create the database
###
$dbc_createdb_cmd || dbc_install_error "creating database"
+ [ "$dbc_tried_again" = "yes" ] && return 0
###
### populate the database
@@ -74,12 +75,14 @@
dbc_scriptfile=$dbc_share/scripts/$dbc_package/install/$dbc_dbtype
if [ -f "$dbc_sqlfile" ]; then
$dbc_sqlfile_cmd $dbc_sqlfile || dbc_install_error "populating database"
+ [ "$dbc_tried_again" = "yes" ] && return 0
fi
if [ -f "$dbc_scriptfile" ]; then
if ! sh -c "$dbc_scriptfile $*"; then
dbc_error="$dbc_scriptfile exited with non-zero status"
dbc_install_error "populating database"
+ [ "$dbc_tried_again" = "yes" ] && return 0
fi
fi
@@ -89,6 +92,7 @@
if dpkg --compare-versions "$dbc_first_version" gt "$dbc_oldversion"; then
if ! $dbc_checkuser_command; then
upgrade_error "importing dbconfig-settings"
+ [ "$dbc_tried_again" = "yes" ] && return 0
fi
fi
@@ -146,6 +150,7 @@
# execute the script
echo dbconfig-common: upgrading with $_dbc_f >&2
$dbc_sqlfile_cmd $_dbc_f || dbc_upgrade_error "processing $_dbc_f"
+ [ "$dbc_tried_again" = "yes" ] && return 0
done
# likewise for any scripts
@@ -156,6 +161,7 @@
if ! sh -c "$_dbc_f $*"; then
dbc_error="$_dbc_f exited with non-zero status"
dbc_upgrade_error "processing $_dbc_f"
+ [ "$dbc_tried_again" = "yes" ] && return 0
fi
done
fi
Index: prerm
===================================================================
RCS file: /cvsroot/dbconfig-common/dbconfig-common/dpkg/prerm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- prerm 1 May 2005 17:20:32 -0000 1.9
+++ prerm 18 May 2005 20:19:37 -0000 1.10
@@ -83,6 +83,7 @@
$dbc_dump_cmd > $_dbc_dbfile
echo dbconfig-common: dropping $dbc_dbtype database $dbc_dbname >&2
$dbc_dropdb_cmd || dbc_remove_error "dropping database"
+ [ "$dbc_tried_again" = "yes" ] && return 0
echo dbconfig-common: revoking privileges for user $dbc_dbuser on $dbc_dbname > /dev/stderr
$dbc_dropuser_cmd