19 lines
662 B
Cheetah
19 lines
662 B
Cheetah
#!{{ .chezmoi.pathSeparator }}bin{{ .chezmoi.pathSeparator }}zsh
|
|
|
|
if (( UID != 0 ))
|
|
then
|
|
exec sudo "$(realpath "$0")" "$@"
|
|
fi
|
|
|
|
openvpn --config <(sudo -u {{ .chezmoi.username }} {{ .chezmoi.config.gopass.command }} show metrans{{ .chezmoi.pathSeparator }}vpn tcp.ovpn) --askpass <(sudo -u {{ .chezmoi.username }} {{ .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"
|