[Webapps-common-discuss] webapps-common/dpkg common, 1.7, 1.8 config, 1.5, 1.6

seanius at haydn.debian.org seanius at haydn.debian.org
Sat Apr 1 16:32:24 UTC 2006


Update of /cvsroot/webapps-common/webapps-common/dpkg
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv17907/dpkg

Modified Files:
	common config 
Log Message:
changelog has details...


Index: common
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/common,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- common	1 Apr 2006 12:14:25 -0000	1.7
+++ common	1 Apr 2006 16:32:21 -0000	1.8
@@ -22,6 +22,8 @@
 
 	wc_confdir="/etc/webapps-common"
 	wc_globalconfig="$wc_confdir/config"
+	wc_vhostconfig="$wc_confdir/virtualhosts.conf"
+	wc_siteconf="$wc_confdir/siteids.d/${wc_package}.conf"
 
 	# set a default directory for apache config files if not specified
 	if [ ! "$wc_package_confdir" ]; then
@@ -56,18 +58,23 @@
 ### dump global configuration to a config file
 ###
 wc_write_global_config(){
-	local tfile tfile2 vhost_list v
+	local tfile old_vhost_list vhost_list v
 	_wc_debug "wc_write_global_config() $@"
 	tfile=`_wc_mktmp`
-	tfile2=`_wc_mktmp`
-	# get the most recent version of the available virtualhosts
-	db_metaget webapps-common/httpd/virtualhost choices && vhost_list="$RET"
-	for v in `_wc_list_explode "\`_wc_list_remove \"$vhost_list\" '\[new vhost\]'\`"`; do
-		echo $v >> $tfile
+	# get the previously available list of vhosts, if they exist
+	if [ -f "$wc_vhostconfig" ]; then
+		old_vhost_list=`grep -vE '^[[:space:]]*#' "$wc_vhostconfig"` || true
+		cp "$wc_vhostconfig" "$tfile"
+	fi
+	db_metaget $wc_package/httpd/virtualhost choices && vhost_list="$RET"
+	vhost_list=`_wc_list_remove "$vhost_list" '\[new vhost\]'`
+	for v in `_wc_list_explode "$vhost_list"`; do
+		if ! _wc_list_is_member "$old_vhost_list" "$v"; then
+			echo $v >> "$tfile"
+		fi
 	done
-	sort "$tfile" > "$tfile2"
-	ucf "$tfile2" /etc/webapps-common/virtualhosts.conf
-	rm -f "$tfile" "$tfile2"
+	ucf "$tfile" "$wc_vhostconfig"
+	rm -f "$tfile"
 }
 
 ###
@@ -95,13 +102,11 @@
 ### dump package configuration to a config file
 ###
 wc_write_package_config(){
-	local tmpconf tmpconf2 siteconf output vhost dir httpds h clink do_conf reload_list
+	local tmpconf tmpconf2 output vhost dir httpds h clink do_conf reload_list
 	_wc_debug "wc_write_package_config() $@"
 
 	tmpconf=`_wc_mktmp`
 
-	siteconf="$wc_confdir/siteids.d/${wc_package}.conf"
-
 	# detect what kind of install this is and copy/merge the correct file
 	case $wc_apache_conf_style in 
 	inline)
@@ -120,7 +125,7 @@
 	esac
 
 	# now perform some substitutions on the file into the output files
-	grep -vE '^[[:space:]]*(#|$)' "$siteconf" | while read vhost dir httpds; do
+	grep -vE '^[[:space:]]*(#|$)' "$wc_siteconf" | while read vhost dir httpds; do
 		for h in `_wc_list_explode "$httpds"`; do
 			do_conf="yes"
 			tmpconf2=`_wc_mktmp`
@@ -154,16 +159,17 @@
 ###	purge package httpd configuration files
 ###
 wc_purge_httpd_conf(){
-	local siteconf vhost dir httpds h cfile
+	local vhost dir httpds h cfile
 	_wc_debug "wc_purge_httpd_conf() $@"
-	siteconf="$wc_confdir/siteids.d/${wc_package}.conf"
-	grep -vE '^[[:space:]]*(#|$)' "$siteconf" | while read vhost dir httpds; do
+	grep -vE '^[[:space:]]*(#|$)' "$wc_siteconf" | while read vhost dir httpds; do
 		for h in `_wc_list_explode "$httpds"`; do
 			cfile="/etc/webapps-common/httpd.d/${wc_package}_${h}_${vhost}_${dir}.conf"
 			rm -f "$cfile"
 			ucf --purge "$cfile"
 		done
 	done
+	ucf --purge "$wc_siteconf"
+	rm -f "$wc_siteconf"
 }
 
 ###
