Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hostname dependency for Archlinux #547

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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