[Webapps-common-discuss] webapps-common/dpkg common, NONE,
1.1 config, NONE, 1.1 postinst, NONE, 1.1
seanius at haydn.debian.org
seanius at haydn.debian.org
Sat Jul 30 09:37:09 UTC 2005
- Previous message: [Webapps-common-discuss]
webapps-common/debian/po POTFILES.in, NONE,
1.1 templates.pot, NONE, 1.1
- Next message: [Webapps-common-discuss]
webapps-common/examples apache_inline.conf, NONE,
1.1 apache_template.conf, NONE, 1.1 index.php, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/webapps-common/webapps-common/dpkg
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv26799/dpkg
Added Files:
common config postinst
Log Message:
huge chunk of work on a first stab at implementation. still incomplete
and unworking, but one of the included baseline packages (-simple) shows
the most work so far. not worth mentioning to anyone just yet, but i
want to get this in CVS in case something bad happens to my laptop
--- NEW FILE: common ---
###
### common shell include for webapps-common aware packages
###
#
#
#set -x
# get some internal helper functions, like _dbc_sanity_check
. /usr/share/webapps-common/internal/common
# set various global variables used by the rest of webapps-common
# (this is typically called by wc_go)
wc_config(){
wc_share="/usr/share/webapps-common"
wc_package="$1"
wc_command="$2"
wc_oldversion="$3"
wc_confdir="/etc/webapps-common"
wc_globalconfig="$wc_confdir/config"
# 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_register_templates=$wc_standard_templates
###
### source the pre-existing config, if it exists
###
if [ -f "$wc_globalconfig" ]; then
. "$wc_globalconfig"
fi
# webserver-specific section?
}
###
### dump global configuration to a config file
###
wc_write_global_config(){
true
}
###
### dump package configuration to a config file
###
wc_write_package_config(){
echo installing config file for $wc_package with location $wc_website_subdirectory
}
###
### this function is responsible for reading in everything
### with respect to the package's configuration and webapps-common.
###
wc_read_package_debconf(){
_wc_sanity_check package || wc_install_error
db_get $wc_package/httpd/website_subdirectory && wc_website_subdirectory="$RET"
}
##
## what to do when something goes wrong during install
##
wc_install_error(){
echo "error encountered $1:" >&2
echo $wc_error >&2
db_fset $wc_package/install-error seen false
db_subst $wc_package/install-error error $wc_error
db_input critical $wc_package/install-error || true
db_go || true
db_get $wc_package/install-error
_wc_on_error_option="$RET"
if [ "$_wc_on_error_option" = "abort" ]; then
# forget that we've seen all the debconf questions
for f in $wc_register_templates; do
db_fset $wc_package/$f seen false
done
echo "webapps-common: $wc_package $wc_command: aborted." >&2
wc_postinst_cleanup
return 1
fi
if [ "$_wc_on_error_option" = "retry" ]; then
# forget that we've seen all the debconf questions
for f in $wc_register_templates; do
db_fset $wc_package/$f seen false
done
echo "webapps-common: $wc_package $wc_command: trying again." >&2
. $wc_share/dpkg/config
wc_go $wc_package configure $wc_oldversion
. $wc_share/dpkg/postinst
wc_go $wc_package $wc_command $wc_oldversion
wc_tried_again="yes"
fi
if [ "$_wc_on_error_option" = "retry (skip questions)" ]; then
echo "webapps-common: $wc_package $wc_command: trying again (skip questions)." >&2
. $wc_share/dpkg/postinst
wc_go $wc_package $wc_command $wc_oldversion
wc_tried_again="yes"
fi
}
##
## what to do when something goes wrong during remove
##
wc_remove_error(){
echo "error encountered $1:" >&2
echo $wc_error >&2
db_fset $wc_package/remove-error seen false
db_subst $wc_package/remove-error error $wc_error
db_input critical $wc_package/remove-error || true
db_go || true
db_get $wc_package/remove-error
_wc_on_error_option="$RET"
if [ "$_wc_on_error_option" = "abort" ]; then
# forget that we've seen all the debconf questions
for f in $wc_register_templates; do
db_fset $wc_package/$f seen false
done
echo "webapps-common: $wc_package $wc_command: aborted." >&2
wc_postinst_cleanup
return 1
fi
if [ "$_wc_on_error_option" = "retry" ]; then
# forget that we've seen all the debconf questions
for f in $wc_register_templates; do
db_fset $wc_package/$f seen false
done
echo "webapps-common: $wc_package $wc_command: retrying." >&2
. $wc_share/dpkg/config
wc_go $wc_package configure $wc_oldversion
. $wc_share/dpkg/postinst
wc_go $wc_package $wc_command $wc_oldversion
wc_tried_again="yes"
fi
}
###
### register all the necessary debconf templates
###
wc_register_debconf(){
local f
for f in $wc_register_templates; do
# perform some basic customizing substitutions
db_register webapps-common/$f $wc_package/$f
db_subst $wc_package/$f pkg $wc_package
done
}
--- NEW FILE: config ---
# dpkg/config: preconfiguration script hook for webapps-common
# sean finney <seanius at debian.org>
wc_go(){
. /usr/share/webapps-common/dpkg/common
wc_config $@
# only do this on install/reconfigure
if [ "$wc_command" != "configure" -a "$wc_command" != "reconfigure" ];
then
return 0
fi
# register all the debconf templates
wc_register_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 "$wc_install" || true
# state 2 - check to see if they do
db_go || true
db_get $wc_package/webapps_install
if [ "$RET" != "true" ]; then
return 0;
fi
# state 3 - ask for the site directory
if [ "$wc_website_subdirectory" ]; then
db_set $wc_package/httpd/website_subdirectory "$wc_website_subdirectory"
fi
db_input medium $wc_package/httpd/website_subdirectory "$wc_website_subdirectory" || true
# let's stop here for now.
db_go || true
}
--- NEW FILE: postinst ---
wc_go(){
. /usr/share/webapps-common/dpkg/common
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" ];
then
###
### get all the debconf settings we need
###
# 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
###
if [ "$wc_install" != "true" ]; then return 0; fi
fi
}
- Previous message: [Webapps-common-discuss]
webapps-common/debian/po POTFILES.in, NONE,
1.1 templates.pot, NONE, 1.1
- Next message: [Webapps-common-discuss]
webapps-common/examples apache_inline.conf, NONE,
1.1 apache_template.conf, NONE, 1.1 index.php, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Webapps-common-discuss
mailing list