[Webapps-common-discuss] [commit] r115 - in webapps-common/trunk: dpkg examples/webapp-apache-dbapp-example/debian

seanius at alioth.debian.org seanius at alioth.debian.org
Fri Jun 22 13:09:52 UTC 2007


Author: seanius
Date: 2007-06-22 13:09:52 +0000 (Fri, 22 Jun 2007)
New Revision: 115

Modified:
   webapps-common/trunk/dpkg/common
   webapps-common/trunk/dpkg/config
   webapps-common/trunk/dpkg/postinst
   webapps-common/trunk/dpkg/postrm
   webapps-common/trunk/dpkg/prerm
   webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/config
   webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postinst
   webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postrm
   webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/prerm
Log:
er, do it this way

Modified: webapps-common/trunk/dpkg/common
===================================================================
--- webapps-common/trunk/dpkg/common	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/dpkg/common	2007-06-22 13:09:52 UTC (rev 115)
@@ -434,24 +434,23 @@
 }
 
 ###
-###	map an instance name to a filename
+###	map an instance name to a dbconfig_generate_include compatible config
 ##	requires: wc_generate_include
-##  wc_generate_include is in the form "mode:basedir:basename:extension"
+##  wc_generate_include is in the form "mode:basename:extension"
 #
-##	usage: wc_includefile_name instance
+##	usage: wc_to_dbc_generate_include instance
 ###
-wc_includefile_name(){
+wc_to_dbc_generate_include(){
 	local instance mode based basef ext siteid
 	instance=$1
-	based=`echo $wc_generate_include | cut -d: -f2`
-	based=`echo $wc_generate_include | cut -d: -f2`
-	basef=`echo $wc_generate_include | cut -d: -f3`
-	ext=`echo $wc_generate_include | cut -d: -f4`
+	mode=`echo $wc_generate_include | cut -d: -f1`
+	basef=`echo $wc_generate_include | cut -d: -f2`
+	ext=`echo $wc_generate_include | cut -d: -f3`
 	if [ "$ext" ]; then
 		ext=".$ext"
 	fi
 	siteid=`wc_debian_siteid $instance`
-	echo "$based/${basef}_${siteid}${ext}"
+	echo "${mode}:${based}/${basef}${siteid}${ext}"
 }
 
 
@@ -474,7 +473,7 @@
 ##
 ##  usage: wc_debian_siteid instance
 wc_debian_siteid(){
-	echo $1 | md5sum
+	echo $1 | md5sum | awk '{print $1}'
 }
 
 ###
@@ -543,7 +542,7 @@
 wc_gen_unique_user(){
 	local u
 	u=`echo $1 | dd bs=1 count=8 2>/dev/null`
-	u="${u}`echo $2 | md5sum | dd bs=1 count=8 2>/dev/null`"
+	u="${u}`wc_debian_siteid | dd bs=1 count=8 2>/dev/null`"
 	echo $u
 }
 
@@ -557,7 +556,7 @@
 wc_gen_unique_db(){
 	local d
 	d=`echo $1 | tr -d +-. | dd bs=1 count=12 2>/dev/null`
-	d="${d}`echo $2 | md5sum | dd bs=1 count=16 2>/dev/null`"
+	d="${d}`wc_debian_siteid | dd bs=1 count=16 2>/dev/null`"
 	echo $d
 }
 

Modified: webapps-common/trunk/dpkg/config
===================================================================
--- webapps-common/trunk/dpkg/config	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/dpkg/config	2007-06-22 13:09:52 UTC (rev 115)
@@ -39,21 +39,22 @@
 	db_go || true
 
 	# now let's do the dbconfig-support
-	if [ "$wc_dbapp" ]; then
+	if [ "$wc_dbtype" ] || [ "$wc_dbtypes" ]; then
 		db_get $wc_package/httpd/instances && instances=$RET
 		_wc_debug "configuring database(s): "
 		for i in `_wc_list_explode "$instances"`; do
 			_wc_debug "  $i"
-			dbc_package=$i
+			dbc_package="${wc_package}_`wc_debian_siteid $i`"
 			dbc_dbuser=`wc_gen_unique_user $wc_package $i`
 			dbc_dbname=`wc_gen_unique_db $wc_package $i`
 			if [ "$wc_dbtype" ]; then
 				. /usr/share/dbconfig-common/dpkg/config.$wc_dbtype
 			else
+				dbc_dbtypes="$wc_dbtypes"
 				. /usr/share/dbconfig-common/dpkg/config
 			fi
-			_wc_debug dbc_go $i $wc_command $wc_oldversion
-			dbc_go $i $wc_command $wc_oldversion || _wc_debug "hrm, nonzero?"
+			_wc_debug dbc_go $dbc_package $wc_command $wc_oldversion
+			dbc_go $dbc_package $wc_command $wc_oldversion || _wc_debug "hrm, nonzero?"
 		done
 	fi
 }

