sane-scripts: better vpn factoring

This commit is contained in:
colin 2022-12-13 04:04:58 +00:00
parent 005a79e680
commit 07e6ec2533
3 changed files with 25 additions and 20 deletions

View File

@ -24,6 +24,7 @@ resholve.mkDerivation {
file file
findutils findutils
gnugrep gnugrep
gnused
gocryptfs gocryptfs
ifuse ifuse
inetutils inetutils
@ -36,6 +37,7 @@ resholve.mkDerivation {
ssh-to-age ssh-to-age
sops sops
sudo sudo
systemd
util-linux util-linux
which which
]; ];
@ -69,6 +71,7 @@ resholve.mkDerivation {
"cannot:${rsync}/bin/rsync" "cannot:${rsync}/bin/rsync"
"cannot:${sops}/bin/sops" "cannot:${sops}/bin/sops"
"cannot:${ssh-to-age}/bin/ssh-to-age" "cannot:${ssh-to-age}/bin/ssh-to-age"
"cannot:${systemd}/bin/systemctl"
]; ];
}; };
}; };

View File

@ -2,16 +2,17 @@
# first arg should be the region, e.g. `us` or `ukr` # first arg should be the region, e.g. `us` or `ukr`
case $1 in vpns=$(systemctl list-unit-files | grep wg-quick-ovpnd- | cut -f 1 -d ' ' | sed s'/^wg-quick-ovpnd-\([a-zA-Z-]*\)\.service$/\1/g')
ukr)
iface=wg-quick-ovpnd-ukr;; if ! [ $(echo "$vpns" | grep "^$1$") ]
us) then
iface=wg-quick-ovpnd-us;; echo "invalid vpn name '$1'"
us-atlanta) echo "choices:"
iface=wg-quick-ovpnd-us-atlanta;; echo "$vpns"
*) exit 1
echo "invalid vpn name '$1'"; exit 1;; fi
esac
iface=wg-quick-ovpnd-$1.service
echo vpn: $(curl https://ipinfo.io/ip) echo vpn: $(curl https://ipinfo.io/ip)
sudo systemctl stop $iface sudo systemctl stop $iface

View File

@ -2,16 +2,17 @@
# first arg should be the region, e.g. `us` or `ukr` # first arg should be the region, e.g. `us` or `ukr`
case $1 in vpns=$(systemctl list-unit-files | grep wg-quick-ovpnd- | cut -f 1 -d ' ' | sed s'/^wg-quick-ovpnd-\([a-zA-Z-]*\)\.service$/\1/g')
ukr)
iface=wg-quick-ovpnd-ukr;; if ! [ $(echo "$vpns" | grep "^$1$") ]
us) then
iface=wg-quick-ovpnd-us;; echo "invalid vpn name '$1'"
us-atlanta) echo "choices:"
iface=wg-quick-ovpnd-us-atlanta;; echo "$vpns"
*) exit 1
echo "invalid vpn name '$1'"; exit 1;; fi
esac
iface=wg-quick-ovpnd-$1.service
echo plain: $(curl https://ipinfo.io/ip) echo plain: $(curl https://ipinfo.io/ip)
sudo systemctl start $iface sudo systemctl start $iface