[Dbconfig-common-changes] [dbconfig-common] r294 - in branches/sqlite: doc internal

Matt Brown mattb-guest at costa.debian.org
Mon Aug 14 08:32:46 CEST 2006


Author: mattb-guest
Date: 2006-08-14 06:32:45 +0000 (Mon, 14 Aug 2006)
New Revision: 294

Modified:
   branches/sqlite/doc/dbconfig-common.sgml
   branches/sqlite/internal/sqlite
Log:
Reintroduce variables that can be used in a postinst script to hint at
the required owner and permissions for the generated database file.


Modified: branches/sqlite/doc/dbconfig-common.sgml
===================================================================
--- branches/sqlite/doc/dbconfig-common.sgml	2006-08-09 12:42:35 UTC (rev 293)
+++ branches/sqlite/doc/dbconfig-common.sgml	2006-08-14 06:32:45 UTC (rev 294)
@@ -406,6 +406,16 @@
 			<tag>dbc_dbtypes (used in: <var>config</var>)
 				<item>database types supported by the
 				package (defaults to: empty)
+			<tag>dbc_owner (used in: <var>postinst</var>)
+                <item>set the owner:group for the generated database file. This
+                option is only valid for databases like SQLite that use a
+                single file for storage and is not prompted via debconf.
+                (defaults to: root:root)
+			<tag>dbc_perms (used in: <var>postinst</var>)
+                <item>set the permissions for the generated database file. This
+                option is only valid for databases like SQLite that use a
+                single file for storage and is not prompted via debconf.
+                (defaults to: 0640)
 			<tag>dbc_generate_include (used in: <var>postinst</var>)
 				<item>format:outputfile pair for
 				an extra config to be generated by

Modified: branches/sqlite/internal/sqlite
===================================================================
--- branches/sqlite/internal/sqlite	2006-08-09 12:42:35 UTC (rev 293)
+++ branches/sqlite/internal/sqlite	2006-08-14 06:32:45 UTC (rev 294)
@@ -66,12 +66,18 @@
 ##
 ##
 dbc_sqlite_createdb(){
-	local ret l_dbfile
+	local ret l_dbfile l_owner l_perms
 	dbc_status=error
 
 	_dbc_sanity_check dbname sqlite || return 1
 
 	l_dbfile="${dbc_basepath}/${dbc_dbname}"
+	
+	# Default to root:root 0640 if the maintainer hasn't hinted otherwise
+	l_owner="root:root"
+	l_perms="0640"
+	if [ -n "$dbc_owner" ]; then l_owner="$dbc_owner"; fi
+	if [ -n "$dbc_perms" ]; then l_perms="$dbc_perms"; fi
 
 	dbc_logpart "creating database $dbc_dbname:"
 
@@ -82,8 +88,8 @@
 		ret=0
 		mkdir -p "${dbc_basepath}"
 		dbc_sqlite_exec_command ".schema" && \
-		chown root:root "$l_dbfile" && \
-		chmod 0640 "$l_dbfile" || ret=$?
+		chown "$l_owner" "$l_dbfile" && \
+		chmod "$l_perms" "$l_dbfile" || ret=$?
 		if [ "$ret" = "0" ]; then
 			dbc_logline "success"
 			dbc_logpart "verifying database $dbc_dbname exists:"




More information about the Dbconfig-common-changes mailing list