Control: tags -1 + confirmed pending

On Sat, Jan 18, 2020 at 05:51:50PM +0100, Jernej Jakob wrote:
> + [ -f /etc/mailname ]
> + hostname --fqdn
> + MAILNAME=
> dpkg: error processing package opensmtpd (--configure):
>
> I think it's because I have no entry in /etc/hosts for the hostname
> in /etc/hostname, just localhost. hostname --fqdn returns
> "Name or service not known".

Thanks, this helps a lot! I can reproduce the issue now. I've tested the
attached configuration script and it fixes the issue on my end. Could
you please let me know if it fixes the issue on your end? You can test
it by copying it to /var/lib/dpkg/info/opensmtpd.config (with the same
permissions as the existing file) and then trying to configure the
package again.

Thanks,
Ryan

-- 
|)|/  Ryan Kavanagh      | GPG: 4E46 9519 ED67 7734 268F
|\|\  https://rak.ac     |      BD95 8F7B F8FC 4A11 C97A
#!/bin/sh
# Copyright (C) 2013-2016 Ryan Kavanagh <r...@debian.org>
# Distributed under the ISC license, as documented in opensmtpd's
# debian/copyright file

set -e
. /usr/share/debconf/confmodule

getalias () {
    sed -n "s/^${1}\s*:\s*\([^#]*\).*/\1/p" /etc/aliases
}

db_fget opensmtpd/mailname seen || true
# Have we previously configured this variable?
if [ "${RET}" = "true" ]; then
    # Update the debconf value if it has changed
    if [ -f "/etc/mailname" ]; then
        db_set opensmtpd/mailname `cat /etc/mailname`
    else
        # The user has cleared out mailname; set our value to the empty string
        # accordingly
        db_set opensmtpd/mailname ""
    fi
else
    if [ -f "/etc/mailname" ]; then
        # If the user previously created a mailname file, default to its value
        db_set opensmtpd/mailname `cat /etc/mailname`
    else
        # Otherwise, default to our FQDN
        # /etc/mailname and opensmtpd/mailname are both empty
        # Default to the FQDN. hostname will exit with a non-zero
        # exit code if something goes wrong, in which case we resort
        # to the value localdomain.
        MAILNAME=`hostname --fqdn 2> /dev/null || echo "localdomain"`
        # Update our DB with this default for when we prompt the user
        db_set opensmtpd/mailname "${MAILNAME}"
    fi
fi

db_fset opensmtpd/mailname changed false
# Set the changed flag if this gets reconfigured so that we can update
# /etc/mailname accordingly in postinst
( db_input high opensmtpd/mailname && \
  db_fset opensmtpd/mailname changed true ) || true
db_go || true

# Update the debconf value if it has changed
db_fget opensmtpd/root_address seen || true
if [ "${RET}" = "false" ]; then
    # This is the first time configuring this question; we mark it as such so
    # that we know to create the postmaster alias to root
    db_fset opensmtpd/root_address first true
fi
if [ -f "/etc/aliases" ]; then
    db_set opensmtpd/root_address $(getalias "root")
else
    # The user has cleared out aliases; set our value to the empty string
    # accordingly
    db_set opensmtpd/root_address ""
fi

db_fset opensmtpd/root_address changed false
( db_input high opensmtpd/root_address  && \
  db_fset opensmtpd/root_address changed true ) || true
db_go || true

Attachment: signature.asc
Description: PGP signature

Reply via email to