[Webapps-common-discuss] webapps-common/dpkg common, 1.6, 1.7 config, 1.4, 1.5 postinst, 1.5, 1.6 postrm, 1.5, 1.6 prerm, 1.3, 1.4

seanius at haydn.debian.org seanius at haydn.debian.org
Sat Apr 1 12:14:28 UTC 2006


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

Modified Files:
	common config postinst postrm prerm 
Log Message:
big ol' chunk a work.  almost presentable again :)


Index: common
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/common,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- common	31 Mar 2006 07:04:54 -0000	1.6
+++ common	1 Apr 2006 12:14:25 -0000	1.7
@@ -74,20 +74,21 @@
 ### update the webapps-common apache siteconf file
 ###
 wc_update_apache_siteconf(){
-	local tmpconf siteid_dir siteconf
-	_wc_debug "wc_update_apache_siteconf() $@"
-	tmpconf=`_wc_mktmp`
-
-	siteconf="$wc_confdir/siteids.conf"
-	siteid_dir="$wc_confdir/siteids.d"
-
-	for p in `ls $siteid_dir/*.conf 2>/dev/null`; do
-		grep -vE '[[:space:]]*#' $p |\
-			while read site loc; do
-				echo "SetEnvIf REQUEST_URI '^http://$site/$loc' X_DEBIAN_SITEID=$site/$loc" >> "$tmpconf"
-			done
-	done
-	ucf "$tmpconf" "$siteconf"
+	true
+#	local tmpconf siteid_dir siteconf
+#	_wc_debug "wc_update_apache_siteconf() $@"
+#	tmpconf=`_wc_mktmp`
+#
+#	siteconf="$wc_confdir/siteids.conf"
+#	siteid_dir="$wc_confdir/siteids.d"
+#
+#	for p in `ls $siteid_dir/*.conf 2>/dev/null`; do
+#		grep -vE '[[:space:]]*#' $p |\
+#			while read site loc; do
+#				echo "SetEnvIf REQUEST_URI '^http://$site/$loc' X_DEBIAN_SITEID=$site/$loc" >> "$tmpconf"
+#			done
+#	done
+#	ucf "$tmpconf" "$siteconf"
 }
 
 ###
@@ -136,10 +137,9 @@
 			ucf "$tmpconf2" "$output"
 
 			# if they've manually removed the symlink, keep it that way
-         if [ -f "$output" -a ! -e "$clink" -a "$do_conf" != "no" ]; then
+			if [ -f "$output" -a ! -e "$clink" -a "$do_conf" != "no" ]; then
 				ln -s "$output" "$clink"
 				reload_list=`_wc_list_add "$reload_list" "$h"`
-				echo reload list is now "$reload_list"
 			fi
 
 			rm -f "$tmpconf2"
@@ -381,7 +381,7 @@
 		debconf_src="$wc_package/vhosts/$v"
 		db_get $debconf_src/httpd/website_subdirectory && d="$RET"
 		db_get $debconf_src/httpd/select_httpd && httpds="$RET"
-		echo "$v	$d $httpds" >> "$tmpconf"
+		echo "$v	$d	$httpds" >> "$tmpconf"
 	done
 	ucf "$tmpconf" "$siteconf"
 }
@@ -390,37 +390,64 @@
 ### preseed debconf values from the config files on disk
 ###	this should only be called in the config script, i guess
 ###
