diff -Nru preseed-1.62ubuntu1.1/debian/changelog preseed-1.62ubuntu1.2/debian/changelog --- preseed-1.62ubuntu1.1/debian/changelog 2016-10-05 23:58:53.000000000 +0800 +++ preseed-1.62ubuntu1.2/debian/changelog 2018-01-29 16:50:25.000000000 +0800 @@ -1,3 +1,10 @@ +preseed (1.62ubuntu1.2) trusty; urgency=medium + + * Fix for netcfg/hostname, if set, to take precedence. (LP: #1745531) + - Modify debian/network-preseed.postinst to make it more robust + + -- Hua Zhang Thu, 25 Jan 2018 15:09:28 +0800 + preseed (1.62ubuntu1.1) trusty; urgency=medium * Fix for netcfg/hostname, if set, to take precedence. (LP: #1452202) diff -Nru preseed-1.62ubuntu1.1/debian/network-preseed.postinst preseed-1.62ubuntu1.2/debian/network-preseed.postinst --- preseed-1.62ubuntu1.1/debian/network-preseed.postinst 2016-10-05 23:58:53.000000000 +0800 +++ preseed-1.62ubuntu1.2/debian/network-preseed.postinst 2018-01-25 15:09:00.000000000 +0800 @@ -17,13 +17,13 @@ CURRENT_HOSTNAME=`/bin/hostname` if db_get netcfg/hostname && [ "$RET" ]; then - if ! echo "$RET" | grep -q 'ubuntu'; then + if ! echo "$RET" | grep -qw '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/sed -i "s/\b${CURRENT_HOSTNAME}\b/${NETCFG_HOSTNAME}/g" /etc/hosts /bin/hostname "$NETCFG_HOSTNAME" /usr/bin/logger -t netcfg "d-i netcfg/hostname $NETCFG_HOSTNAME took precedence" fi