[Webapps-common-discuss] webapps-common/dpkg common, 1.2, 1.3 postinst, 1.1, 1.2 postrm, 1.1, 1.2

seanius at haydn.debian.org seanius at haydn.debian.org
Wed Aug 3 04:48:43 UTC 2005


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

Modified Files:
	common postinst postrm 
Log Message:
now providing initial support for all three basic flavors (simple,
inline, template) of apache using webapps


Index: common
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/common,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- common	2 Aug 2005 23:57:47 -0000	1.2
+++ common	3 Aug 2005 04:48:39 -0000	1.3
@@ -62,10 +62,34 @@
 wc_write_package_config(){
 	local tmpconf
 	tmpconf=`mktemp -t`
-	#XXX detect what kind of install this is and copy/merge the correct file
-	cp /usr/share/webapps-common/templates/apache.conf "$tmpconf"
+	if [ ! -f "$tmpconf" ]; then
+		echo "can't create temp file, error $?" >&2
+		return 1
+	fi
+	chmod 644 "$tmpconf"
+
+	# detect what kind of install this is and copy/merge the correct file
+	case $wc_apache_conf_style in 
+	inline)
+		cp /usr/share/webapps-common/templates/apache-inline.conf "$tmpconf"
+		sed -i -e "/^<Directory/r /usr/share/webapps-common/install/$wc_package/httpd/apache_inline" "$tmpconf"
+	;;
+	simple|"")
+		cp /usr/share/webapps-common/templates/apache.conf "$tmpconf"
+	;;
+	template)
+		cp "/usr/share/webapps-common/install/$wc_package/httpd/apache_template" "$tmpconf"
+	;;
+	*)
+		echo "illegal value specified for wc_apache_conf_style" >&2
+	;;
+	esac
+
+	# now perform some substitutions on the file
 	sed -i -e "s,_WC_WEBSITE_SUBDIRECTORY_,$wc_website_subdirectory,g" "$tmpconf"
 	sed -i -e "s,_WC_WEBSITE_DOCUMENTROOT_,$wc_website_documentroot,g" "$tmpconf"
+
+	# and register it via ucf
 	ucf $tmpconf $wc_package_confdir/apache.conf
 	wc_configure_httpds
 }
@@ -81,9 +105,10 @@
 	db_input medium  $wc_package/httpd/select_httpd || true
 	db_go || true
 	db_get $wc_package/httpd/select_httpd
-	chosen_httpds=$RET
+	chosen_httpds=`echo $RET | sed -e 's/,//g'`
 
 	wc_httpd_apache_include "$wc_package_confdir/apache.conf" "$wc_package" $chosen_httpds
+	wc_httpd_invoke reload $chosen_httpds
 }
 
 ###

Index: postinst
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/postinst,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- postinst	30 Jul 2005 09:37:06 -0000	1.1
+++ postinst	3 Aug 2005 04:48:39 -0000	1.2
@@ -3,24 +3,20 @@
 	wc_config $@
 	# read in debconf responses (which are seeded from the config)
 	wc_read_package_debconf $@
-	wc_write_package_config
 
 	###
-  	### begin main code execution
-  	###
-  	if [ "$dbc_command" = "configure" -o "$dbc_command" = "reconfigure" ]; 
+	### begin main code execution
+	###
+	if [ "$wc_command" = "configure" -o "$wc_command" = "reconfigure" ]; 
 	then
 		###
 		### get all the debconf settings we need
-      ###
+		###
+
+		wc_write_package_config
 
 		# do they want our help at all?  if so we'll quit after writing the cfg
 		db_get $wc_package/webapps_install && wc_install="$RET"
-      # we need to remember this, so synchronize this to disk before anything
-      wc_write_package_config
-
-		# read in everything else from debconf again
-		wc_read_package_debconf $@
 
 		###
 		### if they don't want our help, quit

Index: postrm
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/postrm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- postrm	2 Aug 2005 23:57:47 -0000	1.1
+++ postrm	3 Aug 2005 04:48:39 -0000	1.2
@@ -1,16 +1,24 @@
 # postrm hooks for webapps-common
 
 wc_go(){
-	local running_httpds
+	local h deconfigured_httpds
 	. /usr/share/webapps-common/dpkg/common
 	. /usr/share/webapps-common/internal/httpd
 	wc_config $@
 
 	# remove symlinks at package removal if the file exists
 	if [ -f "$wc_package_confdir/apache.conf" ]; then
-		wc_httpd_apache_uninclude "$wc_package_confdir/apache.conf" "$wc_package"
-		# reload the running web servers
-		wc_httpd_invoke reload `wc_httpd_running`
+		for h in `wc_httpd_installed`; do
+			if [ -L "/etc/$h/conf.d/$wc_package.conf" ]; then
+				deconfigured_httpds="$deconfigured_httpds $h"
+			fi
+		done
+	
+		if [ "$deconfigured_httpds" ]; then
+			wc_httpd_apache_uninclude "$wc_package_confdir/apache.conf" "$wc_package"
+			# reload the running web servers
+			wc_httpd_invoke reload `wc_httpd_running $deconfigured_httpds`
+		fi
 	fi
 
 	# actually remove the files only in purge




More information about the Webapps-common-discuss mailing list