Created
January 4, 2014 20:32
-
-
Save hijak/8260342 to your computer and use it in GitHub Desktop.
QC SCRIPT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#a QC script helper | |
read -p " | |
---------------------------------------------------------------- | |
QC SCRIPT HELPER Press enter to continue Press ctrl-c to exit | |
----------------------------------------------------------------" && | |
#read -p "Check for Correct Hardware spec" && | |
#/boot/XXXX/new_qc_beta -l && | |
read -p "Press Enter to Begin Network configuration | |
" && | |
echo -n " | |
------------------------- | |
Enter Natted Gateway IP: " | |
read -e gwip | |
sed "s/\(GATEWAY=\).*/\1$gwip/g" /etc/sysconfig/network > /tmp/newnetwork ; mv /tmp/newnetwork /etc/sysconfig/network && | |
echo -n " | |
------------------------- | |
Enter Natted IP for eth0: " | |
read -e eth0ip | |
sed "s/\(IPADDR=\).*/\1$eth0ip/g" /etc/sysconfig/network-scripts/ifcfg-eth0 > /tmp/ipifcfg-eth0 ; mv /tmp/ipifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0 && | |
# Dangerous Dave Hankins | |
IP=`ifconfig eth0 | grep "inet " | cut -d ':' -f2 | cut -d ' ' -f1` | |
# Make temp file | |
TF=`mktemp` | |
# Move /etc/hosts to temp file | |
mv /etc/hosts $TF | |
# Read temp file, replace any first word that isn't 127.0.0.1 with variable $IP, write to /etc/hosts | |
awk -v ip="$IP" '{if($1!="127.0.0.1") $1=ip;print}' $TF > /etc/hosts | |
# Delete temp file | |
rm $TF | |
echo -n " | |
------------------------ | |
Enter Netmask for eth0: " | |
read -e eth0nm | |
sed "s/\(NETMASK=\).*/\1$eth0nm/" /etc/sysconfig/network-scripts/ifcfg-eth0 > /tmp/netmaskifcfg-eth0 ; mv /tmp/netmaskifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0 && | |
read -p " | |
Please Review the Following files before finalizing | |
" && | |
cat /etc/hosts && | |
read -p " | |
/etc/hosts OK? | |
" && | |
cat /etc/sysconfig/network && | |
read -p " | |
/etc/sysconfig/network OK? | |
" && | |
cat /etc/sysconfig/network-scripts/ifcfg-eth0 && | |
read -p " | |
/etc/sysconfig/network-scripts/ifcfg-eth0 OK? | |
" && | |
read -p "Review and Press enter to enable networking and ping gateway/outside" && | |
chkconfig network on && service network restart && | |
egrep -o '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' /etc/sysconfig/network | xargs ping -c3 && | |
read -p "PING OK?" && | |
ping -c3 8.8.8.8 && | |
read -p "PING OK?" && | |
ping -c3 google.com && | |
read -p "PING OK?" && | |
read -p "Press enter to clear bash history and exit script" && | |
history –c | |
clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment