#!/usr/bin/env bash # Deploy vanlink configs/scripts from this directory to their system locations. # Usage: cd ~/vanlink && sudo ./deploy.sh # Idempotent. See README.md §4 for the two manual steps this does NOT do # (zerotier-systemd-manager binary install, hostapd unmask). set -euo pipefail cd "$(dirname "$(readlink -f "$0")")" [ "$(id -u)" = 0 ] || { echo "Run with sudo (writes to /etc, /usr)."; exit 1; } echo "== access point ==" install -D -m0644 ap/hostapd.conf /etc/hostapd/hostapd.conf install -D -m0644 ap/default-hostapd /etc/default/hostapd install -D -m0644 ap/van-ap-dnsmasq.conf /etc/van-ap/dnsmasq.conf install -D -m0644 ap/van-ap-dnsmasq.service /etc/systemd/system/van-ap-dnsmasq.service install -D -m0644 ap/10-van-ap.network /etc/systemd/network/10-van-ap.network install -D -m0644 ap/van-ap-unmanaged.conf /etc/NetworkManager/conf.d/van-ap-unmanaged.conf install -D -m0644 ap/nftables.conf /etc/nftables.conf install -D -m0644 ap/regdomain.service /etc/systemd/system/regdomain.service install -D -m0644 ap/rtw89.conf /etc/modprobe.d/rtw89.conf install -D -m0644 ap/99-van-router.conf /etc/sysctl.d/99-van-router.conf echo "== failover ==" install -D -m0755 failover/van-failover /usr/local/sbin/van-failover install -D -m0644 failover/config.json /etc/van-failover/config.json install -D -m0644 failover/van-failover.service /etc/systemd/system/van-failover.service install -D -m0755 failover/50-disable-eee /etc/NetworkManager/dispatcher.d/50-disable-eee install -D -m0644 failover/99-van-arp.conf /etc/sysctl.d/99-van-arp.conf echo "== zerotier managed dns ==" install -D -m0644 dns/zt-search.conf /etc/systemd/network/99-ztuga7c2kh.network.d/search.conf echo "== cockpit plugin ==" install -d /usr/share/cockpit/vanrouter install -m0644 cockpit/vanrouter/* /usr/share/cockpit/vanrouter/ echo "== apply ==" sysctl --system >/dev/null systemctl daemon-reload systemctl unmask hostapd >/dev/null 2>&1 || true systemctl enable regdomain.service hostapd van-ap-dnsmasq nftables systemd-networkd van-failover >/dev/null 2>&1 || true # restart in dependency order; AP iface IP first, then hostapd/dnsmasq, then NAT/failover systemctl restart systemd-networkd systemctl restart hostapd van-ap-dnsmasq nftables van-failover networkctl reload 2>/dev/null || true echo echo "Deployed. Verify:" echo " iw dev wlxc83a35a4ee55 info | grep -E 'ssid|channel|width'" echo " cat /run/van-failover/state.json" echo "Manual one-time steps (see README §4): zerotier-systemd-manager binary + 'zerotier-cli set allowDNS=1'."