start)
iptables_op=-A
ip_op=add
- tun_dev=$(ip a show to 10.8.0.4/24 | sed -rn '1s/^\S+\s+([^:]+).*/\1/p')
- if [[ $tun_dev != tun* ]]; then
- echo "$0: error: failed to find tun device"
- exit 1
- fi
+ # systemd around stretch release time, would wait until openvpn actually connected,
+ # so this was unnecessary, but now it returns immediately.
+ while true; do
+ tun_dev=$(ip a show to 10.8.0.4/24 | sed -rn '1s/^\S+\s+([^:]+).*/\1/p')
+ if [[ $tun_dev == tun* ]]; then
+ break
+ fi
+ echo "$0: waiting for tun_dev, found: $tun_dev"
+ sleep 4
+ done
e() { "$@"; }
;;
stop)