avoid sudo resolv alert on rerun
[distro-setup] / distro-begin
index abcb892f5e1f4747e64cd6a7adb474af8ba21555..570d077ca68d1fc9f5bdbb666962de4e83506bdb 100755 (executable)
@@ -195,8 +195,10 @@ if [[ $HOSTNAME != $(cat /etc/hostname) ]]; then
   echo $HOSTNAME > /etc/hostname
   hostname -F /etc/hostname
 fi
-sudo $sed -i '/^127\.0\.1\.1/d' /etc/hosts
-echo "127.0.1.1 $HOSTNAME.b8.nz $HOSTNAME" | sudo tee -a /etc/hosts
+sudo sed -i --follow-symlinks -f - /etc/hosts <<EOF
+\$a 127.0.1.1 $HOSTNAME.b8.nz $HOSTNAME
+/^127\.0\.1\.1/d
+EOF
 
 
 ##### exit first stage if running as root