Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to set custom dns servers #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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: 15 additions & 2 deletions run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,23 @@ rm -f $resolv

# Create custom WSL name resolution
cp ./dist/wsl.conf $wsl
cp ./dist/resolv.conf $resolv

# Check if --dnsserver argument is provided
if [ "$1" = "--dnsservers" ]; then
shift
# Create a new resolv.conf file with default dns servers


#overwrite the resolv.conf with with the given nameservers
for server in "$@"; do
echo "nameserver $server" >> $resolv
done
else
cp ./dist/resolv.conf $resolv
fi

# This prevents resolv.conf from being deleted when WSL starts
chattr +i $resolv

echo 'WSL name resolution configured'
echo 'Restart WSL on Windows: "wsl --shutdown"'
echo 'Restart WSL on Windows: "wsl --shutdown"'