diff --git a/fix-networking.sh b/fix-networking.sh new file mode 100644 index 0000000..1f000ba --- /dev/null +++ b/fix-networking.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# +# Purpose : Configure Avahi mDNS and disable systemd-resolved + +set -e + +echo "Installing Avahi and nss-mdns..." +sudo pacman -S --noconfirm avahi nss-mdns + +echo "Enabling Avahi daemon..." +sudo systemctl enable avahi-daemon.service + +echo "Updating /etc/nsswitch.conf..." +sudo sed -i 's/^hosts:.*/hosts: mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns/' /etc/nsswitch.conf + +# Verify the change was made +if grep -q "mdns_minimal" /etc/nsswitch.conf; then + echo "nsswitch.conf updated successfully." +else + echo "Error: nsswitch.conf was not updated. Please check the file manually." + exit 1 +fi + +echo "Copying Avahi SSH service file..." +sudo cp /usr/share/doc/avahi/ssh.service /etc/avahi/services/ + +echo "Avahi mDNS configuration complete." diff --git a/install.sh b/install.sh index 6b89cf3..ecd79b5 100755 --- a/install.sh +++ b/install.sh @@ -180,6 +180,15 @@ if ! bash install-openhamclock.sh; then INSTALL_SUCCESS=false fi +# Fix networking (Avahi mDNS) + +echo "Configuring networking..." + +if ! bash fix-networking.sh; then + echo "Warning: fix-networking.sh encountered errors. mDNS may not be configured correctly." + INSTALL_SUCCESS=false +fi + # Install Compiled Servers echo "Installing compiled servers..."