config is in monotone-server 1.1-7.
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 | #! /bin/sh
# vim: set ft=sh sw=4 et:
# postinst script for monotone-server
#
# see: dh_installdeb(1)
set -e
# source debconf stuff
. /usr/share/debconf/confmodule
# we only want to change these values on the initial configuration
gen_pass ()
{
    # this used to use $RANDOM, but dash doesn't have that
    # also, the perl version is clearer
    MATRIX="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    LENGTH="$1"
    if [ -z "$LENGTH" ]; then
        LENGTH=8
    fi
    
    PASS=`perl -e '
        @matrix = split //, $ARGV[0];
	$length = $ARGV[1];
	print $matrix[int(rand($#matrix + 1))] for 1..$length;
	print "\n";
    ' "$MATRIX" "$LENGTH"`
}
case "$1" in
    configure)
        # set the default monotone keyname
        db_set monotone-server/key "monotone@`hostname --fqdn`"
        db_input medium monotone-server/manage-db || true
        db_go || true
        # make sure we should manage things
        db_get monotone-server/manage-db
        if [ "$RET" = "true" ]; then
            db_input low monotone-server/key || true
            db_input low monotone-server/passphrase || true
            db_go || true
            # no passphrase was entered, generate one
            # make sure this is the initial configuration
            db_get monotone-server/passphrase
            if [ -z "$RET" ] && [ -z "$2" ]; then
                gen_pass
                db_set monotone-server/passphrase "$PASS"
            fi
        fi
    ;;
    reconfigure)
        db_input medium monotone-server/manage-db || true
        db_go || true
        # make sure we should manage things
        db_get monotone-server/manage-db
        if [ "$RET" = "true" ]; then
            db_input low monotone-server/key || true
            db_input low monotone-server/passphrase || true
            db_go || true
            # Now let's store the passphrase and key in a file.  We only do
            # this on reconfigure, postinst handles this in all other cases.
            MTN_CONFDIR=/etc/monotone
            db_get monotone-server/key
            MTN_KEY="$RET"
            db_get monotone-server/passphrase
            MTN_KEY_PASSWD="$RET"
            echo "$MTN_KEY \"$MTN_KEY_PASSWD\"" > $MTN_CONFDIR/passphrases
            db_set monotone-server/passphrase ""
        fi
    ;;
    *)
        echo "config called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac
 |