@Quazz Thanks, that was my mistake (doh!)
I’ve since fixed it, though I suspect the dmidecode part isn’t working as it doesn’t extract the CAB file from the FOG server into the DRV folder on the Windows machine (I’m not altogether certain that machine='dmidecode -s system-product-name';
returns “Latitude E6410”).
The full script is below and doesn’t rely on anything else. In the meantime I’ll try it again and try running the dmidecode part in a debugging session to see if I can figure it out.
EDIT: Doh! I had a typo… it’s dmidecode - NOT dmiedecode.
Unfortunately, the CAB extraction still doesn’t seem to be working
#!/bin/bash
. /usr/share/fog/lib/funcs.sh
case $osid in
5|6|7|9)
clear
[[ ! -d /ntfs ]] && mkdir -p /ntfs
getHardDisk
if [[ -z $hd ]]; then
handleError "Could not find hdd to use"
fi
getPartitions $hd
for part in $parts; do
umount /ntfs >/dev/null 2>&1
fsTypeSetting "$part"
case $fstype in
ntfs)
dots "Testing partition $part"
ntfs-3g -o force,rw $part /ntfs
ntfsstatus="$?"
if [[ ! $ntfsstatus -eq 0 ]]; then
echo "Skipped"
continue
fi
if [[ ! -d /ntfs/windows && ! -d /ntfs/Windows && ! -d /ntfs/WINDOWS ]]; then
echo "Not found"
umount /ntfs >/dev/null 2>&1
continue
fi
echo "Success"
break
;;
*)
echo " * Partition $part not NTFS filesystem"
;;
esac
done
if [[ ! $ntfsstatus -eq 0 ]]; then
echo "Failed"
debugPause
handleError "Failed to mount $part ($0)\n Args: $*"
# Give the reader a chance to see what the error was
sleep 12;
# Terminate the post driver script
exit 1;
fi
ceol='tput el';
machine='dmidecode -s system-product-name'; #Gets machine model
machine="${machine%"${machine##*[![:space:]]}"}" #Removes trailing space
dots "Preparing Drivers";
#Check if the DRV folder exists on the local PC:
if [ ! -d "ntfs/Windows/DRV" ]
then
mkdir /ntfs/Windows/DRV &>/dev/null;
echo -n "In progress"
fi
# Only use CAB files for the drivers.
# Place the cab files for the specific system on the FOG Server:
# i.e. Model Latitude E5410, Windows 7 x64 image would be:
# /fog/Drivers/Win7/Latitude E5410/x64
cabextract -d /ntfs/Windows/DRV "/images/Drivers/${machine}"/*.CAB &>/dev/null;
# Add the driver location on the PC to devicepath in Registry:
regfile="/ntfs/Windows/System32/config/SOFTWARE"
key="\Microsoft\Windows\CurrentVersion\DevicePath"
devpath="%SystemRoot%\inf;%SystemRoot%\DRV";
reged -e "$regfile" &>/dev/null <<EOFREG
ed $key
$devpath
q
y
EOFREG
# Remove the "In Progress" and replace it with: "Done"
echo -e "\b\b\b\b\b\b\b\b\b\b\b${ceol}Done";
esac