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

    Postdownload scripts variable issues.

    Scheduled Pinned Locked Moved Solved FOG Problems
    12 Posts 2 Posters 1.3k 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.
    • Greg PlamondonG
      Greg Plamondon Testers
      last edited by Greg Plamondon

      I am having issues with the $othertag populating when imaging a pc.
      if I set the Othertag under the host inventory to “Home” it doesn’t fire the appropriate “fog.replace-files_home” postdownload script.
      I am running Version 1.5.10.1639

      Thanks!

      #!/bin/bash
      . /usr/share/fog/lib/funcs.sh
      curl -A "" -Lkso /tmp/hinfo.sh "${web}/service/hostinfo.php?mac=$mac"
      . /tmp/hinfo.sh
      [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
      case $osid in
          5|6|7|9)
              clear
              [[ ! -d /ntfs ]] && mkdir -p /ntfs
              getHardDisk
              if [[ -z $hd ]]; then
                  handleError "Could not find hdd to use"
              fi
              getPartitions $hd
              for part in $parts; do
                  umount /ntfs >/dev/null 2>&1
                  fsTypeSetting "$part"
                  case $fstype in
                      ntfs)
                          dots "Testing partition $part"
                          ntfs-3g -o force,rw $part /ntfs
                          ntfsstatus="$?"
                          if [[ ! $ntfsstatus -eq 0 ]]; then
                              echo "Skipped"
                              continue
                          fi
                          if [[ ! -d /ntfs/windows && ! -d /ntfs/Windows && ! -d /ntfs/WINDOWS ]]; then
                              echo "Not found"
                              umount /ntfs >/dev/null 2>&1
                              continue
                          fi
                          echo "Success"
                          break
                          ;;
                      *)
                          echo " * Partition $part not NTFS filesystem"
                          ;;
                  esac
              done
              if [[ ! $ntfsstatus -eq 0 ]]; then
                  echo "Failed"
                  debugPause
                  handleError "Failed to mount $part ($0)\n    Args: $*"
              fi
              debugPause
              case $othertag in
                 [Hh][Oo][Mm][Ee])
                      . ${postdownpath}fog.replace-files_home
                      . ${postdownpath}fog.eastereggs
                      . ${postdownpath}fog.drivers
                      ;;
                 [Bb][Aa][Yy])
                      . ${postdownpath}fog.log
                      . ${postdownpath}fog.replace-files_bay
                      . ${postdownpath}fog.eastereggs
                      . ${postdownpath}fog.drivers
                      . ${postdownpath}fog.ad_bay
                      ;;
                 [Kk][Ee][Ee][Nn][Aa][Nn])
                      . ${postdownpath}fog.log
                      . ${postdownpath}fog.replace-files_keenan
                      . ${postdownpath}fog.eastereggs
                      . ${postdownpath}fog.drivers
                      . ${postdownpath}fog.ad_keenan
                      ;;
                 [Mm][Tt][Ss])
                      . ${postdownpath}fog.log
                      . ${postdownpath}fog.replace-files
                      . ${postdownpath}fog.eastereggs
                      . ${postdownpath}fog.drivers
                      . ${postdownpath}fog.ad_mts
                      ;;
      
                   *)
                      . ${postdownpath}fog.log
                      . ${postdownpath}fog.replace-files
                      . ${postdownpath}fog.eastereggs
                      . ${postdownpath}fog.drivers
                      . ${postdownpath}fog.ad_mts
                      ;;
              esac
              umount /ntfs
              ;;
          *)
              echo "Non-Windows Deployment"
              debugPause
              return
              ;;
      esac
      
      
      Tom ElliottT 1 Reply Last reply Reply Quote 0
      • Greg PlamondonG
        Greg Plamondon Testers @Tom Elliott
        last edited by

        @Tom-Elliott
        That was it, Tom. Thank you so much for helping me with this. I was starting to lose some hair!

        1 Reply Last reply Reply Quote 1
        • Tom ElliottT
          Tom Elliott @Greg Plamondon
          last edited by

          @Greg-Plamondon Are you willing to run a debug mode and echo what’s coming out of $othertag? just to ensure that’s being set accordingly? This won’t fix the issue, but will let us know that it’s being pulled in correctly.

          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

          Greg PlamondonG 1 Reply Last reply Reply Quote 0
          • Greg PlamondonG
            Greg Plamondon Testers @Tom Elliott
            last edited by Greg Plamondon

            @Tom-Elliott
            When in debug, if I type “echo $othertag” it doesn’t return any results.

            echo $hostname, $osid, $mac all return results.

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

              @Greg-Plamondon Are you sure the machien that’s loading has an other1 tag defined to it?

              Looking at the php that returns the export variables, other1 maps to $othertag and other2 maps to $othertag1

              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

              Greg PlamondonG 4 Replies Last reply Reply Quote 0
              • Greg PlamondonG
                Greg Plamondon Testers @Tom Elliott
                last edited by Greg Plamondon

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • Greg PlamondonG
                  Greg Plamondon Testers @Tom Elliott
                  last edited by Greg Plamondon

                  @Tom-Elliott

                  Well, this seems strange to me…
                  I can see the field populated in the GUI, but if I look in the database in the inventory table for host ID 248, the iOtherTag and iOthertag1 tables are empty

                  Greg PlamondonG 1 Reply Last reply Reply Quote 0
                  • Greg PlamondonG
                    Greg Plamondon Testers @Tom Elliott
                    last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • Greg PlamondonG
                      Greg Plamondon Testers @Greg Plamondon
                      last edited by Greg Plamondon

                      @Greg-Plamondon said in Postdownload scripts variable issues.:

                      @Tom-Elliott

                      Well, this seems strange to me…
                      I can see the field populated in the GUI, but if I look in the database in the inventory table for host ID 248, the iOtherTag and iOthertag1 tables are empty

                      iID 248 wasn’t the host i thought it was. I needed to search for I iHostID 248 set the other tag to a specific string and verified it was getting set in the database, So it is getting set in the table from the GUI.

                      1 Reply Last reply Reply Quote 0
                      • Greg PlamondonG
                        Greg Plamondon Testers @Tom Elliott
                        last edited by

                        @Tom-Elliott said in Postdownload scripts variable issues.:

                        @Greg-Plamondon Are you sure the machien that’s loading has an other1 tag defined to it?

                        Looking at the php that returns the export variables, other1 maps to $othertag and other2 maps to $othertag1

                        Tom,

                        I ran this query on the fog database to confirm the field is populate.

                        SELECT *
                            -> FROM inventory
                            -> WHERE iHostID = 248;
                        +-----+---------+--------------+-----------+------------+---------------------+---------------------+---------+-------------+-------------------+------------+---------------+--------------+-------------+------------+--------+----------------+------------------------------+-----------+----------+----------------------+------------------------------------------+-------------------------+---------------------+----------------------+---------------------------+-------------+----------------+----------+----------+-------------+------------+--------------------------------------+-------------------+-----------------+
                        | iID | iHostID | iPrimaryUser | iOtherTag | iOtherTag1 | iCreateDate         | iDeleteDate         | iSysman | iSysproduct | iSysversion       | iSysserial | iSystype      | iBiosversion | iBiosvendor | iBiosdate  | iMbman | iMbproductname | iMbversion                   | iMbserial | iMbasset | iCpuman              | iCpuversion                              | iCpucurrent             | iCpumax             | iMem                 | iHdmodel                  | iHdfirmware | iHdserial      | iCaseman | iCasever | iCaseserial | iCaseasset | iSystemUUID                          | iGpuvendors       | iGpuproducts    |
                        +-----+---------+--------------+-----------+------------+---------------------+---------------------+---------+-------------+-------------------+------------+---------------+--------------+-------------+------------+--------+----------------+------------------------------+-----------+----------+----------------------+------------------------------------------+-------------------------+---------------------+----------------------+---------------------------+-------------+----------------+----------+----------+-------------+------------+--------------------------------------+-------------------+-----------------+
                        | 205 |     248 |              | HOME      | HOME       | 2022-05-18 15:47:26 | 0000-00-00 00:00:00 | LENOVO  | 10MR0004US  | ThinkCentre M710q | MJ080Q8C   | Type: Mini PC | M1AKT48A     | LENOVO      | 11/22/2019 | LENOVO | 3111           | SDK0J40697 WIN 3305170406748 |           |          | Intel(R) Corporation | Intel(R) Core(TM) i5-7500T CPU @ 2.70GHz | Current Speed: 2600 MHz | Max Speed: 3300 MHz | MemTotal: 7934940 kB | SAMSUNGMZVLB256HAHQ-000L7 | 1L2QEXD7    | S41GNX1KA42571 | LENOVO   | None     | MJ080Q8C    |            | e3669280-1ea8-11e9-892a-6e6ca85d4600 | Intel Corporation | HD Graphics 630 |
                        +-----+---------+--------------+-----------+------------+---------------------+---------------------+---------+-------------+-------------------+------------+---------------+--------------+-------------+------------+--------+----------------+------------------------------+-----------+----------+----------------------+------------------------------------------+-------------------------+---------------------+----------------------+---------------------------+-------------+----------------+----------+----------+-------------+------------+--------------------------------------+-------------------+-----------------+
                        1 row in set (0.001 sec)
                        
                        1 Reply Last reply Reply Quote 0
                        • Greg PlamondonG
                          Greg Plamondon Testers
                          last edited by Greg Plamondon

                          To debug a little further, I placed an echo statement and debugPause before the case statement.

                                  echo "Othertag = $othertag"
                                  debugPause
                                  case $othertag in
                                     [Hh][Oo][Mm][Ee])
                                          . ${postdownpath}fog.replace-files_home
                                          . ${postdownpath}fog.eastereggs
                                          . ${postdownpath}fog.drivers
                                          ;;
                                     [Bb][Aa][Yy])
                                          . ${postdownpath}fog.log
                                          . ${postdownpath}fog.replace-files_bay
                                          . ${postdownpath}fog.eastereggs
                                          . ${postdownpath}fog.drivers
                                          . ${postdownpath}fog.ad_bay
                                          ;;
                                     [Kk][Ee][Ee][Nn][Aa][Nn])
                                          . ${postdownpath}fog.log
                                          . ${postdownpath}fog.replace-files_keenan
                                          . ${postdownpath}fog.eastereggs
                                          . ${postdownpath}fog.drivers
                                          . ${postdownpath}fog.ad_keenan
                                          ;;
                                     [Mm][Tt][Ss])
                                          . ${postdownpath}fog.log
                                          . ${postdownpath}fog.replace-files
                                          . ${postdownpath}fog.eastereggs
                                          . ${postdownpath}fog.drivers
                                          . ${postdownpath}fog.ad_mts
                                          ;;
                                       *)
                                          . ${postdownpath}fog.log
                                          . ${postdownpath}fog.replace-files
                                          . ${postdownpath}fog.eastereggs
                                          . ${postdownpath}fog.drivers
                                          . ${postdownpath}fog.ad_mts
                                          ;;
                                  esac
                          

                          While running a debug deploy, it returned: Othertag=

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

                            @Greg-Plamondon I forget what version of fog you’re running but I suspect (and had just forgotten initially, apologies) that you need to get the token:

                            Process for that is as such:
                            Would be to change:

                            curl -A "" -Lkso /tmp/hinfo.sh "${web}/service/hostinfo.php?mac=$mac"
                            

                            To:

                                base64mac=$(echo $mac | base64)
                                token=$(curl -Lks --data "mac=$base64mac" "${web}status/hostgetkey.php")
                                curl -A "" -Lkso /tmp/hinfo.sh --data "sysuuid=${sysuuid}&mac=$mac&hosttoken=${token}" "${web}service/hostinfo.php"
                            

                            Hopefully this helps?

                            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

                            Greg PlamondonG 1 Reply Last reply Reply Quote 0
                            • Greg PlamondonG
                              Greg Plamondon Testers @Tom Elliott
                              last edited by

                              @Tom-Elliott
                              That was it, Tom. Thank you so much for helping me with this. I was starting to lose some hair!

                              1 Reply Last reply Reply Quote 1
                              • Tom ElliottT Tom Elliott has marked this topic as solved
                              • 1 / 1
                              • First post
                                Last post

                              111

                              Online

                              12.2k

                              Users

                              17.4k

                              Topics

                              155.6k

                              Posts
                              Copyright © 2012-2025 FOG Project