summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2024-12-19 21:03:01 +0000
committertslil clingman <tslil@posteo.de>2024-12-19 21:03:01 +0000
commitd8cc4b1a123e840685ba4b7d006a44aab2c11a78 (patch)
tree727d6c6bbaeb7ba524f0ea051a4e48c9038821f0
parent48f854bc81f67e73c78734f4f33dfa70dc6a7f73 (diff)
vcs: better detection of git repository
-rwxr-xr-xfix_work_dns.sh31
-rwxr-xr-xvcs2
2 files changed, 1 insertions, 32 deletions
diff --git a/fix_work_dns.sh b/fix_work_dns.sh
deleted file mode 100755
index 73a125a..0000000
--- a/fix_work_dns.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-interface="$1"
-event="$2"
-
-logger="/usr/bin/logger -s -t fix_work_vpn"
-
-$logger "Received $event for $interface"
-
-case $interface in
- tun0) case $event in
- up) $logger "Setting dnsovertls false"
- resolvectl dnsovertls $interface false;
- openconnet_pid=$(pgrep -f openconnect)
- $logger "Setting openconnect PID $openconnet_pid to run outside VPN"
- mullvad split-tunnel add $openconnet_pid;
- dns_servers=$(resolvectl dns tun0 | cut -d: -f2- | sed 's/^ *//;s/ /, /')
- $logger "Found DNS endpoints $dns_servers and setting exemptions in nftables"
- nft -f - <<< "define RESOLVER_ADDRS = {$dns_servers}
-table inet excludeTraffic {
- chain excludeDns {
- type filter hook output priority -10; policy accept;
- ip daddr \$RESOLVER_ADDRS udp dport 53 ct mark set 0x00000f41 meta mark set 0x6d6f6c65;
- ip daddr \$RESOLVER_ADDRS tcp dport 53 ct mark set 0x00000f41 meta mark set 0x6d6f6c65;
- }
-}"
- ;;
- down) $logger "Removing nftables exemptions for DNS entries";
- nft delete table inet excludeTraffic;;
- esac;;
-esac
diff --git a/vcs b/vcs
index a61386e..bb6aa90 100755
--- a/vcs
+++ b/vcs
@@ -11,7 +11,7 @@ VCS_MOD=""
VCS_REC=""
SPC=""
-if [ -d ".git" ] || [ -d "../.git" ] || [ -d "../../.git" ]; then
+if git rev-parse --is-inside-work-tree &>/dev/null; then
outp=$(git status)
VCS_STR="×"
VCS_INF="$(echo "$outp" | head -n 1 | cut -d' ' -f 3-)"