diff -Nru preseed-1.71ubuntu1/debian/changelog preseed-1.71ubuntu2/debian/changelog --- preseed-1.71ubuntu1/debian/changelog 2016-02-24 06:40:56.000000000 -0500 +++ preseed-1.71ubuntu2/debian/changelog 2016-10-05 12:02:18.000000000 -0400 @@ -1,3 +1,10 @@ +preseed (1.71ubuntu2) xenial; urgency=medium + + * Fix for netcfg/hostname, if set, to take precedence. (LP: #1452202) + - Modify debian/network-preseed.postinst + + -- Eric Desrochers Wed, 05 Oct 2016 12:01:39 -0400 + preseed (1.71ubuntu1) xenial; urgency=low * Resynchronise with Debian. Remaining changes: diff -Nru preseed-1.71ubuntu1/debian/network-preseed.postinst preseed-1.71ubuntu2/debian/network-preseed.postinst --- preseed-1.71ubuntu1/debian/network-preseed.postinst 2016-02-24 00:13:13.000000000 -0500 +++ preseed-1.71ubuntu2/debian/network-preseed.postinst 2016-10-05 12:01:36.000000000 -0400 @@ -14,4 +14,19 @@ preseed_location "$dhcp_url" fi preseed preseed/url + +CURRENT_HOSTNAME=`/bin/hostname` +if db_get netcfg/hostname && [ "$RET" ]; then + if ! echo "$RET" | grep -q 'ubuntu'; then + # default hostname is ubuntu; if that's what we have in the + # netcfg/hostname template, then netcfg will already have + # done the right thing. + NETCFG_HOSTNAME="$RET" + /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hostname + /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hosts + /bin/hostname "$NETCFG_HOSTNAME" + /usr/bin/logger -t netcfg "d-i netcfg/hostname $NETCFG_HOSTNAME took precedence" + fi +fi + preseed_command preseed/early_command