@Tom-Elliott
Here is how I added a postinitscript to my running FOG.
Using information from here I modified my init image (https://wiki.fogproject.org/wiki/index.php?title=Modifying_the_Init_Image)
In the S99FOG.sh I added at line 18:
if [ ! -z "$postinitscript" ]; then
mkdir /images
mount -o nolock,proto=tcp,rsize=32768,intr,noatime $storage /images
/images/postinitscripts/$postinitscript
umount /images
fi
I on the server I created a folder /images/dev/postinitscripts and a symbolic link to it in /images so that /images/postiniscripts is a valid path booting in both capture and deploy mode.
mkdir /images/dev/postinitscripts
ln -s /images/dev/postinitscripts /images/postinitscripts
Then I created the /images/postinitscripts/P50.sh which is a bash script which executes my mdadm build command to build my RAID array.
#!/bin/sh
#
mdadm --build /dev/md0 --raid-devices=2 --chunk=16 --level=0 /dev/sda /dev/sdb
Then on my P50 host I added the postinitscript=P50.sh to the “Host Kernel Arguments”
This way when the host boots in capture or deploy mode, S99FOG.sh checks to see if $postinitscript is set, if it is it mounts the images path and executes the specified script. I only have the one storage node, which is my FOG server. So I’m not sure if my method would work on a multinode configuration.
With this configuration I was able to boot and capture an image of my RAID configured Lenovo P50s and deploy that image to another identically configured Lenovo P50. Because the script can be specified per host, it’s customizable for other host which might need some postinit scripting.