Custom Full Host Registration Menu for 1.4.0.rc2 and later
-
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: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.
-
Would it be possible to select a default image and snapins and not have it show those options?
-
@Avaryan Yes you could “hard wire” the registration script to select any option required.
There is also a plugin that simulates static groups. You create a template host and link it with a group. Then when you add a new host to that group, the template host settings get copied to the new host.
-
@george1421 Finally got around to testing this. I was able to remove the unwanted options, no issues.
I was also able to get it set to join AD domain, but I wasn’t able to get it to pick an image or snapins. Is there a specific way that the values need to be entered?
-
Noticed that the link to fog.man.reg above is broken. I attempted to extract the file myself using a modified version of the old instructions (unxz init, mount -o loop init initmountdir/, etc.) and am able to get the file, however when I zip back up init it breaks everything.
Anyway, I did end up figuring it out, but thought you would want to know that the link to the file was dead.
-
Thank you. That is weird. Probably something on githubs end. Hopefully @george1421 or @Tom-Elliott could help.
-
@jgallo We must be aware of a few things here.
- The github site always contains the latest release. So (currently) the files contained are for FOG 1.5.0. If you are working on a down level version of FOG then you need to take the route of extracting the inits. You don’t need to repack the inits, because you only need the file you want to tweak. Once you have the file you want to patch, then you may unmount the loop directory and remove the unpacked init.
- The structure of files may change from release to release. In the case of FOS, it was split out into its own branch. The correct path (as of 1.5.0) to the file in question is: https://github.com/FOGProject/fos/blob/master/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.man.reg (full disclosure, it took me a bit to find the right path too).
- The only caution is as newer versions of FOG are released, your patch file may become stale, where you might need to update a newer versions of fog.man.reg as newer versions of FOG are released. The risk is that you might be applying an older version of fog.man.reg over an updated version fog.man.reg breaking FOG without a clue why.
The rest of the instructions by @JGallo are still accurate (at least for 1.5.0). You can still use the post init scripts to “patch” the current FOS image as in the original post.