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

    Pass ${fog-ip} to Install Script as a Variable

    Scheduled Pinned Locked Moved
    General
    2
    3
    451
    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.
    • D
      dangbird
      last edited by

      Hello All - I am attempting to pass the Fog Server host IP ${fog-ip} to an answerfile / Bash Script, so I do not have to manually edit the Fog Server IP in the script of the installer each time the fog IP changes (Long story).

      I tried passing as a variable using the kernel option such as at the end I put “thefogip=${fog-ip}” :
      kernel http://${fog-ip}/iso/xen80/boot/xen dom0_max_vcpus=4 dom0_mem=max:4096M com1=115200,8n1 console=com1,vga thefogip=${fog-ip}

      Then in my answer file (XML) I tried to reference it with :
      <script stage=“filesystem-populated” type=“url”>http://$thefogip/iso/xen80/scripts/post-script.sh</script>

      But the variable did not seem to populate…
      I also looked at this Post, but I am likely too ignorant to follow it.
      https://forums.fogproject.org/topic/11014/passing-host-variable-to-ipxe-menu/4

      Thanks!

      1 Reply Last reply Reply Quote 0
      • george1421G
        george1421 Moderator
        last edited by george1421

        While I’m not familiar with what you are trying to do, but I have a little insight.

        In the ipxe menu the ${fog-ip} is an ipxe menu run time variable as you see. So you are passing it as a kernel parameter here:

        kernel http://${fog-ip}/iso/xen80/boot/xen dom0_max_vcpus=4 dom0_mem=max:4096M com1=115200,8n1 console=com1,vga thefogip=${fog-ip}
        

        So the xen kernel will see a kernel parameter of thefogip and its IP address. So inside of the running xen OS you will need to read the kernel parameters and turn that into a bash variable.

        So how does FOS Linux do this? If you look at this URL: https://github.com/FOGProject/fos/blob/master/Buildroot/board/FOG/FOS/rootfs_overlay/usr/share/fog/lib/funcs.sh#L8

        You will see that the fog script runs cat /proc/cmdline to get the kernel parameters and that section from line 8 to 12 converts each kernel parameter into a bash variable and exports it. You will need to do something similar in your code within your xen kernel

        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!

        D 1 Reply Last reply Reply Quote 0
        • D
          dangbird @george1421
          last edited by

          @george1421 That is VERY CLEAR, thank you very much. Will reference the link and see if I can get my head around it. I appreciate your time and knowledge.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          160

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project