Last active
September 22, 2016 16:36
-
-
Save nippe/68cf2f5225ff14f115036e498aa1ceb2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addresses=( | |
local.viaplay.se | |
local.viaplay.dk | |
local.viaplay.fi | |
local.viaplay.no | |
local.mtg-api.com | |
) | |
for i in "${addresses[@]}" | |
do | |
# echo "address=/$i/127.0.0.1" | |
sudo echo -e "address=/$i/127.0.0.1\n$(cat /usr/local/etc/dnsmasq.conf)" > /usr/local/etc/dnsmasq.conf | |
done | |
echo "Checking if /etc/resolver folder exists" | |
if [[ -d /etc/resolver ]]; | |
then | |
echo "Directory already exists." | |
else | |
echo "No it did not, creating it" | |
sudo mkdir -p /etc/resolver | |
fi | |
echo "Writing files to /etc/resolvers for redirect to local dns" | |
for j in ${addresses[@]} | |
do | |
echo "nameserver 127.0.0.1" | sudo tee /etc/resolver/$j | |
done | |
echo "Reloading dnsmasq config" | |
sudo launchctl stop homebrew.mxcl.dnsmasq | |
sudo launchctl start homebrew.mxcl.dnsmasq | |
echo "Dnsmasq is up and running." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment