config is in ngircd 18-2.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 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
|