Server
- FOG Version: 1.4.4
- OS: Ubuntu 16.04 Server
Client
- Service Version: N/A
- OS: Windows 10
Description
I am trying to use the Fog Post Download Scripts to rename my computers as they are imaged. I have created a couple of scripts taken and modified from this site, however when I copy them to the postdownloadscripts directory on the server and deploy an image the host isn’t renamed (I don’t even see any reference to the postdownload script even attempting to run). Does anything need to be enabled for these scripts to run?
I have no knowledge on how the scripting language used works so it is likely that there may be an issue with my scripts, can someone have a look over them and let me know how they look:
fog.postdownload:
#!/bin/bash
. /usr/share/fog/lib/funcs.sh
[[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
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
true
done
dots "Mounting partition $part"
ntfs-3g -o force,rw $part /ntfs >/dev/null 2>&1
if [[ ! $? -eq 0 ]]; then
echo "Failed"
debugPause
handleError "Failed to mount $part ($0)\n Args: $*"
fi
echo "Done"
debugPause
. ${postdownpath}fog.ad
umount /ntfs
;;
*)
echo "Invalid OS"
debugPause
return
;;
esac
fog.ad:
#!/bin/sh
unattend="/ntfs/Windows/Panther/Unattend.xml";
if [ -f "$unattend" ]; then
dots "Preparing Sysprep File";
rm -f /ntfs/Windows/System32/Sysprep/Unattend.xml;
echo "Done";
dots "Writing Computer Name";
sed -i "/ComputerName/s/*/$hostname/g" $unattend
echo "Done";
dots "ComputerName Set To";
echo $hostname
fi
Thanks