dotfiles/.scripts/init/domain-fix.sh

25 lines
1.1 KiB
Bash
Raw Normal View History

2020-09-15 01:43:27 -07:00
#! /bin/bash
EDITOR=vim
##############################
2020-10-01 17:35:29 -07:00
#echo "Make sure you are 100% the connection you have is proper or else it'll assume outgoing everytime."
#echo "Ctrl-C or Ctrl-D to cancel now. Otherwise Press any key to continue..."
#read -p ""
#if curl ipinfo.io/ip | grep -A 2 --quiet -oh "107.221." # UPDATE: IT DIDN'T WORK! MY METHOD PREVAILS!...Switched ip websites, this one should work the same just curl is cleaner.
2020-09-15 01:43:27 -07:00
2020-10-01 16:56:15 -07:00
#if wget http://ipecho.net/plain -O - -q | grep -A 2 --quiet -oh "107.221." # Add more to the public to make it more accurate however this should be fine.
2020-10-01 17:35:29 -07:00
if ifconfig | grep -oh --quiet "192.168.1.127" # Decided to switch to internal ip instead (the odds of this being a problem are like 1/1,000,000.
2020-09-15 01:43:27 -07:00
then
2020-10-01 17:35:29 -07:00
sed '8 s/.*192.168.1.66/192.168.1.66/g' /etc/hosts > /tmp/hosts
2020-09-15 01:43:27 -07:00
mv /tmp/hosts /etc/hosts
chown root: /etc/hosts
else
2020-10-01 17:35:29 -07:00
sed '8 s/.*192.168.1.66/#192.168.1.66/g' /etc/hosts > /tmp/hosts
2020-09-15 01:43:27 -07:00
mv /tmp/hosts /etc/hosts
chown root: /etc/hosts
fi
#############################