diff --git a/archlinux/PKGBUILD.install b/archlinux/PKGBUILD.install index abf39c69..5e1c8163 100644 --- a/archlinux/PKGBUILD.install +++ b/archlinux/PKGBUILD.install @@ -114,7 +114,7 @@ update_qubesconfig() { if ! grep -q localhost /etc/hosts; then cat < /etc/hosts -127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 $(hostname) +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 $(hostnamectl hostname) ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 EOF @@ -126,10 +126,10 @@ EOF if ! is_protected_file /etc/hostname ; then for ip in '127\.0\.0\.1' '::1'; do if grep -q "^${ip}\(\s\|$\)" /etc/hosts; then - sed -i "/^${ip}\s/,+0s/\(\s$(hostname)\)\+\(\s\|$\)/\2/g" /etc/hosts - sed -i "s/^${ip}\(\s\|$\).*$/\0 $(hostname)/" /etc/hosts + sed -i "/^${ip}\s/,+0s/\(\s$(hostnamectl hostname)\)\+\(\s\|$\)/\2/g" /etc/hosts + sed -i "s/^${ip}\(\s\|$\).*$/\0 $(hostnamectl hostname)/" /etc/hosts else - echo "${ip} $(hostname)" >> /etc/hosts + echo "${ip} $(hostnamectl hostname)" >> /etc/hosts fi done fi diff --git a/vm-systemd/qubes-early-vm-config.sh b/vm-systemd/qubes-early-vm-config.sh index 8490e451..3f72f053 100755 --- a/vm-systemd/qubes-early-vm-config.sh +++ b/vm-systemd/qubes-early-vm-config.sh @@ -19,7 +19,12 @@ unset rc if ! is_protected_file /etc/hostname ; then name=$(qubesdb-read /name) if [ -n "$name" ]; then - hostname "$name" + if [ -f /usr/bin/hostname ]; then + hostname "$name" + else + echo "$name" > /etc/hostname + echo "$name" > /proc/sys/kernel/hostname + fi if [ -e /etc/debian_version ]; then ipv4_localhost_re="127\.0\.1\.1" else