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

    Use serial number as hostname in Fog

    Scheduled Pinned Locked Moved FOG Problems
    22 Posts 4 Posters 3.0k Views
    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.
    • X
      Xinzo @george1421
      last edited by

      @george1421
      Okay I understand.
      In my fog.auto.reg the curl is sending to this script :

      ${web}service/auto.register.php 2>/dev/null)
      Maybe there’s something to do with this file ?

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

        @xinzo said in Use serial number as hostname in Fog:

        auto.register.php

        Yes that is the file you will edit on the FOG server itself. It should be in the path I provided previously. Now that I think about it I might want to change the auto prop value to CUSTOM instead of SYSSERIAL and then make a write up on this for those fog admins that want to create a custom auto name value. I always use the full registration on my campus so I never thought about the auto naming process. I think you are onto something that will be useful to other fog admins.

        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!

        X 1 Reply Last reply Reply Quote 0
        • X
          Xinzo @george1421
          last edited by

          @george1421
          I’ve done it !
          The “old” fog.auto.reg is :

          if [[ -f "/bin/fog.customhostname" ]]; then
              . /bin/fog.customhostname
          fi
          
          if [[ -f /sys/firmware/acpi/tables/MSDM ]]; then
              productKey=$(tail -c+57 /sys/firmware/acpi/tables/MSDM | base64)
          fi
          while [[ -z $res ]]; do
              res=$(curl -Lks --data "host=${host_default_name}&sysserial=${sysserial}&sysuuid=${sysuuid}&mac=$mac&productKey=${productKey}" ${web}service/auto.register.php 2>/dev/null)
          

          Here is the trick :

          while [[ -z $res ]]; do
                  host=${host_default_name}
                  host=$(echo $host | base64)
                  res=$(curl -Lks --data "host=$host&sysserial=${sysserial}&sysuuid=${sysuuid}&mac=$mac&productKey=${productKey}" ${web}service/auto.register.php 2>/dev/null)
          

          We have to convert to base64 and then send to the script. It works like a charm.
          I suceeded when I inspected the fog.man.reg.fix Here is what helped me :

          while [[ $res != "#!ok" ]]; do
              if [[ $host_default_name != "" ]]; then
                  read -p " * Enter hostname for this computer [$host_default_name]: " host
              else
                  read -p " * Enter hostname for this computer: " host
              fi
              host=${host:-$host_default_name}
              if [[ ${#host} -gt 15 ]]; then
                  host=${host:0:15}
                  echo " | Truncated to 15 characters: $host"
                  usleep 2000000
              fi
              host=$(echo $host | base64)
              res=$(curl -Lks --data "host=$host" ${web}service/hostnameloop.php 2>/dev/null)
              [[ $res != "#!ok" ]] && echo "$res"
          
          
          done
          

          Those line
          host=${host:-$host_default_name}
          host=$(echo $host | base64)
          res=$(curl -Lks --data "host=$host" ${web}service/hostnameloop.php 2>/dev/null)

          Thank you very much for your help 😁

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

            @xinzo well done! Now just make sure you backup everything since you hacked the fog environment. That way when/if you upgrade you don’t lose your hacks. But really nice. I’m really more than willing to help someone help themselves success with FOG. This way you can get exactly what works for your situation.

            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!

            X 1 Reply Last reply Reply Quote 0
            • X
              Xinzo @george1421
              last edited by

              Thanks 😁
              For people who want to do this. Don’t forget to set the QUICKREG SYS NAME in the FOG SETTINGS to SYSSERIAL.
              @george1421 Can I upload my file somewere for the people who want to implement the feature ?

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

                @xinzo If you want to post them here, I’ll rewrite the instructions as a tutorial and then provide a link to this thread. You might need to change the extension of the files to .txt so they can be uploaded. I can see other wanting this feature too. I know I personally missed it since the FOG v0.30 days.

                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!

                X A 2 Replies Last reply Reply Quote 0
                • X
                  Xinzo @george1421
                  last edited by

                  @george1421
                  Here are my files, I’ve upload all the content of my postinitscripts folder:
                  fog.postinit.txt
                  fog.patch.customhostname.txt
                  fog.man.reg.fix.txt
                  fog.customhostname.txt
                  fog.auto.reg.txt

                  @george1421 said in Use serial number as hostname in Fog:

                  I can see other wanting this feature too. I know I personally missed it since the FOG v0.30 days.

                  Without you, impossible to implement this feature. Thanks a lot

                  1 Reply Last reply Reply Quote 1
                  • A
                    AlexisPHC @george1421
                    last edited by

                    @george1421 did you ever get round to writing a guide for this? It’s a shame this can’t be included in the main branch for quick registration, because we just name machines off the system serial number here and you have to pay extra now for a bloomin barcode with Dell!

                    Tom ElliottT 1 Reply Last reply Reply Quote 0
                    • Tom ElliottT
                      Tom Elliott @AlexisPHC
                      last edited by

                      @AlexisPHC You can set this by putting the name field of quick registration as {SYSSERIAL}

                      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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        AlexisPHC @Tom Elliott
                        last edited by

                        @Tom-Elliott said in Use serial number as hostname in Fog:

                        {SYSSERIAL}

                        Ah, lovely, thanks Tom, I’ll give that a go - I tried SYSSERIAL on it’s own and it didn’t work but didn’t realise it needed the curly brackets!

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

                        221

                        Online

                        12.4k

                        Users

                        17.4k

                        Topics

                        155.9k

                        Posts
                        Copyright © 2012-2025 FOG Project