From 45ae7e994525679eaeca2b5bf8933dca29099639 Mon Sep 17 00:00:00 2001 From: Matthew Wall Date: Tue, 2 Apr 2013 16:16:53 +0000 Subject: [PATCH] debconf must be initialized before everything else. added more feedback about station and driver during engine initialization. fix copyright notice. --- bin/weewx/wxengine.py | 4 +++- merge_config.py | 12 +++++++----- pkg/debian/postinst | 7 ++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bin/weewx/wxengine.py b/bin/weewx/wxengine.py index 935290dd..dfeea660 100644 --- a/bin/weewx/wxengine.py +++ b/bin/weewx/wxengine.py @@ -81,6 +81,8 @@ class StdEngine(object): # Find the driver name for this type of hardware driver = config_dict[stationType]['driver'] + syslog.syslog(syslog.LOG_INFO, "wxengine: Loading station type %s (%s)" % (stationType, driver)) + # Import the driver: __import__(driver) @@ -413,7 +415,7 @@ class StdArchive(StdService): syslog.syslog(syslog.LOG_INFO, "wxengine: Using station hardware archive interval of %d" % self.archive_interval) except NotImplementedError: self.archive_interval = software_archive_interval - syslog.syslog(syslog.LOG_INFO, "wxengine: Using archive interval of %d from config file" % self.archive_interval) + syslog.syslog(syslog.LOG_INFO, "wxengine: Using config file archive interval of %d" % self.archive_interval) self.archive_delay = config_dict['StdArchive'].as_int('archive_delay') if self.archive_delay <= 0: diff --git a/merge_config.py b/merge_config.py index da51068c..b38ea426 100755 --- a/merge_config.py +++ b/merge_config.py @@ -1,10 +1,12 @@ #!/usr/bin/env python # $Id$ -# Copyright Matthew Wall +# Copyright (c) 2009-2013 Tom Keffer """weewx configuration file upgrade script. Use this script to merge new - features into an existing configuration file. The script takes two - configuration files as input then outputs the merged contents of those - files.""" + features into an existing configuration file. The script takes an + installation directory and two configuration files as input then outputs + the merged contents of the input files. + + The weewx setup.py script must be in the same directory as this script.""" import setup import configobj @@ -35,7 +37,7 @@ def main(): (options, args) = parser.parse_args() if options.version: - print setup.getversion() + print setup.get_version() exit(0) errmsg = [] diff --git a/pkg/debian/postinst b/pkg/debian/postinst index c64e7818..825e468a 100755 --- a/pkg/debian/postinst +++ b/pkg/debian/postinst @@ -15,14 +15,14 @@ # abort if any command returns error set -e +# get debconf stuff so we can set configuration defaults +. /usr/share/debconf/confmodule + cfgfile=/etc/weewx/weewx.conf mergeapp=/usr/share/weewx/merge_config.py # insert any configuration variables into the configuration file configure_weewxconf() { - # get debconf stuff so we can set configuration defaults - . /usr/share/debconf/confmodule - db_get weewx/location sed -i "s%location =.*%location = \"$RET\"%" $cfgfile @@ -92,6 +92,7 @@ merge_weewxconf() { fi else # this is a new config, so just insert debconf values into it + echo using debconf configuration values from previous install configure_weewxconf fi }