• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Start imaging right after the Full host registration (without reboot), possible ?

Scheduled Pinned Locked Moved
FOG Problems
3
6
655
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    tatanas
    last edited by tatanas Jul 11, 2022, 6:01 AM Jul 11, 2022, 12:00 PM

    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.

    G 1 Reply Last reply Jul 11, 2022, 12:33 PM Reply Quote 0
    • G
      george1421 Moderator @tatanas
      last edited by george1421 Jul 11, 2022, 6:36 AM Jul 11, 2022, 12:33 PM

      @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.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

      T 1 Reply Last reply Jul 11, 2022, 12:55 PM Reply Quote 1
      • T
        tatanas @george1421
        last edited by Jul 11, 2022, 12:55 PM

        @george1421 Thank you very much, It works like a charm ! (image in progress)

        G 1 Reply Last reply Jul 11, 2022, 1:03 PM Reply Quote 0
        • G
          george1421 Moderator @tatanas
          last edited by Jul 11, 2022, 1:03 PM

          @tatanas Would you mind posting what exactly you ended up with, for the record?

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!

          1 Reply Last reply Reply Quote 0
          • T
            tatanas
            last edited by Jul 11, 2022, 1:37 PM

            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
            
            
            1 Reply Last reply Reply Quote 1
            • D dsutton2001 referenced this topic on Aug 10, 2023, 1:08 AM
            • D
              dsutton2001
              last edited by Aug 10, 2023, 4:04 PM

              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

              My Post

              1 Reply Last reply Reply Quote 0
              • G george1421 referenced this topic on Oct 26, 2024, 11:47 AM
              • 1 / 1
              1 / 1
              • First post
                3/6
                Last post

              162

              Online

              12.0k

              Users

              17.3k

              Topics

              155.2k

              Posts
              Copyright © 2012-2024 FOG Project