+host="$(cat ${TARGET}/etc/hostname)"
+if ! grep -q "${host}$" "${TARGET}"/etc/hosts ; then
+ echo "* Setting up localhost entry for hostname $host in /etc/hosts"
+ cat >> "${TARGET}"/etc/hosts << EOF
+# Added by grml-debootstrap/provision to make sure host is resolvable for sudo:
+127.0.0.2 ${host}.local $host
+
+EOF
+fi
+
+echo "* Setting up stdin/tty workaround in /root/.profile"
+sed -i "s;^mesg n$;# modified via grml-debootstrap/provision script to work around stdin/tty issue:\ntty -s \&\& mesg n;g" "${TARGET}"/root/.profile
+