[Pkg-irc-commits] r287 - in /packages/ngircd/trunk/debian: control ngircd.config ngircd.postinst ngircd.postrm ngircd.templates po/ po/POTFILES.in po/templates.pot

cbiedl-guest at users.alioth.debian.org cbiedl-guest at users.alioth.debian.org
Sun Nov 13 17:02:29 UTC 2011


Author: cbiedl-guest
Date: Sun Nov 13 17:02:28 2011
New Revision: 287

URL: http://svn.debian.org/wsvn/pkg-irc/?sc=1&rev=287
Log:
[ngircd] Add debconf to assist configuration migration

Added:
    packages/ngircd/trunk/debian/ngircd.config   (with props)
    packages/ngircd/trunk/debian/ngircd.templates
    packages/ngircd/trunk/debian/po/
    packages/ngircd/trunk/debian/po/POTFILES.in
    packages/ngircd/trunk/debian/po/templates.pot
Modified:
    packages/ngircd/trunk/debian/control
    packages/ngircd/trunk/debian/ngircd.postinst
    packages/ngircd/trunk/debian/ngircd.postrm

Modified: packages/ngircd/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-irc/packages/ngircd/trunk/debian/control?rev=287&op=diff
==============================================================================
--- packages/ngircd/trunk/debian/control (original)
+++ packages/ngircd/trunk/debian/control Sun Nov 13 17:02:28 2011
@@ -8,6 +8,7 @@
     autotools-dev,
     expect,
     libgnutls-dev,
+    po-debconf,
     procps,
     telnet,
 Vcs-Svn: svn://svn.debian.org/pkg-irc/
@@ -17,6 +18,7 @@
 Package: ngircd
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
+    debconf,
     lsb-base (>= 3.0-6),
 Replaces: ircd
 Conflicts: dancer-ircd, ircd-hybrid, ircd-irc2, ircd-ircu, rageircd

Added: packages/ngircd/trunk/debian/ngircd.config
URL: http://svn.debian.org/wsvn/pkg-irc/packages/ngircd/trunk/debian/ngircd.config?rev=287&op=file
==============================================================================
--- packages/ngircd/trunk/debian/ngircd.config (added)
+++ packages/ngircd/trunk/debian/ngircd.config Sun Nov 13 17:02:28 2011
@@ -1,0 +1,96 @@
+#!/bin/sh
+
+set -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+NGIRCD=/usr/sbin/ngircd
+CONFIG=/etc/ngircd/ngircd.conf
+CONVERT=/usr/share/ngircd/ngircd-conf-convert
+
+[ -x "$NGIRCD" ] || exit 0
+[ -f "$CONFIG" ] || exit 0
+[ -x "$CONVERT" ] || exit 0
+
+TEMPDIR=
+
+# conversion required?
+if grep -qiE '^[ \t]*\[(Limits|Options|SSL)\]' "$CONFIG" ; then
+    # Using new section names, we're done
+    exit 0
+fi
+
+while true ; do
+    # Shall we do conversion?
+    db_reset ngircd/conversion-do
+    db_input high ngircd/conversion-do || true
+    db_go
+    db_get ngircd/conversion-do
+    if [ "$RET" = "false" ]; then
+	break
+    fi
+
+    # Check old configuration
+    if </dev/null "$NGIRCD" --configtest --config "$CONFIG" >/dev/null ; then
+	:
+    else
+	# broken
+	db_input high ngircd/broken-oldconfig || true
+	db_go
+	break
+    fi
+
+    # have a temporary directory
+    TEMPDIR=$(mktemp -d /tmp/ngircd.XXXXX)
+    [ "$TEMPDIR" ] && [ -d "$TEMPDIR" ] || exit 0
+    chmod 700 "$TEMPDIR"
+
+    # create new configuration
+    CONFIG_NEW="$TEMPDIR/ngircd.conf"
+    touch "$CONFIG_NEW"
+    "$CONVERT" "$CONFIG" "$CONFIG_NEW"
+    if cmp -s "$CONFIG" "$CONFIG_NEW" ; then
+	echo "Nothing to do."
+	break
+    fi
+
+    # create dumps from --configtest and compare
+    DUMP_OLD="$TEMPDIR/dump.old"
+    </dev/null "$NGIRCD" --configtest --config "$CONFIG" |
+    sed -n '/GLOBAL/,$p' >"$DUMP_OLD"
+    DUMP_NEW="$TEMPDIR/dump.new"
+    </dev/null "$NGIRCD" --configtest --config "$CONFIG_NEW" |
+    sed -n '/GLOBAL/,$p' >"$DUMP_NEW"
+
+    if cmp -s "$DUMP_OLD" "$DUMP_NEW" ; then
+	# success
+	CONFIG_BAK="$CONFIG.pre18"
+	chown --reference="$CONFIG" "$CONFIG_NEW"
+	chmod --reference="$CONFIG" "$CONFIG_NEW"
+	mv "$CONFIG" "$CONFIG_BAK"
+	mv "$CONFIG_NEW" "$CONFIG"
+
+	echo "Conversion and verification sucessfull. Your configuration file is at"
+	echo "    $CONFIG"
+	echo "A backup of the old configuration has been saved to"
+	echo "    $CONFIG_BAK"
+	break
+    fi
+
+    DIFF="$(sdiff -BbW "$DUMP_OLD" "$DUMP_NEW")"
+    db_capb escape
+    db_subst ngircd/conversion-fail DIFF "$(printf %s "$DIFF" | debconf-escape -e)"
+    db_input critical ngircd/conversion-fail || true
+    db_go
+    db_reset ngircd/conversion-fail
+    db_capb
+
+    break
+done
+
+# cleanup
+db_purge
+[ "$TEMPDIR" ] && rm -rf "$TEMPDIR"
+
+exit 0

