Add login-to-wifi.sh
This commit is contained in:
parent
1d1e6469ba
commit
a582047e7e
19
login-to-wifi.sh
Executable file
19
login-to-wifi.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
# Find the default route
|
||||||
|
default_route="$(ip route | grep '^default' | grep -Po '(?<=via )[^ ]+')"
|
||||||
|
|
||||||
|
if (( ${?} != 0 )); then
|
||||||
|
printf '\e[91merror\e[m: could not get default route\n'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reverse lookup the default route (idk why, it works sometimes)
|
||||||
|
login_addr="$(mullvad-exclude host "${default_route}" "${default_route}" | awk 'NR==6 { print $4 }')"
|
||||||
|
|
||||||
|
if (( ${?} != 0)); then
|
||||||
|
login_addr="${default_route}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec mullvad-exclude firejail --dns="${default_route}" \
|
||||||
|
firefox --new-instance --no-remote "${login_addr}"
|
Loading…
Reference in New Issue
Block a user