-wc_preseed_debconf_siteids(){
-	local siteconf vhost dir httpds debconf_dest choices g_choices vhost_list vhost_list_d
-	_wc_debug "wc_preseed_debconf_siteids() $@"
-	siteconf="/etc/webapps-common/siteids.d/$wc_package.conf"
-	if [ ! -f "$siteconf" ]; then return 0; fi
+wc_preseed_debconf(){
+	local siteconf v vhosts
+	_wc_debug "wc_preseed_debconf() $@"
 
-	if [ -f "/etc/webapps-common/virtualhosts.conf" ]; then
-		vhost_list=`cat /etc/webapps-common/virtualhosts.conf`
+	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
 
-	# XXX
-	# this is a gross hack.  apparently you can't redirect stdin
-	# when calling debconf get/set/register commands???
-	# we should at least not have to arbitrarily pick an fd
-	(
-	exec 7<$siteconf
-	while read -u7 vhost dir httpds; do
-		debconf_dest="$wc_package/vhosts/$vhost"
-		wc_register_debconf "$vhost"
-		db_set $debconf_dest/httpd/website_subdirectory "$dir"
-		db_set $debconf_dest/httpd/select_httpd "$httpds"
-		db_metaget $wc_package/httpd/virtualhost choices && choices="$RET"
-		db_metaget webapps-common/httpd/virtualhost g_choices && g_choices="$RET"
-		choices=`_wc_list_join "$g_choices" "$choices"`
-		db_subst $wc_package/httpd/virtualhost vhosts `_wc_list_add "$choices" "$vhost"`
-		db_subst webapps-common/httpd/virtualhost vhosts `_wc_list_add "$choices" "$vhost"`
-		db_get $wc_package/httpd/virtualhost && vhost_list_d="$RET"
-		vhost_list=`_wc_list_join "$vhost_list" "$vhost_list_d"`
-		db_set $wc_package/httpd/virtualhost `_wc_list_add "$vhost_list" "$vhost"`
-	done 
-	) 
+	# get the list of virtualhosts for which this app is configured
+	if [ -f "$siteconf" ]; then
+		vhosts=`grep -vE '^[[:space:]]*#' "$siteconf" | cut -f1`
+		# preseed each vhost debconf structure for this package.
+		for v in $vhosts; do
+			wc_register_debconf "$v"
+			wc_preseed_debconf_vhost "$v"
+		done
+		vhosts=`_wc_list_create $vhosts`
+	fi
+	# and of course add the new vhost option
+	vhosts=`_wc_list_add "[new vhost]" "$vhosts"`
+	db_subst $wc_package/httpd/virtualhost vhosts "$vhosts"
+}
+
+
+###
+### preseed debconf values from the config files on disk
+###	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
+	_wc_debug "wc_preseed_debconf_vhost() $@"
+
+	siteconf="$wc_confdir/siteids.d/${wc_package}.conf"
+
+	vhost="$1"
+
+	vhost_grep="grep -E ^$vhost[[:space:]] $siteconf"
+	vdir=`$vhost_grep | cut -f2`
+	httpds=`$vhost_grep | cut -f3-`
+
+	debconf_dest="$wc_package/vhosts/$vhost"
+	db_set $debconf_dest/httpd/website_subdirectory "$vdir"
+	db_set $debconf_dest/httpd/select_httpd "$httpds"
+
+# XXX
+#	db_metaget $wc_package/httpd/virtualhost choices && choices="$RET"
+#	db_metaget webapps-common/httpd/virtualhost g_choices && g_choices="$RET"
+#	choices=`_wc_list_join "$g_choices" "$choices"`
+#	db_subst $wc_package/httpd/virtualhost vhosts `_wc_list_add "$choices" "$vhost"`
+#	db_subst webapps-common/httpd/virtualhost vhosts `_wc_list_add "$choices" "$vhost"`
+#	db_get $wc_package/httpd/virtualhost && vhost_list_d="$RET"
+#	vhost_list=`_wc_list_join "$vhost_list" "$vhost_list_d"`
+#	db_set $wc_package/httpd/virtualhost `_wc_list_add "$vhost_list" "$vhost"`
+
 }
 
 ###

Index: config
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/config,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- config	31 Mar 2006 07:04:54 -0000	1.4
+++ config	1 Apr 2006 12:14:25 -0000	1.5
@@ -4,6 +4,7 @@
 wc_go(){
 	local donewithvhosts vhost_name vhost_new vhost_list v
 	. /usr/share/webapps-common/dpkg/common
+	_wc_debug "(config) wc_go() $@"
 	wc_config $@
 
 	# gracefully exit on any commands other than configure/reconfigure
@@ -16,12 +17,9 @@
 	wc_register_debconf
 
 	# preseed debconf values
-	wc_preseed_debconf_siteids
+	wc_preseed_debconf
 
 	# state 1 - ask if they want our help at all
-	if [ "$wc_install" ]; then
-		db_set $wc_package/webapps_install "$wc_install"
-	fi
 	db_input medium $wc_package/webapps_install || true
 
 

Index: postinst
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/postinst,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- postinst	31 Mar 2006 07:04:54 -0000	1.5
+++ postinst	1 Apr 2006 12:14:25 -0000	1.6
@@ -3,10 +3,14 @@
 
 wc_go(){
 	. /usr/share/webapps-common/dpkg/common
-	_wc_debug "wc_go() $@"
+	_wc_debug "(postinst) wc_go() $@"
 	wc_config $@
 	# read in debconf responses (which are seeded from the config)
 	wc_read_package_debconf $@
+	# sync them to disk
+	wc_dump_debconf_siteids
+	wc_write_global_config
+	wc_write_package_config
 
 	###
 	### begin main code execution
@@ -20,9 +24,6 @@
 		# do they want our help at all?  if so we'll quit
 		db_get $wc_package/webapps_install && wc_install="$RET"
 		if [ "$wc_install" != "true" ]; then return 0; fi
-
-		wc_write_package_config
-		wc_write_global_config
 	fi
 	#wc_update_apache_siteconf
 }

Index: postrm
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/postrm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- postrm	31 Mar 2006 07:04:54 -0000	1.5
+++ postrm	1 Apr 2006 12:14:25 -0000	1.6
@@ -4,7 +4,7 @@
 	local h deconfigured_httpds
 	. /usr/share/webapps-common/dpkg/common
 	. /usr/share/webapps-common/internal/httpd
-    _wc_debug "wc_go() $@"
+    _wc_debug "(postrm) wc_go() $@"
 	wc_config $@
 
 	# remove symlinks at package removal if the file exists

Index: prerm
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/prerm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- prerm	31 Mar 2006 07:04:54 -0000	1.3
+++ prerm	1 Apr 2006 12:14:25 -0000	1.4
@@ -2,7 +2,7 @@
 
 wc_go(){
 	. /usr/share/webapps-common/dpkg/common
-    _wc_debug "wc_go() $@"
+    _wc_debug "(prerm) wc_go() $@"
 	wc_config $@
 
 	# anything after this point is not an upgrade




More information about the Webapps-common-discuss mailing list