Build WiFi access point (bluetooth hotspot) on a Raspberry PI zero W

Put Raspbian Stretch Light onto SD-Card:

dd if=2017-11-29-raspbian-stretch-lite.img of=/dev/mmcblk0 status=progress

Preconfigure WiFi, to make it accessible during configuration:

 touch /mnt/mmcblk0p1/ssh 
 cat > /mnt/mmcblk0p1/wpa_supplicant.conf << EOL
     country=DE 
     #omit if US 
     ctrl_interface=
     DIR=/var/run/wpa_supplicant 
     GROUP=netdev 
     update_config=1 
     network={ ssid="ESSID" psk="password" key_mgmt=WPA-PSK }
 EOL

create systemd service: $ cat/etc/systemd/system/btnap.service

[Unit] 
After=bluetooth.service
PartOf=bluetooth.service 
[Service]
ExecStart=/usr/local/sbin/btnap.service.sh
[Install] 
WantedBy=bluetooth.target

corresponding script:

$cat /usr/local/sbin/btnap.service.sh

#!/bin/bash 
#setup bridge where bt devices get hooked up 
br=br-nap 
net="172.16.50" 
brctl addbr $br 
brctl setfd $br 0 
brctl stp $br off 
ip addr add $net.1/24 dev $br 
ip link set $br up 
#ip forwarding.. 
sysctl net.ipv4.ip_forward=1 
#NAT iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -t nat iptables -t nat -L iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT 
iptables -A FORWARD -i $br -o eth0 -j ACCEPT 
#dhcp dns etc 
dnsmasq -i $br --dhcp-range=$net.2,$net.10 --dhcp-option=3,$net.1 
#bt pan server 
dbus script exec /usr/local/sbin/bt-pan server $br

and the bt pan server dbus script:

 # cd /usr/local/sbin/ 
 # wget https://raw.githubusercontent.com/mk-fg/fgtk/master/bt-pan 
 # chmod +x bt-pan