improved vpn function

This commit is contained in:
Rouven Seifert 2023-01-03 16:11:38 +01:00
parent 01cc0c5c11
commit 7f4629e928
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
2 changed files with 12 additions and 7 deletions

12
flake.lock generated
View file

@ -8,11 +8,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1672349765,
"narHash": "sha256-Ul3lSGglgHXhgU3YNqsNeTlRH1pqxbR64h+2hM+HtnM=",
"lastModified": 1672688183,
"narHash": "sha256-3sNEWKTg3XXVDnvzVatdyetiUQWL+ibJ1YkvxSk3PuM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "dd99675ee81fef051809bc87d67eb07f5ba022e8",
"rev": "c1a830c8fabb13f95f51ecf48552f0a794d8718a",
"type": "github"
},
"original": {
@ -23,11 +23,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1672441588,
"narHash": "sha256-jx5kxOyeObnVD44HRebKYL3cjWrcKhhcDmEYm0/naDY=",
"lastModified": 1672616430,
"narHash": "sha256-e18rRwDUaW/Uw1tBmtsVueJ2SVI5DLhrEGwhkIo+c50=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6a0d2701705c3cf6f42c15aa92b7885f1f8a477f",
"rev": "0bf3109eeb61780965c27f4a0a4affdcd0cd4d3d",
"type": "github"
},
"original": {

View file

@ -55,7 +55,12 @@
}
function svpn() {
systemctl $(echo "start\nstop\nstatus"|fzf) $(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf)
unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf --preview 'systemctl status {}')
if [ $(systemctl is-active $unit) = "inactive" ]; then
systemctl start $unit
else
systemctl stop $unit
fi
}
prompt_dir() {