1
0
Fork 0

Restructure directory layout

To make this better than the unorganized mess it used to be.
This commit is contained in:
Luca Beltrame 2021-01-03 15:26:29 +01:00
parent 58a36ed632
commit c4f7279f2e
Signed by: einar
GPG key ID: 4707F46E9EC72DEC
25 changed files with 0 additions and 727 deletions

30
misc/update_wg_dns Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
NETWORKMANAGER_NETCONFIG="/var/run/netconfig/NetworkManager.netconfig"
dns-update() {
tmpfile=$(mktemp)
sed --regexp-extended "s/(DNSSERVERS=)'(.*?)'/\1'$@ \2'/g" "${NETWORKMANAGER_NETCONFIG}" > "${tmpfile}"
netconfig modify -s NetworkManager -I "${tmpfile}"
rm -f "${tmpfile}"
}
dns-restore() {
tmpfile=$(mktemp)
sed --regexp-extended "s/$@ //g" "${NETWORKMANAGER_NETCONFIG}" > "${tmpfile}"
netconfig modify -s NetworkManager -I ${tmpfile}
rm -f ${tmpfile}
}
dns() {
local cmdname=$1; shift
"dns-$cmdname" "$@"
}
if declare -f "$1" >/dev/null 2>&1; then
# invoke that function, passing arguments through
"$@" # same as "$1" "$2" "$3" ... for full argument list
else
echo "Function $1 not recognized" >&2
exit 1
fi