diff -Nru preseed-1.71ubuntu5/debian/changelog preseed-1.71ubuntu6/debian/changelog --- preseed-1.71ubuntu5/debian/changelog 2017-04-27 02:03:35.000000000 +0800 +++ preseed-1.71ubuntu6/debian/changelog 2018-01-29 17:07:24.000000000 +0800 @@ -1,3 +1,10 @@ +preseed (1.71ubuntu6) artful; urgency=medium + + * Fix for netcfg/hostname, if set, to take precedence. (LP: #1745531) + - Modify debian/network-preseed.postinst to make it more robust + + -- Zhang Hua Fri, 26 Jan 2018 13:32:11 +0800 + preseed (1.71ubuntu5) artful; urgency=medium * Change default preseed root to "d-i/artful/./preseed.cfg". diff -Nru preseed-1.71ubuntu5/debian/network-preseed.postinst preseed-1.71ubuntu6/debian/network-preseed.postinst --- preseed-1.71ubuntu5/debian/network-preseed.postinst 2016-10-05 23:50:09.000000000 +0800 +++ preseed-1.71ubuntu6/debian/network-preseed.postinst 2018-01-26 13:31:43.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