Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/547'
Browse files Browse the repository at this point in the history
* origin/pr/547:
  Remove `hostname` dependency for Archlinux

Pull request description:

fixes: QubesOS/qubes-issues#9710
  • Loading branch information
marmarek committed Jan 26, 2025
2 parents f72a393 + d0cab32 commit fac98ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions archlinux/PKGBUILD.install
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ update_qubesconfig() {
if ! grep -q localhost /etc/hosts; then

cat <<EOF > /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

Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion vm-systemd/qubes-early-vm-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fac98ed

Please sign in to comment.