@@ -171,10 +177,9 @@
 ###	remove package configuration from all httpds
 ###
 wc_unconfigure_httpds(){
-	local siteconf vhost dir httpds h cfile clink
+	local vhost dir httpds h cfile clink
 	_wc_debug "wc_unconfigure_httpds() $@"
-	siteconf="$wc_confdir/siteids.d/${wc_package}.conf"
-	grep -vE '^[[:space:]]*(#|$)' "$siteconf" | while read vhost dir httpds; do
+	grep -vE '^[[:space:]]*(#|$)' "$wc_siteconf" | while read vhost dir httpds; do
 		for h in `_wc_list_explode "$httpds"`; do
 			clink="/etc/$h/conf.d/${wc_package}_${h}_${vhost}_${dir}.conf"
 			if [ -L "$clink" ]; then
@@ -189,9 +194,8 @@
 ###	apply configurations to the selected webservers
 ###
 #wc_configure_httpds(){
-#	local siteconf vhost dir httpds h cfile
-#	siteconf="$wc_confdir/siteids.d/${wc_package}.conf"
-#	grep -vE '^[[:space:]]*(#|$)' "$siteconf" | while read vhost dir httpds; do
+#	local vhost dir httpds h cfile
+#	grep -vE '^[[:space:]]*(#|$)' "$wc_siteconf" | while read vhost dir httpds; do
 #		for h in `_wc_list_explode "$httpds"`; do
 #			cfile="$wc_confdir/httpd.d/${wc_package}_${h}_${vhost}_${dir}.conf"
 #			if [ -f "$cfile" ]; then
@@ -371,10 +375,9 @@
 ###	this should only be called in the preinst i guess
 ###
 wc_dump_debconf_siteids(){
-	local tmpconf siteconf vhosts v d httpds debconf_src
+	local tmpconf vhosts v d httpds debconf_src
 	_wc_debug "wc_dump_debconf_siteids() $@"
 	tmpconf=`_wc_mktmp`
-	siteconf="$wc_confdir/siteids.d/$wc_package.conf"
 	# get the list of selected virtualhosts
 	db_get $wc_package/httpd/virtualhost && vhosts="$RET"
 	for v in `_wc_list_explode "$vhosts"`; do
@@ -383,7 +386,7 @@
 		db_get $debconf_src/httpd/select_httpd && httpds="$RET"
 		echo "$v	$d	$httpds" >> "$tmpconf"
 	done
-	ucf "$tmpconf" "$siteconf"
+	ucf "$tmpconf" "$wc_siteconf"
 }
 
 ###
@@ -391,19 +394,17 @@
 ###	this should only be called in the config script, i guess
 ###
 wc_preseed_debconf(){
-	local siteconf v vhosts
+	local v vhosts
 	_wc_debug "wc_preseed_debconf() $@"
 
-	siteconf="$wc_confdir/siteids.d/${wc_package}.conf"
-
 	# set the master control flag
 	if [ "$wc_install" ]; then
         db_set $wc_package/webapps_install "$wc_install"
 	fi
 
 	# get the list of virtualhosts for which this app is configured
-	if [ -f "$siteconf" ]; then
-		vhosts=`grep -vE '^[[:space:]]*#' "$siteconf" | cut -f1`
+	if [ -f "$wc_siteconf" ]; then
+		vhosts=`grep -vE '^[[:space:]]*#' "$wc_siteconf" | cut -f1`
 		# preseed each vhost debconf structure for this package.
 		for v in $vhosts; do
 			wc_register_debconf "$v"
@@ -422,15 +423,12 @@
 ###	this should only be called in the config script, i guess
 ###
 wc_preseed_debconf_vhost(){
-	#local siteconf vhost dir httpds debconf_dest choices g_choices vhost_list vhost_list_d
-	local siteconf vhost vhost_grep vdir httpds debconf_dest
+	local vhost vhost_grep vdir httpds debconf_dest
 	_wc_debug "wc_preseed_debconf_vhost() $@"
 
-	siteconf="$wc_confdir/siteids.d/${wc_package}.conf"
-
 	vhost="$1"
 
-	vhost_grep="grep -E ^$vhost[[:space:]] $siteconf"
+	vhost_grep="grep -E ^$vhost[[:space:]] $wc_siteconf"
 	vdir=`$vhost_grep | cut -f2`
 	httpds=`$vhost_grep | cut -f3-`
 

Index: config
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/config,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- config	1 Apr 2006 12:14:25 -0000	1.5
+++ config	1 Apr 2006 16:32:21 -0000	1.6
@@ -16,7 +16,7 @@
 	# register all the debconf templates
 	wc_register_debconf
 
-	# preseed debconf values
+	# preseed debconf values from configuration files
 	wc_preseed_debconf
 
 	# state 1 - ask if they want our help at all
@@ -72,8 +72,7 @@
 				db_set $wc_package/httpd/virtualhost $vhosts_selected
 				# reset the value of virtualhost_new in case it's asked again
 				db_set $wc_package/httpd/virtualhost_new ""
-				# tell copy over all the answers into a subtree just for this
-				# package
+				# copy over all the answers into a subtree just for this package
 				wc_register_debconf "$vhost_new"
 			fi
 			# at this point it's possible that they want to enter more




More information about the Webapps-common-discuss mailing list