From 76847de0f27b657f03c2d5133e3d4a0c96e519f5 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Tue, 8 May 2012 23:34:01 +0200 Subject: [PATCH 1/2] vm: do not override /etc/hosts, just add VMNAME to 127.0.0.1 --- vm-init.d/qubes_core | 2 +- vm-systemd/qubes-sysinit.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vm-init.d/qubes_core b/vm-init.d/qubes_core index 52bb1cd..7193d38 100755 --- a/vm-init.d/qubes_core +++ b/vm-init.d/qubes_core @@ -26,7 +26,7 @@ start() # because it makes some of the pre-created dotfiles invalid (e.g. .kde/cache-) # (let's be frank: nobody's gonna use xterm on DispVM) hostname $name - (grep -v "\<$name\>" /etc/hosts; echo "127.0.0.1 $name localhost") > /etc/hosts + sed -i "s/^\(127\.0\.0\.1 .*\) \($name \)\?\(.*\)/\1\2 $name/" /etc/hosts fi timezone=`/usr/bin/xenstore-read qubes-timezone 2> /dev/null` diff --git a/vm-systemd/qubes-sysinit.sh b/vm-systemd/qubes-sysinit.sh index 356a18b..02e2a9a 100755 --- a/vm-systemd/qubes-sysinit.sh +++ b/vm-systemd/qubes-sysinit.sh @@ -52,7 +52,7 @@ done name=`$XS_READ name` if [ -n "$name" ]; then hostname $name - (grep -v "\<$name\>" /etc/hosts; echo "127.0.0.1 $name localhost") > /etc/hosts + sed -i "s/^\(127\.0\.0\.1 .*\) \($name \)\?\(.*\)/\1\2 $name/" /etc/hosts fi timezone=`$XS_READ qubes-timezone 2> /dev/null` From be05968bd13a04a3fd66195c29dabf3f060d13ab Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Tue, 8 May 2012 23:41:53 +0200 Subject: [PATCH 2/2] vm/spec: fix /etc/hosts if it was broken by previous version --- rpm_spec/core-vm.spec | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index 3158b57..0b9d5ff 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -237,6 +237,14 @@ sed 's/^net.ipv4.ip_forward.*/#\0/' -i /etc/sysctl.conf sed -i -e '/^exclude = kernel/d' /etc/yum.conf echo 'exclude = kernel, xorg-x11-drv-*, xorg-x11-drivers, xorg-x11-server-*' >> /etc/yum.conf +# qubes-core-vm has been broken for some time - it overrides /etc/hosts; restore original content +if ! grep -q localhost /etc/hosts; then + cat < /etc/hosts +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 `hostname` +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 +EOF +fi + if [ "$1" != 1 ] ; then # do the rest of %post thing only when updating for the first time... exit 0