and the fog.custom.reg
[HTML]#!/bin/sh
. /usr/share/fog/lib/funcs.sh
clearScreen;
displayBanner;
hd=“”;
getHardDisk;
setupDNS ${dns}
sysman=“”;
sysman64=“”;
sysproduct=“”;
sysproduct64=“”;
sysversion=“”;
sysversion64=“”;
sysserial=“”;
systype=“”;
biosversion=“”;
biosvendor=“”;
biosdate=“”;
mbman=“”;
mbproductname=“”;
mbversion=“”;
mbserial=“”;
mbasset=“”;
cpuman=“”;
cpuversion=“”;
cpucurrent=“”;
cpumax=“”;
mem=“”;
hdinfo=“”;
caseman=“”;
casever=“”;
caseserial=“”;
casesasset=“”;
sysserial64=“”;
systype64=“”;
biosversion64=“”;
biosvendor64=“”;
biosdate64=“”;
mbman64=“”;
mbproductname64=“”;
mbversion64=“”;
mbserial64=“”;
mbasset64=“”;
cpuman64=“”;
cpuversion64=“”;
cpucurrent64=“”;
cpumax64=“”;
mem64=“”;
hdinfo64=“”;
caseman64=“”;
casever64=“”;
caseserial64=“”;
casesasset64=“”;
echo “”;
echo “”;
if [ -n “$hd” ]; then
part=$hd’1’;
echo " * Using disk device…$hd";
echo " * Starting host registration...";
mac=`ifconfig | grep HWaddr | head -n1 | base64`;
exists=`wget -O - --post-data="mac=${mac}" "http://${web}service/man.hostexists.php" 2>/dev/null`
if [ "$exists" = "#!ok" ]; then
host="";
imageid="";
osid="NQ==";
blImage="";
blDoAD="";
echo
echo -n " Enter the hostname of this computer: ";
read host;
host=`echo $host | base64`;
while [ "$imageid" = "" ]
do
res=`wget -O - "http://${web}service/imagelisting.php" 2>/dev/null`
i=0
OLDIFS=$IFS;
IFS='
';
for line in $res
do
i=$((i+1));
echo $line;
if [ “$i” = “20” ]
then
echo -n “Press Enter to Proceed…”
read dummy;
clearScreen
i=0;
fi
done
echo
echo -n " Enter the image ID for this computer: ";
read imageid;
imageid=`echo $imageid | base64`;
done
if [ "$blDoAD" = "" ]
then
echo
echo -n " Would you like to add this host to AD (using default settings)? (y/N) ";
read tmpAd;
blDoAD="0";
case "$tmpAd" in
Y | yes | y | Yes | YES )
blDoAD="1";
;;
[nN]*)
;;
*)
;;
esac
fi
echo
echo " If you entered all the required information, ";
echo -n " would you like to image this computer now? (y/N) ";
read blImage;
realdoimage="0";
case "$blImage" in
Y | yes | y | Yes | YES )
tmp="";
echo
echo
echo " You have selected to image this host. This";
echo " will destroy all current data on this computer.";
echo " Are you sure you wish to continue?";
sleep 1;
echo -n " If so type \"fog\": ";
read tmp;
tmp=`echo $tmp | tr '[A-Z]' '[a-z]'`
if [ "$tmp" = "fog" ]; then
echo
echo " This host will reboot and imaging will start!";
echo
realdoimage="1";
else
echo
echo " You have NOT confirmed imaging, so we will not send an image!";
echo
fi
sleep 3;
;;
[nN]*)
;;
*)
;;
esac
echo
echo -n " * Attempting to register host.................";
res="";
while [ "${res}" = "" ]
do
res=`wget -O - --post-data="mac=${mac}&advanced=1&host=${host}&imageid=${imageid}&osid=${osid}&doimage=${realdoimage}&doad=${blDoAD}" "http://${web}service/auto.register.php" 2>/dev/null`
echo "${res}";
sleep 2;
done;
else
echo " * Unable to register host for the following reasons:";
echo " ${exists}";
sleep 10;
fi
doInventory;
echo
echo
echo
echo " System Information";
echo " ------------------";
echo
echo " * System Manufacturer: $sysman";
echo " * System Product Name: $sysproduct";
echo " * System Version: $sysversion";
echo " * System Serial Number: $sysserial";
echo " * Computer Form Factor: $systype";
sleep 1;
echo
echo " BIOS Information";
echo " ----------------";
echo
echo " * BIOS Version: $biosversion";
echo " * BIOS Vendor: $biosvendor";
echo " * BIOS Date: $biosdate";
sleep 1
echo
echo " Motherboard Information";
echo " -----------------------";
echo
echo " * Motherboard Manufacturer: $mbman";
echo " * Motherboard Product Name: $mbproductname";
echo " * Motherboard Product Version: $mbversion";
echo " * Motherboard Serial Number: $mbserial";
echo " * Motherboard Asset Tag: $mbasset";
sleep 1
echo
echo " CPU Information";
echo " ---------------";
echo
echo " * CPU Manufacturer: $cpuman";
echo " * CPU Version: $cpuversion";
echo " * CPU Current Speed: $cpucurrent";
echo " * CPU Max Speed: $cpumax";
sleep 1
echo
echo " Memory Information";
echo " ------------------";
echo
echo " * Memory: $mem";
sleep 1
echo
echo " Hard Disk Information";
echo " ---------------------";
echo
echo " * Hard Disk: $hdinfo";
sleep 1
echo
echo " Case Information";
echo " ----------------";
echo
echo " * Case Manufacturer: $caseman";
echo " * Case Version: $casever";
echo " * Case Serial Number: $caseserial";
echo " * Case Asset Number: $casesasset";
echo
echo
echo
echo
echo
poststring="mac=${mac}&sysman=${sysman64}&sysproduct=${sysproduct64}&sysversion=${sysversion64}&sysserial=${sysserial64}&systype=${systype64}&biosversion=${biosversion64}&biosvendor=${biosvendor64}&biosdate=${biosdate64}&mbman=${mbman64}&mbproductname=${mbproductname64}&mbversion=${mbversion64}&mbserial=${mbserial64}&mbasset=${mbasset64}&cpuman=${cpuman64}&cpuversion=${cpuversion64}&cpucurrent=${cpucurrent64}&cpumax=${cpumax64}&mem=${mem64}&hdinfo=${hdinfo64}&caseman=${caseman64}&casever=${casever64}&caseserial=${caseserial64}&casesasset=${casesasset64}";
echo -n " * Attempting to send inventory................";
res="";
while [ "$res" = "" ]; do
res=`wget -O - --post-data="${poststring}" "http://${web}service/inventory.php" 2>/dev/null`
echo "$res";
sleep 3;
done
else
echo “hard disk not found!”;
fi
sleep 10
[/HTML]