"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/common/input.sh" between
fogproject-1.5.5.tar.gz and fogproject-1.5.6.tar.gz

About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.

input.sh  (fogproject-1.5.5):input.sh  (fogproject-1.5.6)
skipping to change at line 31 skipping to change at line 31
*[Uu][Bb][Uu][Nn][Tt][Uu]*|*[Bb][Ii][Aa][Nn]*|*[Mm][Ii][Nn][Tt]*) *[Uu][Bb][Uu][Nn][Tt][Uu]*|*[Bb][Ii][Aa][Nn]*|*[Mm][Ii][Nn][Tt]*)
strSuggestedOS=2 strSuggestedOS=2
;; ;;
*[Aa][Rr][Cc][Hh]*) *[Aa][Rr][Cc][Hh]*)
strSuggestedOS=3 strSuggestedOS=3
;; ;;
*) *)
strSuggestedOS=1 strSuggestedOS=1
;; ;;
esac esac
strSuggestedInterface=$(getFirstGoodInterface) allinterfaces=$(getAllNetworkInterfaces)
strSuggestedInterface=${allinterfaces[0]}
if [[ -z $strSuggestedInterface ]]; then if [[ -z $strSuggestedInterface ]]; then
echo "Not able to find an interface with an active internet connection. echo "ERROR: Not able to find a network interface that is up on your sys
Trying alternative methods for determining the interface." tem."
strSuggestedIPAddress=$(/sbin/ip -f inet -o addr | awk -F'[ /]+' '/globa exit 1
l/ {print $4}' | head -n2 | tail -n1)
[[ -z $strSuggestedIPAddress ]] && strSuggestedIPAddress=$(/sbin/ifconfi
g -a | awk '/(cast)/ {print $2}' | cut -d ':' -f2 | head -n2 | tail -n1)
strSuggestedInterface=$(/sbin/ip -f inet -o addr | awk -F'[ /]+' '/globa
l/ {print $2}' | head -n2 | tail -n1)
[[ -z $strSuggestedInterface ]] && strSuggestedInterface=$(/sbin/ifconfi
g -a | grep "'${strSuggestedIPAddress}'" -B1 | awk -F'[:]+' '{print $1}' | head
-n1)
fi
strSuggestedIPAddress=$(/sbin/ip -4 addr show | grep $strSuggestedInterface
| grep -o "inet [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" | grep -o "[0-9]*\.[0-9]*\.[0-9]
*\.[0-9]*")
[[ -z $strSuggestedIPAddress ]] && strSuggestedIPAddress=$(/sbin/ifconfig -a
| awk '/(cast)/ {print $2}' | cut -d ':' -f2 | head -n2 | tail -n1)
strSuggestedSubMask=$(cidr2mask $(getCidr $strSuggestedInterface))
if [[ -z $strSuggestedSubMask ]]; then
strSuggestedSubMask=$(/sbin/ifconfig -a | grep $strSuggestedIPAddress -B
1 | awk -F'[netmask ]+' '{print $4}' | head -n2)
strSuggestedSubMask=$(mask2cidr $strSuggestedSubMask)
fi fi
submask=$strSuggestedSubMask
strSuggestedRoute=$(ip route | grep -E "default.*${strSuggestedInterface}|${ strSuggestedInterface}.*default" | head -n1 | cut -d' ' -f3 | tr -d [:blank:]) strSuggestedRoute=$(ip route | grep -E "default.*${strSuggestedInterface}|${ strSuggestedInterface}.*default" | head -n1 | cut -d' ' -f3 | tr -d [:blank:])
if [[ -z $strSuggestedRoute ]]; then if [[ -z $strSuggestedRoute ]]; then
strSuggestedRoute=$(route -n | grep -E "^.*UG.*${strSuggestedInterface}$ " | head -n1) strSuggestedRoute=$(route -n | grep -E "^.*UG.*${strSuggestedInterface}$ " | head -n1)
strSuggestedRoute=$(echo ${strSuggestedRoute:16:16} | tr -d [:blank:]) strSuggestedRoute=$(echo ${strSuggestedRoute:16:16} | tr -d [:blank:])
fi fi
strSuggestedDNS="" strSuggestedDNS=""
[[ -f /etc/resolv.conf ]] && strSuggestedDNS=$(cat /etc/resolv.conf | grep - E "^nameserver" | head -n 1 | tr -d "nameserver" | tr -d [:blank:] | grep "^[0-9 ]*\.[0-9]*\.[0-9]*\.[0-9]*$") [[ -f /etc/resolv.conf ]] && strSuggestedDNS=$(cat /etc/resolv.conf | grep - E "^nameserver" | head -n 1 | tr -d "nameserver" | tr -d [:blank:] | grep "^[0-9 ]*\.[0-9]*\.[0-9]*\.[0-9]*$")
[[ -z $strSuggestedDNS && -d /etc/NetworkManager/system-connections ]] && st rSuggestedDNS=$(cat /etc/NetworkManager/system-connections/* | grep "dns" | head -n 1 | tr -d "dns=" | tr -d ";" | tr -d [:blank:] | grep "^[0-9]*\.[0-9]*\.[0-9 ]*\.[0-9]*$") [[ -z $strSuggestedDNS && -d /etc/NetworkManager/system-connections ]] && st rSuggestedDNS=$(cat /etc/NetworkManager/system-connections/* | grep "dns" | head -n 1 | tr -d "dns=" | tr -d ";" | tr -d [:blank:] | grep "^[0-9]*\.[0-9]*\.[0-9 ]*\.[0-9]*$")
if [[ -z $strSuggestedDNS ]]; then #If the suggested DNS is still empty, tak e further steps to get the addresses. if [[ -z $strSuggestedDNS ]]; then #If the suggested DNS is still empty, tak e further steps to get the addresses.
mkdir -p /tmp > /dev/null 2>&1 #Make sure /tmp exists, this will be the working directory. mkdir -p /tmp > /dev/null 2>&1 #Make sure /tmp exists, this will be the working directory.
cat /etc/resolv.conf | grep "nameserver" > /tmp/nameservers.txt #Get all lines from reslov.conf that have "nameserver" in them. cat /etc/resolv.conf | grep "nameserver" > /tmp/nameservers.txt #Get all lines from reslov.conf that have "nameserver" in them.
sed -i 's:#.*$::g' /tmp/nameservers.txt #Remove all comments from new fi le. sed -i 's:#.*$::g' /tmp/nameservers.txt #Remove all comments from new fi le.
sed -i -- 's/nameserver //g' /tmp/nameservers.txt #Change "nameserver " to "tmpDns=" sed -i -- 's/nameserver //g' /tmp/nameservers.txt #Change "nameserver " to "tmpDns="
sed -i '/^$/d' /tmp/nameservers.txt #Delete blank lines from temp file. sed -i '/^$/d' /tmp/nameservers.txt #Delete blank lines from temp file.
strSuggestedDNS=$(head -n 1 /tmp/nameservers.txt) #Get first DNS Address from the file. strSuggestedDNS=$(head -n 1 /tmp/nameservers.txt) #Get first DNS Address from the file.
rm -f /tmp/nameservers.txt #Cleanup after ourselves. rm -f /tmp/nameservers.txt #Cleanup after ourselves.
fi fi
strSuggestedSNUser="fogstorage" strSuggestedSNUser="fogstorage"
strSuggestedHostname=$(hostname -f)
fi fi
displayOSChoices displayOSChoices
while [[ -z $installtype ]]; do while [[ -z $installtype ]]; do
installtype="N" installtype="N"
if [[ -z $autoaccept ]]; then if [[ -z $autoaccept ]]; then
echo " FOG Server installation modes:" echo " FOG Server installation modes:"
echo " * Normal Server: (Choice N) " echo " * Normal Server: (Choice N) "
echo " This is the typical installation type and" echo " This is the typical installation type and"
echo " will install all FOG components for you on this" echo " will install all FOG components for you on this"
echo " machine. Pick this option if you are unsure what to pic k." echo " machine. Pick this option if you are unsure what to pic k."
skipping to change at line 99 skipping to change at line 90
;; ;;
[Ss]|[Ss][Tt][Oo][Rr][Aa][Gg][Ee]) [Ss]|[Ss][Tt][Oo][Rr][Aa][Gg][Ee])
installtype="S" installtype="S"
;; ;;
*) *)
installtype="" installtype=""
echo " Invalid input, please try again." echo " Invalid input, please try again."
;; ;;
esac esac
done done
count=0
while [[ -z $ipaddress ]]; do
if [[ $count -ge 1 ]] || [[ -z $autoaccept ]]; then
echo
echo -n " What is the IP address to be used by this FOG Server? [$strSu
ggestedIPAddress]"
read ipaddress
fi
case $ipaddress in
"")
ipaddress=$(echo $strSuggestedIPAddress | grep -o '^[0-9]\{1,3\}\.[0
-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$' | tr -d '[[:space:]]')
;;
*)
ipaddress=$(echo $ipaddress | grep -o '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.
[0-9]\{1,3\}\.[0-9]\{1,3\}$' | tr -d '[[:space:]]')
;;
esac
if [[ ! $(validip $ipaddress) -eq 0 ]]; then
ipaddress=""
echo " Invalid IP Address"
let count+=1
fi
done
if [[ $strSuggestedIPAddress != $ipaddress ]]; then
inetIPline=$(ip -4 addr | grep "inet $ipaddress")
numberOfFieldsInOutput=$(grep -o " " <<< "$inetIPline" | wc -l)
let numberOfFieldsInOutput+=1 >/dev/null 2>&1
strSuggestedInterface=$(echo $line | cut -d ' ' -f $numberOfFieldsInOutput)
strSuggestedSubMask=$(/sbin/ifconfig -a | grep $ipaddress -B1 | awk -F'[netm
ask ]+' '{print $4}' | head -n2)
submask=$(mask2cidr $strSuggestedSubMask)
fi
while [[ -z $interface ]]; do while [[ -z $interface ]]; do
blInt="N" blInt="N"
if [[ -z $autoaccept ]]; then if [[ -z $autoaccept ]]; then
echo echo
echo " We found the following interfaces on your system:"
for i in $allinterfaces
do
iip=$(ip -4 addr show $i | awk '$1 == "inet" {print $2}')
echo " * $i - $iip"
done
echo
echo " Would you like to change the default network interface from $str SuggestedInterface?" echo " Would you like to change the default network interface from $str SuggestedInterface?"
echo -n " If you are not sure, select No. [y/N] " echo -n " If you are not sure, select No. [y/N] "
read blInt read blInt
fi fi
case $blInt in case $blInt in
[Nn]|[Nn][Oo]|"") [Nn]|[Nn][Oo]|"")
interface=$strSuggestedInterface interface=$strSuggestedInterface
;; ;;
[Yy]|[Yy][Ee][Ss]) [Yy]|[Yy][Ee][Ss])
echo -n " What network interface would you like to use? " echo -n " What network interface would you like to use? "
read interface read interface
;; ;;
*) *)
echo " Invalid input, please try again." echo " Invalid input, please try again."
;; ;;
esac esac
done ip -4 link show $interface >/dev/null 2>&1
if [[ $strSuggestedInterface != $interface ]]; then if [[ $? -ne 0 ]]; then
strSuggestedSubMask=$(cidr2mask $(getCidr $interface)) echo
if [[ -z $strSuggestedSubMask ]]; then echo " * The network interface named $interface does not exist."
strSuggestedSubMask=$(/sbin/ifconfig -a | grep $strSuggestedIPAddress -B interface=""
1 | awk -F'[netmask ]+' '{print $4}' | head -n2) continue
strSuggestedSubMask=$(mask2cidr $strSuggestedSubMask)
fi fi
submask=$strSuggestedSubMask ipaddress=$(ip -4 addr show $interface | awk '$1 == "inet" {gsub(/\/.*$/, ""
, $2); print $2}')
if [[ $(validip $ipaddress) -ne 0 ]]; then
echo
echo " * The interface $interface does not seem to have a valid IP con
figured to it."
interface=""
continue
fi
submask=$(cidr2mask $(getCidr $interface))
if [[ -z $submask ]]; then
submask=$(/sbin/ifconfig -a | grep $ipaddress -B1 | awk -F'[netmask ]+'
'{print $4}' | head -n2)
submask=$(mask2cidr $submask)
fi
done
if [[ $strSuggestedHostname == $ipaddress ]]; then
strSuggestedHostname=$(hostnamectl --static)
fi fi
while [[ -z $hostname ]]; do
blHost="N"
if [[ -z $autoaccept ]]; then
echo
echo " Would you like to change the default hostname $strSuggestedHostn
ame?"
echo " The fully qualified hostname is used for the webserver certifica
te."
echo -n " If you are not sure, select No. [y/N] "
read blHost
fi
case $blHost in
[Nn]|[Nn][Oo]|"")
hostname=$strSuggestedHostname
;;
[Yy]|[Yy][Ee][Ss])
echo -n " Which hostname would you like to use? "
read hostname
;;
*)
echo " Invalid input, please try again."
;;
esac
done
case $installtype in case $installtype in
[Nn]) [Nn])
count=0 count=0
blRouter="" blRouter=""
blDNS="" blDNS=""
dodhcp=""
installlang="" installlang=""
while [[ -z $routeraddress ]]; do while [[ -z $routeraddress ]]; do
if [[ -z $autoaccept ]]; then if [[ -z $autoaccept ]]; then
echo echo
echo -n " Would you like to setup a router address for the DHCP server? [Y/n] " echo -n " Would you like to setup a router address for the DHCP server? [Y/n] "
read blRouter read blRouter
fi fi
case $blRouter in case $blRouter in
[Yy]|[Yy][Ee][Ss]|"") [Yy]|[Yy][Ee][Ss]|"")
if [[ $count -ge 1 ]] || [[ -z $autoaccept ]]; then if [[ $count -ge 1 ]] || [[ -z $autoaccept ]]; then
 End of changes. 10 change blocks. 
66 lines changed or deleted 61 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)