diff -Nru netcfg-1.116ubuntu2/debian/changelog netcfg-1.116ubuntu3/debian/changelog --- netcfg-1.116ubuntu2/debian/changelog 2014-09-23 15:38:57.000000000 -0400 +++ netcfg-1.116ubuntu3/debian/changelog 2016-09-20 18:30:15.000000000 -0400 @@ -1,3 +1,10 @@ +netcfg (1.116ubuntu3) trusty; 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 10:24:05 -0400 + netcfg (1.116ubuntu2) trusty; urgency=medium * Fix BOOTIF detection to handle the newline at the end of a line read diff -Nru netcfg-1.116ubuntu2/finish-install.d/56netcfg-hostname netcfg-1.116ubuntu3/finish-install.d/56netcfg-hostname --- netcfg-1.116ubuntu2/finish-install.d/56netcfg-hostname 1969-12-31 19:00:00.000000000 -0500 +++ netcfg-1.116ubuntu3/finish-install.d/56netcfg-hostname 2016-09-20 18:30:55.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