diff -Nru netcfg-1.138ubuntu2/debian/changelog netcfg-1.138ubuntu3/debian/changelog --- netcfg-1.138ubuntu2/debian/changelog 2016-08-25 11:29:05.000000000 -0400 +++ netcfg-1.138ubuntu3/debian/changelog 2016-09-20 19:19:07.000000000 -0400 @@ -1,3 +1,10 @@ +netcfg (1.138ubuntu3) yakkety; urgency=medium + + * Fix for netcfg/hostname if set to take precedence (LP: #1452202) + - Add finish-install.d/56netcfg-hostname + + -- Eric Desrochers Tue, 20 Sep 2016 19:18:04 -0400 + netcfg (1.138ubuntu2) yakkety; urgency=medium * On NetworkManager-using systems, write a netplan config file to hand diff -Nru netcfg-1.138ubuntu2/finish-install.d/56netcfg-hostname netcfg-1.138ubuntu3/finish-install.d/56netcfg-hostname --- netcfg-1.138ubuntu2/finish-install.d/56netcfg-hostname 1969-12-31 19:00:00.000000000 -0500 +++ netcfg-1.138ubuntu3/finish-install.d/56netcfg-hostname 2016-09-20 19:17:47.000000000 -0400 @@ -0,0 +1,17 @@ +#! /bin/sh +set -e + +PROGNAME=$(basename $0) +CURRENT_HOSTNAME=`/bin/hostname` +NETCFG_HOSTNAME=`/bin/debconf-get netcfg/hostname` + +# Override hostname, if "netcfg/hostname" is set in preseed file. # +if [ -n "$NETCFG_HOSTNAME" ]; then + /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /target/etc/hostname + /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /target/etc/hosts + /usr/bin/logger "$PROGNAME: d-i netcfg/hostname $NETCFG_HOSTNAME took precedence" + +# Keep hostname as is, if "netcfg/hostname" is not set in preseed file. # +else + exit 0 +fi