28 lines
793 B
Bash
Executable File
28 lines
793 B
Bash
Executable File
#!/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."
|