Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,20 @@ DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
function pause(){
read -p "$*"
}

function printLocalDns(){
if nc -z localhost 53 1>/dev/null 2>&1
then
# port 53 is already bound, do not proceed:
return
fi
local ALL_DNS='8.8.8.8:53,8.8.4.4:53'
if [[ -r '/etc/resolv.conf' ]]
then
for dns in $( grep '^nameserver' '/etc/resolv.conf' | awk '{ print $2 }' )
do
ALL_DNS="$dns:53,$ALL_DNS"
done
fi
echo "$ALL_DNS"
}
9 changes: 7 additions & 2 deletions src/start_corectld.command
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ sudo -k > /dev/null 2>&1
printf '%s\n' "$my_password" | sudo -Sv > /dev/null 2>&1

# start corectld
sudo nohup /usr/local/sbin/corectld start --user $(whoami)

NAMESERVERS=""
DNS="$( printLocalDns )"
if [[ -n "$DNS" ]]
then
NAMESERVERS="--recursive-nameservers '$DNS'"
fi
sudo nohup /usr/local/sbin/corectld start --user $(whoami) $NAMESERVERS