[Webapps-common-discuss]
webapps-common/dpkg common, 1.5, 1.6 config,
1.3, 1.4 postinst, 1.4, 1.5 postrm, 1.4, 1.5 preinst, 1.1,
1.2 prerm, 1.2, 1.3
seanius at haydn.debian.org
seanius at haydn.debian.org
Fri Mar 31 07:05:01 UTC 2006
Update of /cvsroot/webapps-common/webapps-common/dpkg
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv4048/dpkg
Modified Files:
common config postinst postrm preinst prerm
Log Message:
some offline work i did
Index: common
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/common,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- common 17 Oct 2005 10:17:13 -0000 1.5
+++ common 31 Mar 2006 07:04:54 -0000 1.6
@@ -4,7 +4,9 @@
#
#
-#set -x
+if [ "$wc_debug" = "insane" ]; then
+ set -x
+fi
# get some internal helper functions, like _dbc_sanity_check
. /usr/share/webapps-common/internal/common
@@ -12,6 +14,7 @@
# set various global variables used by the rest of webapps-common
# (this is typically called by wc_go)
wc_config(){
+ _wc_debug "wc_config() $@"
wc_share="/usr/share/webapps-common"
wc_package="$1"
wc_command="$2"
@@ -40,7 +43,7 @@
###
### source the pre-existing config, if it exists
- ###
+ ###
if [ -f "$wc_globalconfig" ]; then
. "$wc_globalconfig"
fi
@@ -54,6 +57,7 @@
###
wc_write_global_config(){
local tfile tfile2 vhost_list v
+ _wc_debug "wc_write_global_config() $@"
tfile=`_wc_mktmp`
tfile2=`_wc_mktmp`
# get the most recent version of the available virtualhosts
@@ -71,6 +75,7 @@
###
wc_update_apache_siteconf(){
local tmpconf siteid_dir siteconf
+ _wc_debug "wc_update_apache_siteconf() $@"
tmpconf=`_wc_mktmp`
siteconf="$wc_confdir/siteids.conf"
@@ -82,7 +87,7 @@
echo "SetEnvIf REQUEST_URI '^http://$site/$loc' X_DEBIAN_SITEID=$site/$loc" >> "$tmpconf"
done
done
- ucf "$tmpconf" $siteconf
+ ucf "$tmpconf" "$siteconf"
}
###
@@ -90,6 +95,7 @@
###
wc_write_package_config(){
local tmpconf tmpconf2 siteconf output vhost dir httpds h clink do_conf reload_list
+ _wc_debug "wc_write_package_config() $@"
tmpconf=`_wc_mktmp`
@@ -149,6 +155,7 @@
###
wc_purge_httpd_conf(){
local siteconf 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
for h in `_wc_list_explode "$httpds"`; do
@@ -165,6 +172,7 @@
###
wc_unconfigure_httpds(){
local siteconf 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
for h in `_wc_list_explode "$httpds"`; do
@@ -200,6 +208,7 @@
### choose the servers for the app
wc_select_httpds(){
local h instd_httpds chosen_httpds oldchoices debconf_dest
+ _wc_debug "wc_select_httpds() $@"
if [ "$1" ]; then
debconf_dest="$wc_package/vhosts/$1"
@@ -227,6 +236,7 @@
### with respect to the package's configuration and webapps-common.
###
wc_read_package_debconf(){
+ _wc_debug "wc_read_package_debconf() $@"
_wc_sanity_check package || wc_install_error
db_get $wc_package/httpd/website_subdirectory && wc_website_subdirectory="$RET"
db_get $wc_package/httpd/virtualhost && wc_website_virtualhost="$RET"
@@ -322,6 +332,7 @@
###
wc_register_debconf(){
local f vhost_id debconf_dest
+ _wc_debug "wc_register_debconf() $@"
vhost_id="$1"
if [ ! "$vhost_id" ]; then
@@ -349,6 +360,7 @@
###
wc_unregister_debconf(){
local f
+ _wc_debug "wc_unregister_debconf() $@"
for f in $wc_register_templates; do
db_unregister $wc_package/$f
done
@@ -360,6 +372,7 @@
###
wc_dump_debconf_siteids(){
local tmpconf siteconf 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
@@ -379,6 +392,7 @@
###
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
@@ -422,3 +436,19 @@
echo "$tmpconf"
fi
}
+
+###
+### logging messages
+###
+_wc_log(){
+ echo webapps-common: $@ >&2
+}
+
+###
+### debugging messages
+###
+_wc_debug(){
+ if [ "$wc_debug" ]; then
+ _wc_log $@
+ fi
+}
Index: config
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/config,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- config 17 Oct 2005 10:17:13 -0000 1.3
+++ config 31 Mar 2006 07:04:54 -0000 1.4
@@ -6,7 +6,7 @@
. /usr/share/webapps-common/dpkg/common
wc_config $@
- # only do this on install/reconfigure
+ # gracefully exit on any commands other than configure/reconfigure
if [ "$wc_command" != "configure" -a "$wc_command" != "reconfigure" ];
then
return 0
@@ -28,6 +28,7 @@
# state 2 - check to see if they do
db_go || true
db_get $wc_package/webapps_install
+ _wc_debug webapps_install: $RET
if [ "$RET" != "true" ]; then
return 0;
fi
@@ -35,7 +36,8 @@
# state 3 - choose vhosts
while [ ! "$donewithvhosts" ]; do
- # state 3.1, fetch the choices, and set the default list if empty
+ # state 3.1, fetch the current list of vhost choices.
+ # if the list is empty, add the default "[new vhost]" entry
db_metaget $wc_package/httpd/virtualhost choices && vhost_list=$RET
if [ ! "$vhost_list" ]; then
vhost_list="[new vhost]"
@@ -44,25 +46,42 @@
# state 3.2 - ask.
db_input high $wc_package/httpd/virtualhost || true
- db_go || true
- # state 3.3 - if new host, ask for the hostname
+ # state 3.3 - fetch what they entered
+ db_go || true
db_get $wc_package/httpd/virtualhost && vhosts_selected=$RET
+ _wc_debug vhosts_selected: $RET
+
+ # state 3.4 - if '[new vhost]' was in the list of selected
+ # vhosts, then we have to fetch info about this new virtualhost
if _wc_list_is_member "$vhosts_selected" '\[new vhost\]'; then
- db_input medium $wc_package/httpd/virtualhost_new || true
+ # fetch the new virtualhost setting
+ db_input high $wc_package/httpd/virtualhost_new || true
db_go || true
-
db_get $wc_package/httpd/virtualhost_new && vhost_new=$RET
+
+ # if they provide a name
if [ "$vhost_new" ]; then
+ # add it to the original list prompted in the question
vhost_list=`_wc_list_add "$vhost_list" "$vhost_new"`
+ # add it to the list of selected vhosts
vhosts_selected=`_wc_list_add "$vhosts_selected" "$vhost_new"`
+ # remove mention of '[new vhost]' being selected
vhosts_selected=`_wc_list_remove "$vhosts_selected" "\[new vhost\]"`
+ # update the list of available vhosts in the debconf question
db_subst $wc_package/httpd/virtualhost vhosts "$vhost_list"
+ # update the value of the answer
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
wc_register_debconf "$vhost_new"
fi
+ # at this point it's possible that they want to enter more
+ # vhosts, so we're not done yet
else
+ # if they're done entering new vhosts, we're done with this part
donewithvhosts="true"
fi
done
Index: postinst
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/postinst,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- postinst 17 Oct 2005 10:17:13 -0000 1.4
+++ postinst 31 Mar 2006 07:04:54 -0000 1.5
@@ -1,5 +1,9 @@
+# dpkg/postinst: postinst script hook for webapps-common
+# sean finney <seanius at debian.org>
+
wc_go(){
. /usr/share/webapps-common/dpkg/common
+ _wc_debug "wc_go() $@"
wc_config $@
# read in debconf responses (which are seeded from the config)
wc_read_package_debconf $@
Index: postrm
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/postrm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- postrm 17 Oct 2005 10:17:13 -0000 1.4
+++ postrm 31 Mar 2006 07:04:54 -0000 1.5
@@ -4,6 +4,7 @@
local h deconfigured_httpds
. /usr/share/webapps-common/dpkg/common
. /usr/share/webapps-common/internal/httpd
+ _wc_debug "wc_go() $@"
wc_config $@
# remove symlinks at package removal if the file exists
Index: preinst
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/preinst,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- preinst 17 Aug 2005 16:40:41 -0000 1.1
+++ preinst 31 Mar 2006 07:04:54 -0000 1.2
@@ -1,8 +1,6 @@
# preinst hooks for webapps-common
+# do nothing, as we can't rely on this without a pre-depends
wc_go(){
- . /usr/share/webapps-common/dpkg/common
- wc_config $@
-
- wc_dump_debconf_siteids
+ true
}
Index: prerm
===================================================================
RCS file: /cvsroot/webapps-common/webapps-common/dpkg/prerm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- prerm 17 Oct 2005 10:17:13 -0000 1.2
+++ prerm 31 Mar 2006 07:04:54 -0000 1.3
@@ -2,8 +2,14 @@
wc_go(){
. /usr/share/webapps-common/dpkg/common
+ _wc_debug "wc_go() $@"
wc_config $@
+ # anything after this point is not an upgrade
+ if [ "$wc_command" = "upgrade" ]; then
+ return 0
+ fi
+
wc_unconfigure_httpds
if [ "$wc_command" = "purge" ]; then
More information about the Webapps-common-discuss
mailing list