Propchange: packages/ngircd/trunk/debian/ngircd.config
------------------------------------------------------------------------------
    svn:executable = *

Modified: packages/ngircd/trunk/debian/ngircd.postinst
URL: http://svn.debian.org/wsvn/pkg-irc/packages/ngircd/trunk/debian/ngircd.postinst?rev=287&op=diff
==============================================================================
--- packages/ngircd/trunk/debian/ngircd.postinst (original)
+++ packages/ngircd/trunk/debian/ngircd.postinst Sun Nov 13 17:02:28 2011
@@ -1,17 +1,14 @@
 #!/bin/sh
-# postinst script for ngircd
-#
-# see: dh_installdeb(1)
 
 set -e
 
+. /usr/share/debconf/confmodule
+
 case "$1" in
 configure)
-;;
-
+    ;;
 abort-upgrade|abort-remove|abort-deconfigure)
-;;
-
+    ;;
 *)
     echo "postinst called with unknown argument \`$1'" >&2
     exit 1
@@ -20,4 +17,6 @@
 
 #DEBHELPER#
 
+db_stop
+
 exit 0

Modified: packages/ngircd/trunk/debian/ngircd.postrm
URL: http://svn.debian.org/wsvn/pkg-irc/packages/ngircd/trunk/debian/ngircd.postrm?rev=287&op=diff
==============================================================================
--- packages/ngircd/trunk/debian/ngircd.postrm (original)
+++ packages/ngircd/trunk/debian/ngircd.postrm Sun Nov 13 17:02:28 2011
@@ -1,14 +1,16 @@
 #!/bin/sh
-# postrm script for ngircd
-#
-# see: dh_installdeb(1)
 
 set -e
 
 case "$1" in
-purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-;;
-
+purge)
+    if [ -e /usr/share/debconf/confmodule ]; then
+	. /usr/share/debconf/confmodule
+	db_purge
+    fi
+    ;;
+remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
 *)
     echo "postrm called with unknown argument \`$1'" >&2
     exit 1

Added: packages/ngircd/trunk/debian/ngircd.templates
URL: http://svn.debian.org/wsvn/pkg-irc/packages/ngircd/trunk/debian/ngircd.templates?rev=287&op=file
==============================================================================
--- packages/ngircd/trunk/debian/ngircd.templates (added)
+++ packages/ngircd/trunk/debian/ngircd.templates Sun Nov 13 17:02:28 2011
@@ -1,0 +1,23 @@
+Template: ngircd/conversion-do
+Type: boolean
+_Description: Convert ngIRCd configuration?
+ In version 18, the ngIRCd configuration file format has changed.
+ You can choose to have your configuration re-written.
+ Don't worry, the old format is still supported.
+
+Template: ngircd/broken-oldconfig
+Type: text
+_Description: Cannot convert configuration
+ The present configuration file contains errors and cannot
+ be converted. Please check manually using
+    ngircd --configtest
+ and run 'dpkg-reconfigure ngircd' to try again.
+
+Template: ngircd/conversion-fail
+Type: text
+_Description: Error
+ Verification after conversion failed. This is a bug, please report it
+ in the Debian bug tracker. Please include your configuration but make
+ sure all passwords are removed.
+ The diff below might give you some help:
+    ${DIFF}

Added: packages/ngircd/trunk/debian/po/POTFILES.in
URL: http://svn.debian.org/wsvn/pkg-irc/packages/ngircd/trunk/debian/po/POTFILES.in?rev=287&op=file
==============================================================================
--- packages/ngircd/trunk/debian/po/POTFILES.in (added)
+++ packages/ngircd/trunk/debian/po/POTFILES.in Sun Nov 13 17:02:28 2011
@@ -1,0 +1,1 @@
+[type: gettext/rfc822deb] ngircd.templates

Added: packages/ngircd/trunk/debian/po/templates.pot
URL: http://svn.debian.org/wsvn/pkg-irc/packages/ngircd/trunk/debian/po/templates.pot?rev=287&op=file
==============================================================================
--- packages/ngircd/trunk/debian/po/templates.pot (added)
+++ packages/ngircd/trunk/debian/po/templates.pot Sun Nov 13 17:02:28 2011
@@ -1,0 +1,65 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: ngircd at packages.debian.org\n"
+"POT-Creation-Date: 2011-11-04 22:08+0100\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../ngircd.templates:1001
+msgid "Convert ngIRCd configuration?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../ngircd.templates:1001
+msgid ""
+"In version 18, the ngIRCd configuration file format has changed. You can "
+"choose to have your configuration re-written. Don't worry, the old format is "
+"still supported."
+msgstr ""
+
+#. Type: text
+#. Description
+#: ../ngircd.templates:2001
+msgid "Cannot convert configuration"
+msgstr ""
+
+#. Type: text
+#. Description
+#: ../ngircd.templates:2001
+msgid ""
+"The present configuration file contains errors and cannot be converted. "
+"Please check manually using\n"
+"   ngircd --configtest\n"
+"and run 'dpkg-reconfigure ngircd' to try again."
+msgstr ""
+
+#. Type: text
+#. Description
+#: ../ngircd.templates:3001
+msgid "Error"
+msgstr ""
+
+#. Type: text
+#. Description
+#: ../ngircd.templates:3001
+msgid ""
+"Verification after conversion failed. This is a bug, please report it in the "
+"Debian bug tracker. Please include your configuration but make sure all "
+"passwords are removed. The diff below might give you some help:\n"
+"   ${DIFF}"
+msgstr ""




More information about the Pkg-irc-commits mailing list