nix-files/pkgs/additional/sane-scripts/src/sane-vpn-up

20 lines
447 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
2022-07-09 07:48:09 +00:00
# first arg should be the region, e.g. `us` or `ukr`
2022-12-13 04:04:58 +00:00
vpns=$(systemctl list-unit-files | grep wg-quick-ovpnd- | cut -f 1 -d ' ' | sed s'/^wg-quick-ovpnd-\([a-zA-Z-]*\)\.service$/\1/g')
if ! [ $(echo "$vpns" | grep "^$1$") ]
then
echo "invalid vpn name '$1'"
echo "choices:"
echo "$vpns"
exit 1
fi
iface=wg-quick-ovpnd-$1.service
2022-07-09 07:48:09 +00:00
echo plain: $(sane-ip-check)
2022-07-09 07:48:09 +00:00
sudo systemctl start $iface
echo vpn: $(sane-ip-check)