summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcreate-webfedora.sh31
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