Custom FOG Full host registration
This guide is to allow you remove questions asked during the full host registration process. In previous versions of FOG, the only way to customize this was to modify the /bin/fog.man.reg manually. The instructions on this link are for FOG versions 1.2.0 and below:
https://wiki.fogproject.org/wiki/index.php?title=Create_Custom_Fog_Registration_menu
In FOG 1.4.0rc2 and higher, we must use post init scripts. Once a major update is released, this tutorial can be modified to reflect those changes.
Let’s start by creating a few scripts. Secondly we will modify the fog.postinit script to call our custom scripts. Our first script that we will create will be called fog.man.reg.fix which will be a modified version of the script in /bin/fog.man.reg This script is actually everything that is performed when selecting the full host registration option when you boot into FOG but this tutorial utilizes post init scripts to “copy” our customized script and replaces /bin/fog.man.reg script. So let’s go to our steps and begin:
Step 1
Obtain a copy of /bin/fog.man.reg so we can modify it to our needs.
Here is the link on github:
https://github.com/FOGProject/fogproject/blob/master/src/buildroot/package/fog/scripts/bin/fog.man.reg
We can go ahead and place this file under /images/dev/postinitscripts/ and rename it to fog.man.reg.fix so we can reference it later.
As in the Wiki link earlier above, we will now modify the fog.man.reg.fix script using the same concepts. A good rule of thumb is for every question you want to remove during the full host registration process, you will have to delete the variable towards the bottom of the code.
ex:
askme=""
while [[ -z $askme ]]; do
echo -n " Would you like to associate this host with groups? (y/N) "
read askme
case $askme in
[Nn]|[Nn][Oo]|"")
askme="N"
;;
[Yy]|[Yy][Ee][Ss])
setIDs "groupid" "group" "true" "" 20
group64=$groupid
;;
*)
askme=""
echo " * Invalid input, please try again"
;;
esac
done
So if you don’t want to be asked this question above, you must delete everything between askme=“” and done. Then towards the bottom of the code, you will see the following:
while [[ -z $res ]]; do
res=$(curl -ks --data "mac=$mac&advanced=$(echo -n 1 | base64)&host=$host&imageid=$imageid&primaryuser=$primaryuser&other1=$other1&other2=$other2&doimage=$realdoimage&doad=$blDoAD&location=$location64&username=$user64&groupid=$group64&snapinid=$snapin64&productKey=$productKey" http://${web}service/auto.register.php 2>/dev/null)
echo "$res"
usleep 2000000
done
Look for the section where it says groupid because that is the variable we no longer need. So from there delete the following: &groupid=$group64 The & must be in the front of the variable being removed in case another variable must follow.
By following the steps on the Wiki link
https://wiki.fogproject.org/wiki/index.php?title=Create_Custom_Fog_Registration_menu
We can follow the same concepts. Now we can just really skip any modifications to the inits.
Step 2
Now that we have a customized fog.man.reg.fix script and placed it in the proper directory, we can now create the script that fog.postinit will call. We will call this script patch.fullreg and use the following code:
#!/bin/bash
echo "Installing Patch"
debugPause
cp -f ${postinitpath}fog.man.reg.fix /bin/fog.man.reg
echo "Done Patching stuff"
debugPause
We then save that file also in the same directory that fog.man.reg.fix and fog.postinit which is /images/dev/postinitscripts/ As you can see, we are really just copying our custom fog.man.reg.fix script to fog.man.reg This allows us to basically simplify our full host registration process. Through this process, we can now remove questions like product key, user1, user2, primary user, active directory, etc.
Notes: This will not work if using fog 1.3.0 - 1.4.0 rc 1 from my understanding. I’m sure I will be updating this post and making changes to improve the language and references. Hopefully with this, we can update the Wiki page to reflect the newer version of FOG and utilizing post init scripts in the future.