X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=packer%2Fdebian64_provision.sh;h=d0a49d3656f7df1841dfda3e362d1696ea58e5c3;hp=7830ad4a922206ca42641b09864e0304167f38c2;hb=21b01603eadd966f485c86cebd35f9bfbd7fd0aa;hpb=7fc0e06e6bb818dd8410e8dc2341da015121203a;ds=inline diff --git a/packer/debian64_provision.sh b/packer/debian64_provision.sh index 7830ad4..d0a49d3 100644 --- a/packer/debian64_provision.sh +++ b/packer/debian64_provision.sh @@ -95,11 +95,27 @@ chroot ${TARGET} chown vagrant:vagrant /home/vagrant/.ssh /home/vagrant/.ssh/aut echo "* Setting up sudo configuration for user vagrant" echo "vagrant ALL=(ALL) NOPASSWD: ALL" > ${TARGET}/etc/sudoers.d/vagrant +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 + if [ -f ${TARGET}/etc/ssh/sshd_config ] && ! grep -q '^UseDNS' ${TARGET}/etc/ssh/sshd_config ; then echo "* Disabling UseDNS in sshd config" echo "UseDNS no" >> ${TARGET}/etc/ssh/sshd_config fi +echo "* Logging build information to /etc/grml_debootstrap.info" +echo "System generated by grml-debootstrap/provision on $(date)" > ${TARGET}/etc/grml_debootstrap.info + echo "* Cleaning up apt stuff" chroot ${TARGET} apt-get clean rm -f ${TARGET}/var/lib/apt/lists/*Packages \