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

seanius at haydn.debian.org seanius at haydn.debian.org
Tue Aug 2 23:57:50 UTC 2005


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

Modified Files:
	common 
Added Files:
	postrm 
Log Message:
initial support for the test-apache-simple version


Index: common
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/common,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- common	30 Jul 2005 09:37:06 -0000	1.1
+++ common	2 Aug 2005 23:57:47 -0000	1.2
@@ -20,9 +20,22 @@
 	wc_confdir="/etc/webapps-common"
 	wc_globalconfig="$wc_confdir/config"
 
+	# set a default directory for apache config files if not specified
+	if [ ! "$wc_package_confdir" ]; then
+		wc_package_confdir="/etc/$wc_package"
+	fi
+	# set a default webroot if not specified
+	if [ ! "$wc_website_documentroot" ]; then
+		wc_website_documentroot="/usr/share/$wc_package/www"
+	fi
+	# set a default alias if not specified	
+	if [ ! "$wc_website_subdirectory" ]; then
+		wc_website_subdirectory="/$wc_package"
+	fi
+
 	# standard templates provided by webapps-common, which will have copies
 	# registered with the package in question.
-	wc_standard_templates="webapps_install httpd/website_subdirectory install_error"
+	wc_standard_templates="webapps_install httpd/website_subdirectory httpd/select_httpd install_error"
 	wc_register_templates=$wc_standard_templates
 
 	###
@@ -47,7 +60,30 @@
 ### dump package configuration to a config file
 ###
 wc_write_package_config(){
-	echo installing config file for $wc_package with location $wc_website_subdirectory
+	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"
+	sed -i -e "s,_WC_WEBSITE_SUBDIRECTORY_,$wc_website_subdirectory,g" "$tmpconf"
+	sed -i -e "s,_WC_WEBSITE_DOCUMENTROOT_,$wc_website_documentroot,g" "$tmpconf"
+	ucf $tmpconf $wc_package_confdir/apache.conf
+	wc_configure_httpds
+}
+
+###
+### wc_configure_httpds:
+###	choose the servers for the app
+wc_configure_httpds(){
+	local h httpds chosen_httpds oldchoices
+	httpds=`wc_httpd_installed | paste -s | sed -e 's/\t/, /g'`
+
+	db_subst $wc_package/httpd/select_httpd httpds $httpds
+	db_input medium  $wc_package/httpd/select_httpd || true
+	db_go || true
+	db_get $wc_package/httpd/select_httpd
+	chosen_httpds=$RET
+
+	wc_httpd_apache_include "$wc_package_confdir/apache.conf" "$wc_package" $chosen_httpds
 }
 
 ###

--- NEW FILE: postrm ---
# postrm hooks for webapps-common

wc_go(){
	local running_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`
	fi

	# actually remove the files only in purge
	if [ "$wc_command" = "purge" ]; then
		rm -f $wc_package_confdir/apache.conf || true	
		ucf -p $wc_package_confdir/apache.conf || true	
	fi
}




More information about the Webapps-common-discuss mailing list