Start imaging right after the Full host registration (without reboot), possible ?
-
Hi,
I’m trying, as the title says, to start image processing after full host registration without rebooting.
I already patched the fog.reg.man (postinit) to remove some questions.
But adding the line “. /bin/fog.download” at the end of the file generate an error. The variable “$osid” is not defined.
Then I look at the “/fog/service/ipxe/boot.php” file to find what is called when we choose the “Deploy Image” menu item… It just get some parameters, posts them to the fog server, then “autoboot” again on the network card. I don’t undestand how it starts the image process.So, is it possible to push the image without reboot ?
Thanks for your time.
-
@tatanas I know I hacked a solution years ago to do just this. For the life of me I can’t seem to find that post. If you are willing to work with me I think I can give you guidance on what needs to be done, then I can create a tutorial for others.
At the end of fog.man.reg there is this section as you have found.
dots "Attempting to register host" res="" while [[ -z $res ]]; do res=$(curl -Lks --data "sysuuid=${sysuuid}&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" ${web}service/auto.register.php 2>/dev/null) echo "$res" usleep 2000000 done . /bin/fog.inventory usleep 2000000
The curl call registers the system with FOG and also posts an imaging deploy task, because this variable is set
doimage=$realdoimage
So this sets the stage for imaging.
After the call to fog.inventory what you need to do is make a call to import the new environment (from the action of registering this computer with FOG) so it can pick up the imaging task.
I wrote a hack many years ago that go incorporate into the base image for USB imaging since iPXE was not being used.
That is in the master
fog
script: https://github.com/FOGProject/fos/blob/master/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog#!/bin/bash . /usr/share/fog/lib/funcs.sh ### If USB Boot device we need a way to get the kernel args properly if [[ $boottype == usb && ! -z $web ]]; then sysuuid=$(dmidecode -s system-uuid) sysuuid=${sysuuid,,} mac=$(getMACAddresses) curl -Lks -o /tmp/hinfo.txt --data "sysuuid=${sysuuid}&mac=$mac" "${web}service/hostinfo.php" -A '' [[ -f /tmp/hinfo.txt ]] && . /tmp/hinfo.txt fi
So what I would do is incorporate that section (minus the if statement) and once you stat the hinfo.txt file the environment should be properly setup to then jump to the /bin/fog.download command.
Will it work? It should. The fix I created at the time worked. Does it need a bit of debugging, yes it does. I think if you have made it this far with tweaking the fog.man.reg file you have the needed skills to take this next step.
-
@george1421 Thank you very much, It works like a charm ! (image in progress)
-
@tatanas Would you mind posting what exactly you ended up with, for the record?
-
At the end of fog.man.reg, just add those lines between “. /bin/fog.inventory” and “usleep 2000000”
sysuuid=$(dmidecode -s system-uuid) sysuuid=${sysuuid,,} mac=$(getMACAddresses) curl -Lks -o /tmp/hinfo.txt --data "sysuuid=${sysuuid}&mac=$mac" "${web}service/hostinfo.php" -A '' [[ -f /tmp/hinfo.txt ]] && . /tmp/hinfo.txt . /bin/fog.download
-
-
If you could somehow post your findings in more detail, that would be beneficial. I have followed the steps in this thread and i’m finding i am getting an OSID error. I did start a new thread/post
-