1
0
Fork 0
chezmoi/bin/executable_metvpn.tmpl
2024-10-18 08:31:33 +02:00

19 lines
654 B
Cheetah

#!{{ .chezmoi.pathSeparator }}bin{{ .chezmoi.pathSeparator }}zsh
if (( UID != 0 ))
then
exec sudo "$(realpath "$0")" "$@"
fi
openvpn --config <(sudo -u {{ .chezmoi.user }} {{ .chezmoi.config.gopass.command }} show metrans{{ .chezmoi.pathSeparator }}vpn tcp.ovpn) --askpass <(sudo -u {{ .chezmoi.user }} {{ .chezmoi.config.gopass.command }} show metrans{{ .chezmoi.pathSeparator }}vpn) &
ovpn=$?
set -v
until ip l show dev metrans &>{{ .chezmoi.pathSeparator }}dev{{ .chezmoi.pathSeparator }}null
do
sleep 0.5
done
resolvectl dns metrans 192.168.1.61 192.168.1.62
resolvectl domain metrans '~metrans.local' '~corp.metrans.cz'
wait
kill "$ovpn"