-
Notifications
You must be signed in to change notification settings - Fork 166
fixed valet-dns bash and going off line problem #451
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
base: master
Are you sure you want to change the base?
Conversation
|
cat "$DNSHEAD" | unique | tee "$DNSFILE" &>/dev/null | ||
cat "${FILES[@]}" | grep -i '^nameserver' | grep -vE '127\.(0\.){2}\d{1,3}' | unique | tee -a "$DNSFILE" &>/dev/null | ||
unique < "$DNSHEAD" | tee "$DNSFILE" &>/dev/null | ||
grep -i '^nameserver' "${FILES[@]}" | grep -vE '127\.(0\.){2}{1,3}' | unique | tee -a "$DNSFILE" &>/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This regex seems incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it the \d you are referring to? I cannot remember why I removed. Need to check again
|
||
# I suggest passing local 127 first when creating the resolv.conf | ||
echo 'nameserver 127.0.0.1' > "$VRESOLV" | ||
# Here are appending the gateway given by the network interface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this comments (there are a lot of typos) and explain why are you changing this. I do not understand why we need this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding has been that we need this line for the resolv DNS to work, it seems that not all Linux are working the same. So, I found other users complain about how "after valet" internet connectivity is gone, I had the same issue. But it was very random. That means that sometimes it will work, and sometimes it will fail. This line seems to fix the issue. That is why I added the comments. Which I don't mind removing. But perhaps some one else can validate this concept ?
@@ -134,7 +149,7 @@ function start { | |||
else | |||
echo -e "Starting Valet DNS Watcher..." | |||
main | |||
sleep 2 && echo $(pgrep -f 'inotifywait -q -m -e modify') > "${WORKDIR}/watch.pid" | |||
sleep 2 && pgrep -f 'inotifywait -q -m -e modify' > "${WORKDIR}/watch.pid" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the echo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a "useless echo" you don't need "echo" wrap the output of a sub-process only calling grep, was there a special reason for that? From this side of the woods, echo was not needed, unless I am missing something, then I am open to learn about it.
@@ -99,7 +114,7 @@ function watchDirs() { | |||
done | |||
|
|||
# Watch directories for changes in files | |||
inotifywait -q -m -e modify -e create -e delete --format "%w%f" "${WATCHERS[@]}" | while read change; do | |||
inotifywait -q -m -e modify -e create -e delete --format "%w%f" "${WATCHERS[@]}" | while read -r __change; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing you are referring to this "change" to "change." From my experience, it is good practice to use "" to indicate that a variable is not going to be used. Normally, in other languages that is the practice. But in Bash many programmers use "" are internal variables, so for non-used then add double "". So the shell check linker can also ignore it.
I fixed several bash errors
But I would like discuss and then apply fix for "offline valet problem"
This is the bit the results in removing communication from the outside world.
Does anyone knows more about this piece of code ?
These are my observations
in valet-dns
right after line 63