diff options
author | Benjamin Franzke <ben@bnf.dev> | 2024-09-30 13:24:45 +0200 |
---|---|---|
committer | Benjamin Franzke <ben@bnf.dev> | 2024-09-30 13:24:45 +0200 |
commit | be27680b2a61f4873f0c67b17ef134e17db75fe6 (patch) | |
tree | a9eb11fd4dd407c52d9e65c740a6da794b3ce652 | |
parent | f8666735988bd32a67c295deb573b9c899568202 (diff) | |
download | recipes-be27680b2a61f4873f0c67b17ef134e17db75fe6.tar.gz recipes-be27680b2a61f4873f0c67b17ef134e17db75fe6.tar.bz2 recipes-be27680b2a61f4873f0c67b17ef134e17db75fe6.zip |
webfedora: add avahi config
-rwxr-xr-x | create-webfedora.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/create-webfedora.sh b/create-webfedora.sh index 330d880..590acff 100755 --- a/create-webfedora.sh +++ b/create-webfedora.sh @@ -8,6 +8,7 @@ installroot=${4:-/var/lib/machines/${name}} dnf="dnf --installroot=${installroot} --setopt=cachedir=/var/cache/dnf --releasever=${version} --repo=fedora --repo=updates --setopt=install_weak_deps=False --setopt=keepcache=True" packages=( + avahi passwd fedora-release vim-minimal @@ -90,6 +91,8 @@ sudo systemctl -M $name start httpd sudo systemctl -M $name start mariadb +sudo systemctl -M $name enable --now avahi-daemon avahi-cname + sudo mkdir -p $installroot/root #Enter current password for root (enter for none): #Switch to unix_socket authentication y @@ -163,10 +166,38 @@ systemctl restart php-fpm sed -i -e '/^apache:/s/sbin\/nologin/bin\/bash/' /etc/passwd +cat >/etc/systemd/system/avahi-cname.service << EOB +[Unit] +Description=Avahi CNAME publisher +Wants=avahi-daemon.service +After=avahi-daemon.service + +[Service] +Type=simple +EnvironmentFile=/root/avahi-hosts +ExecStart=/usr/local/bin/go-avahi-cname cname \$AVAHI_HOSTS + +[Install] +WantedBy=multi-user.target +EOB + +systemctl enable --now avahi-cname +systemctl enable --now mariadb EOF sudo chmod +x "$installroot/root/setup.sh" +cd /tmp/ +curl -Ls https://github.com/grishy/go-avahi-cname/releases/download/v2.0.4/go-avahi-cname_v2.0.4_linux_amd64.tar.gz | tar xvzf - + +sudo mkdir -p $installroot/root +sudo cp go-avahi-cname "$installroot/usr/local/bin/" +sudo chmod +x "$installroot/usr/local/bin/go-avahi-cname" + + +echo "AVAHI_HOSTS=example.${name}.local." | sudo tee -a "$installroot/root/avahi-hosts" > /dev/null + + sudo machinectl shell $name /root/setup.sh # needs mymachines in /etc/nsswitch.conf "hosts:" line |