#!/bin/bash set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" # Usage: run when switching from an untrusted network like public wifi # to a trusted one. if [[ -e /etc/dnsmasq.d/untrusted-network.conf ]]; then rm -f /etc/dnsmasq.d/untrusted-network.conf nscd -i hosts systemctl restart dnsmasq fi