[Dbconfig-common-changes] [dbconfig-common] r219 - in trunk: debian
doc dpkg internal
Sean Finney
seanius at costa.debian.org
Tue May 23 07:19:52 UTC 2006
Author: seanius
Date: 2006-05-23 07:19:50 +0000 (Tue, 23 May 2006)
New Revision: 219
Modified:
trunk/debian/changelog
trunk/doc/dbconfig-common-using.html
trunk/dpkg/postinst
trunk/internal/common
Log:
- updated release line to UNRELEASED, as we haven't yet...
- added dbc_sql_substitution option and documentation
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2006-05-22 08:51:45 UTC (rev 218)
+++ trunk/debian/changelog 2006-05-23 07:19:50 UTC (rev 219)
@@ -1,9 +1,13 @@
-dbconfig-common (1.8.14) unstable; urgency=low
+dbconfig-common (1.8.14) UNRELEASED; urgency=low
+ * provide a new hint option dbc_sql_substitutions, which will pipe
+ all provided sql files through the template-based substitution
+ filter of dbconfig-generate-include before being processed
+ (closes: #366761).
* andrew mcmillan found a spelling error, so i ran aspell over all
the documentation :)
- -- sean finney <seanius at debian.org> Fri, 19 May 2006 01:19:24 -0500
+ -- sean finney <seanius at debian.org> Tue, 23 May 2006 09:06:54 +0200
dbconfig-common (1.8.13) unstable; urgency=low
Modified: trunk/doc/dbconfig-common-using.html
===================================================================
--- trunk/doc/dbconfig-common-using.html 2006-05-22 08:51:45 UTC (rev 218)
+++ trunk/doc/dbconfig-common-using.html 2006-05-23 07:19:50 UTC (rev 219)
@@ -380,6 +380,11 @@
<td>postinst
<td>specifies encoding for created postgres databases (same as createdb -E)
<td>empty
+<tr>
+<td>dbc_sql_substitutions
+<td>postinst
+<td>if nonempty, specifies that sql files should be piped through a template substitution filter (dbconfig-generate-include -f template) before being executed.
+<td>empty
</table>
<a name="debugging">
Modified: trunk/dpkg/postinst
===================================================================
--- trunk/dpkg/postinst 2006-05-22 08:51:45 UTC (rev 218)
+++ trunk/dpkg/postinst 2006-05-23 07:19:50 UTC (rev 219)
@@ -2,7 +2,7 @@
### load up common variables and functions
###
dbc_go(){
- local prev_dbc_upgrade importing_from_non_dbc upgrading f
+ local prev_dbc_upgrade importing_from_non_dbc upgrading f tsubstfile
. /usr/share/dbconfig-common/dpkg/common
dbc_debug "(postinst) dbc_go() $@"
@@ -98,7 +98,14 @@
if [ -f "$dbc_sqlfile_adm" ]; then
dbc_logpart "populating database via administrative sql... "
- $dbc_sqlfile_cmd $dbc_sqlfile_adm || dbc_install_error "populating database with administrative sql"
+ if [ ! "$dbc_sql_substitutions" ]; then
+ $dbc_sqlfile_cmd $dbc_sqlfile_adm || dbc_install_error "populating database with administrative sql"
+ else
+ tsubstfile=`dbc_mktemp`
+ /usr/sbin/dbconfig-generate-include -f template -o template_infile=$dbc_sqlfile_adm $dbc_packageconfig > $tsubstfile
+ $dbc_sqlfile_cmd $tsubstfile || dbc_install_error "populating database with administrative sql"
+ rm -f $tsubstfile
+ fi
[ "$dbc_tried_again" ] && return 0
dbc_logline "done"
fi
@@ -106,7 +113,14 @@
if [ -f "$dbc_sqlfile" ]; then
dbc_logpart "populating database via sql... "
_dbc_asuser="yes"
- $dbc_sqlfile_cmd $dbc_sqlfile || dbc_install_error "populating database"
+ if [ ! "$dbc_sql_substitutions" ]; then
+ $dbc_sqlfile_cmd $dbc_sqlfile || dbc_install_error "populating database"
+ else
+ tsubstfile=`dbc_mktemp`
+ /usr/sbin/dbconfig-generate-include -f template -o template_infile=$dbc_sqlfile $dbc_packageconfig > $tsubstfile
+ $dbc_sqlfile_cmd $tsubstfile || dbc_install_error "populating database"
+ rm -f $tsubstfile
+ fi
_dbc_asuser=""
[ "$dbc_tried_again" ] && return 0
dbc_logline "done"
Modified: trunk/internal/common
===================================================================
--- trunk/internal/common 2006-05-22 08:51:45 UTC (rev 218)
+++ trunk/internal/common 2006-05-23 07:19:50 UTC (rev 219)
@@ -184,3 +184,21 @@
shift
done
}
+
+dbc_mktemp(){
+ local tfile ttemplate
+ if [ "$1" ]; then
+ ttemplate="$1";
+ else
+ ttemplate="dbconfig-common.XXXXXX";
+ fi
+
+ tfile=`mktemp -t $ttemplate`
+ if [ ! -f $tfile ]; then
+ dbc_error="error creating temporary file"
+ dbc_logline "error creating temporary file"
+ return 1
+ else
+ echo $tfile
+ fi
+}
More information about the Dbconfig-common-changes
mailing list