Skip to content

Commit

Permalink
update tools/resolv-setup.sh in 123.09beta01
Browse files Browse the repository at this point in the history
  • Loading branch information
centminmod committed Feb 12, 2019
1 parent 0c7d688 commit 424e05c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions tools/resolv-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ rotate_config() {
echo '# generated by centminmod setup' >> /etc/resolv.conf
echo 'options rotate' >> /etc/resolv.conf
echo 'options timeout:1' >> /etc/resolv.conf
echo 'nameserver 208.67.220.220' >> /etc/resolv.conf
echo 'nameserver 208.67.222.222' >> /etc/resolv.conf
echo 'nameserver 1.1.1.1' >> /etc/resolv.conf
echo 'nameserver 1.0.0.1' >> /etc/resolv.conf
echo 'nameserver 8.8.8.8' >> /etc/resolv.conf
echo 'nameserver 4.2.2.2' >> /etc/resolv.conf
echo 'nameserver 8.26.56.26' >> /etc/resolv.conf
}
rotate_restore() {
Expand All @@ -32,21 +35,27 @@ cat > "/etc/resolv.conf" <<EFF
# generated by centminmod setup
options rotate
options timeout:1
nameserver 208.67.220.220
nameserver 208.67.222.222
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 8.8.8.8
nameserver 4.2.2.2
nameserver 8.26.56.26
EFF
elif [[ ! "$(grep -w 'linode' /etc/resolv.conf)" ]] && [[ ! "$(grep -w '4.2.2.2' /etc/resolv.conf)" || ! "$(grep -w '8.26.56.26' /etc/resolv.conf)" ]] && [[ ! "$(lsattr /etc/resolv.conf | grep '\-i\-')" ]]; then
elif [[ ! "$(grep -w 'linode' /etc/resolv.conf)" ]] && [[ ! "$(grep -w '1.0.0.1' /etc/resolv.conf)" || ! "$(grep -w '1.1.1.1' /etc/resolv.conf)" || ! "$(grep -w '208.67.222.222' /etc/resolv.conf)" || ! "$(grep -w '8.8.8.8' /etc/resolv.conf)" || ! "$(grep -w '4.2.2.2' /etc/resolv.conf)" || ! "$(grep -w '208.67.220.220' /etc/resolv.conf)" ]] && [[ ! "$(lsattr /etc/resolv.conf | grep '\-i\-')" ]]; then
# if not linode server based, update /etc/resolv.conf. linode servers don't need updating as they have a more relaible setup
cat > "/etc/resolv.conf" <<EFF
# generated by centminmod setup
options rotate
options timeout:1
nameserver 208.67.220.220
nameserver 208.67.222.222
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 8.8.8.8
nameserver 4.2.2.2
nameserver 8.26.56.26
EFF
elif [[ "$(grep -w 'linode' /etc/resolv.conf)" ]] && [[ ! "$(grep -w '8.8.8.8' /etc/resolv.conf)" ]] && [[ ! "$(grep -w '4.2.2.2' /etc/resolv.conf)" || ! "$(grep -w '8.26.56.26' /etc/resolv.conf)" ]] && [[ ! "$(lsattr /etc/resolv.conf | grep '\-i\-')" ]]; then
elif [[ "$(grep -w 'linode' /etc/resolv.conf)" ]] && [[ ! "$(grep -w '8.8.8.8' /etc/resolv.conf)" ]] && [[ ! "$(grep -w '4.2.2.2' /etc/resolv.conf)" || ! "$(grep -w '208.67.222.222' /etc/resolv.conf)" ]] && [[ ! "$(lsattr /etc/resolv.conf | grep '\-i\-')" ]]; then
# insert 8.8.8.8 to existing linode /etc/resolv.conf configs
cat > "/etc/resolv-tmp.conf" <<EFF
# generated by centminmod setup
Expand Down

0 comments on commit 424e05c

Please sign in to comment.