Skip to content
Permalink
Browse files

update tools/resolv-setup.sh in 123.09beta01

  • Loading branch information...
centminmod committed Feb 12, 2019
1 parent 0c7d688 commit 424e05ce794dd76f2f0ab9b2bec5de7f9dc20339
Showing with 14 additions and 5 deletions.
  1. +14 −5 tools/resolv-setup.sh
@@ -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() {
@@ -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

0 comments on commit 424e05c

Please sign in to comment.
You can’t perform that action at this time.