and add the files

Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
Kevin Fenzi 2022-05-16 18:21:49 -07:00
parent 1c792cf8c1
commit af7c94951a
2 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,38 @@
#!/bin/sh
# do_flush() flushes every active network interface. It is intended to
# run before NetworkManager starts, so that when it does it will be able
# to set up the network using the regular host configuration.
do_flush() {
for f in /sys/class/net/*; do
iface="${f##*/}"
[ "${iface}" = "lo" ] && continue
echo "Preparing to flush interface ${iface}" >&2
ip -statistics address flush dev "${iface}"
rm -f /run/NetworkManager/system-connections/default_connection.nmconnection >&2
done
}
# reset_autoconn_prio() will reset the autoconnect priority
# of the existing NM connections to zero.
reset_autoconn_prio() {
nmcli -t -f NAME connection show 2>/dev/null | while read -r _c; do
if ! _prio="$(nmcli -t connection show "${_c}" \
| grep connection.autoconnect-priority: \
| cut -d: -f2)" || [ -z "${_prio}" ]; then
continue
fi
[ "${_prio}" -ge 0 ] && continue
echo "Setting autoconnect-priority of connection ${_c} to zero" >&2
nmcli connection modify "${_c}" connection.autoconnect-priority 0
done
}
case "${1}" in
reset-autoconn-prio)
reset_autoconn_prio;;
flush)
do_flush;;
esac
# vim:set ts=2 sw=2 et:

View file

@ -0,0 +1,2 @@
[main]
no-auto-default=*