Skip to content

Commit 748b48e

Browse files
committed
Remove hostname dependency for Archlinux
fixes: QubesOS/qubes-issues#9710 `hostname` is replaced with `hostnamectl` on Archlinux
1 parent 74d07bb commit 748b48e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

archlinux/PKGBUILD.install

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ update_qubesconfig() {
114114
if ! grep -q localhost /etc/hosts; then
115115

116116
cat <<EOF > /etc/hosts
117-
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 $(hostname)
117+
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 $(hostnamectl hostname)
118118
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
119119
EOF
120120

@@ -126,10 +126,10 @@ EOF
126126
if ! is_protected_file /etc/hostname ; then
127127
for ip in '127\.0\.0\.1' '::1'; do
128128
if grep -q "^${ip}\(\s\|$\)" /etc/hosts; then
129-
sed -i "/^${ip}\s/,+0s/\(\s$(hostname)\)\+\(\s\|$\)/\2/g" /etc/hosts
130-
sed -i "s/^${ip}\(\s\|$\).*$/\0 $(hostname)/" /etc/hosts
129+
sed -i "/^${ip}\s/,+0s/\(\s$(hostnamectl hostname)\)\+\(\s\|$\)/\2/g" /etc/hosts
130+
sed -i "s/^${ip}\(\s\|$\).*$/\0 $(hostnamectl hostname)/" /etc/hosts
131131
else
132-
echo "${ip} $(hostname)" >> /etc/hosts
132+
echo "${ip} $(hostnamectl hostname)" >> /etc/hosts
133133
fi
134134
done
135135
fi

vm-systemd/qubes-early-vm-config.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ unset rc
1919
if ! is_protected_file /etc/hostname ; then
2020
name=$(qubesdb-read /name)
2121
if [ -n "$name" ]; then
22-
hostname "$name"
22+
if [ -f /usr/bin/hostname ]; then
23+
hostname "$name"
24+
else
25+
echo "$name" > /etc/hostname
26+
fi
2327
if [ -e /etc/debian_version ]; then
2428
ipv4_localhost_re="127\.0\.1\.1"
2529
else

0 commit comments

Comments
 (0)