Loading files
d9772fbc4This file is pinned to the selected release. Download the original to open it in your design tool.
[Unit]
Description=OptoCam WiFi Hotspot
After=uap0.service
Requires=uap0.service
[Service]
Type=forking
ExecStartPre=/bin/sh -c 'kill $(cat /run/hostapd.pid 2>/dev/null) 2>/dev/null || true; sleep 0.1'
ExecStartPre=/bin/sh -c 'iw dev uap0 del 2>/dev/null; sleep 0.1; iw phy phy0 interface add uap0 type __ap; sleep 0.1'
ExecStartPre=/bin/sh -c 'CH=$(iw dev wlan0 info 2>/dev/null | awk "/channel/{print \$2}"); [ -n "$CH" ] && sed -i "s/^channel=.*/channel=$CH/" /etc/hostapd/hostapd.conf || true'
ExecStartPre=/sbin/ip addr add 192.168.4.1/24 dev uap0
ExecStartPre=/sbin/ip link set uap0 up
ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid /etc/hostapd/hostapd.conf
ExecStartPost=/bin/sh -c 'sleep 0.3 && systemctl start dnsmasq'
ExecStop=/bin/sh -c 'kill $(cat /run/hostapd.pid 2>/dev/null) 2>/dev/null || true; systemctl stop dnsmasq 2>/dev/null || true; sleep 0.3; ip addr flush dev uap0 2>/dev/null || true; ip link set uap0 down 2>/dev/null || true; iw dev uap0 del 2>/dev/null || true'
PIDFile=/run/hostapd.pid
[Install]
WantedBy=multi-user.target