[Unit]
Description=IIAB ap0 clone wifi device
Wants=network-pre.target
After=network-pre.target
Before=dhcpcd.service
Before=wpa_supplicant.service
Before=wpa_supplicant@{{ discovered_wireless_iface }}.service
Before=NetworkManager.service
Before=netplan-wpa@{{ discovered_wireless_iface }}.service
Before=hostapd.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=-/sbin/iw phy phy0 interface add ap0 type __ap
ExecStartPre=-/sbin/ip link set ap0 address {{ ap0_mac_addr }}
ExecStart=-/sbin/ip link set ap0 up
ExecStop=-/sbin/iw dev ap0 del

[Install]
WantedBy=multi-user.target