Modified: webapps-common/trunk/dpkg/postinst
===================================================================
--- webapps-common/trunk/dpkg/postinst	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/dpkg/postinst	2007-06-22 13:09:52 UTC (rev 115)
@@ -57,7 +57,7 @@
 
 wc_postinst_dbapp_support(){
 	local includefile
-	if [ "$wc_dbapp" ]; then
+	if [ "$wc_dbtype" ] || [ "$wc_dbtypes" ]; then
 		_wc_debug "postinst configuring database(s): "
 		instances=`grep -vE '^[[:space:]]*#' "$wc_pkgconfig" | cut -sf1` 2>/dev/null || true	
 		realpackage=$wc_package
@@ -66,13 +66,16 @@
 			if [ "$wc_dbtype" ]; then
 				. /usr/share/dbconfig-common/dpkg/postinst.$wc_dbtype
 			else
+				dbc_dbtypes="$wc_dbtypes"
 				. /usr/share/dbconfig-common/dpkg/postinst
 			fi
-			_wc_debug dbc_go $i $wc_command $wc_oldversion
+			_wc_debug dbc_go $dbc_package $wc_command $wc_oldversion
 			if [ "$wc_generate_include" ]; then
-				dbc_generate_include=`wc_includefile_name $i`
+				dbc_generate_include=`wc_to_dbc_generate_include $i`
+				_wc_debug "dbc_generate_include: $dbc_generate_include"
 			fi
-			dbc_go $i $wc_command $wc_oldversion
+			dbc_package="${wc_package}_`wc_debian_siteid $i`"
+			dbc_go $dbc_package $wc_command $wc_oldversion
 		done
 	fi
 }

Modified: webapps-common/trunk/dpkg/postrm
===================================================================
--- webapps-common/trunk/dpkg/postrm	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/dpkg/postrm	2007-06-22 13:09:52 UTC (rev 115)
@@ -15,7 +15,7 @@
 
 	# run the dbconig support here, before we delete the files we
 	# need to run the dbconfig support
-	if [ "$wc_dbapp" ]; then
+	if [ "$wc_dbtype" ] || [ "$wc_dbtypes" ]; then
 		_wc_debug "postrm deconfiguring database(s): "
 		instances=`grep -vE '^[[:space:]]*#' "$wc_pkgconfig" | cut -sf1` 2>/dev/null || true
 		for i in $instances; do
@@ -23,9 +23,11 @@
 			if [ "$wc_dbtype" ]; then
 				. /usr/share/dbconfig-common/dpkg/postrm.$wc_dbtype
 			else
+				dbc_dbtypes="$wc_dbtypes"
 				. /usr/share/dbconfig-common/dpkg/postrm
 			fi
-			dbc_go $i $wc_command $wc_oldversion
+			dbc_package="${wc_package}_`wc_debian_siteid $i`"
+			dbc_go $dbc_package $wc_command $wc_oldversion
 		done
 	fi
 

Modified: webapps-common/trunk/dpkg/prerm
===================================================================
--- webapps-common/trunk/dpkg/prerm	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/dpkg/prerm	2007-06-22 13:09:52 UTC (rev 115)
@@ -7,7 +7,7 @@
 	wc_config $@
 
 	if [ "$wc_command" = "remove" ]; then
-		if [ "$wc_dbapp" ]; then
+		if [ "$wc_dbtype" ] || [ "$wc_dbtypes" ]; then
 			_wc_debug "deconfiguring database(s): "
 			instances=`grep -vE '^[[:space:]]*#' "$wc_pkgconfig" | cut -sf1` 2>/dev/null || true
 			for i in $instances; do
@@ -15,9 +15,11 @@
 				if [ "$wc_dbtype" ]; then
 					. /usr/share/dbconfig-common/dpkg/prerm.$wc_dbtype
 				else
+					dbc_dbtypes="$wc_dbtypes"
 					. /usr/share/dbconfig-common/dpkg/prerm
 				fi
-				dbc_go $i $wc_command $wc_oldversion
+				dbc_package="${wc_package}_`wc_debian_siteid $i`"
+				dbc_go $dbc_package $wc_command $wc_oldversion
 			done
 		fi
 	fi

Modified: webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/config
===================================================================
--- webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/config	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/config	2007-06-22 13:09:52 UTC (rev 115)
@@ -4,6 +4,6 @@
 
 . /usr/share/debconf/confmodule
 . /usr/share/webapps-common/dpkg/config
-wc_dbapp="yes:mysql"
+wc_dbtype="mysql"
 wc_multiple_instances="yes"
 wc_go webapp-apache-dbapp-example $@

Modified: webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postinst
===================================================================
--- webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postinst	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postinst	2007-06-22 13:09:52 UTC (rev 115)
@@ -4,7 +4,7 @@
 
 . /usr/share/debconf/confmodule
 . /usr/share/webapps-common/dpkg/postinst
-wc_dbapp="yes:mysql"
+wc_dbtype="mysql"
 wc_generate_include="php:/etc/webapp-apache-dbapp-example/site-:php"
 dbc_generate_include_args="-O root:www-data -m 640"
 wc_go webapp-apache-dbapp-example $@

Modified: webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postrm
===================================================================
--- webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postrm	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/postrm	2007-06-22 13:09:52 UTC (rev 115)
@@ -4,7 +4,7 @@
 
 . /usr/share/debconf/confmodule
 . /usr/share/webapps-common/dpkg/postrm
-wc_dbapp="yes:mysql"
+wc_dbapp="mysql"
 wc_go webapp-apache-dbapp-example $@
 
 if [ "$1" = "purge" ]; then

Modified: webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/prerm
===================================================================
--- webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/prerm	2007-06-22 13:00:17 UTC (rev 114)
+++ webapps-common/trunk/examples/webapp-apache-dbapp-example/debian/prerm	2007-06-22 13:09:52 UTC (rev 115)
@@ -4,7 +4,7 @@
 
 . /usr/share/debconf/confmodule
 . /usr/share/webapps-common/dpkg/prerm
-wc_dbapp="yes:mysql"
+wc_dbtype="mysql"
 wc_go webapp-apache-dbapp-example $@
 
 #DEBHELPER#




More information about the Webapps-common-discuss mailing list