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

    Post Init Script Issues

    Scheduled Pinned Locked Moved
    FOG Problems
    4
    13
    953
    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.
    • Chris WhiteleyC
      Chris Whiteley @Sebastian Roth
      last edited by

      @Sebastian-Roth The reason I know it’s not being used is because the changes I made are not happening during a full registration and the script “echo’s” are not there. Here is the patch.fullreg

      currfile="/bin/fog.man.reg"
      newfile="${postinitpath}fog.man.reg.fix"
      
      . /usr/share/fog/lib/funcs.sh
      
      echo "Testing path for our fixed file at ${postinitpath}fog.man.reg.fix"
      debugPause
      
      # Test path and run copy if found and matched.
      if [[ -r $newfile ]]; then
          echo "Found file preparing to copy"
          debugPause
          cp -f $newfile $currfile >/dev/null 2>&1
          [[ ! $? -eq 0 ]] && echo "Copy Failed" || echo "Copy Succeeded"
          debugPause
      else
          echo "Failed to find file sorry"
          debugPause
      fi
      

      This was borrowed from Tom Elliot’s post. I tried the very simple one first and that didn’t work, so I tried this one next and the same issue.

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

        @Chris-Whiteley so what does your fog.postinit script look like?

        Again I’ll refer you to my post: https://forums.fogproject.org/topic/14278/creating-custom-hostname-default-for-fog-man-reg

        Specifically look at the fog.patch.customhostname and fog.postinit sections.

        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!

        Chris WhiteleyC 2 Replies Last reply Reply Quote 0
        • Chris WhiteleyC
          Chris Whiteley @george1421
          last edited by

          @george1421 I ended up figuring it out. I had 3 different locations in /images that had the “postinitscripts” folder which I thought was odd. I had it at the root of /images, inside of /images/dev and inside of /images/dev/dev/. I ended up copying the same things into those 2 other folders and now it is working. I am not sure where it is pulling from though.

          Tom ElliottT 1 Reply Last reply Reply Quote 0
          • Chris WhiteleyC
            Chris Whiteley @george1421
            last edited by

            @george1421 I already showed you right in the question I asked, but since you want to see it again:

            #!/bin/bash
            ## This file serves as a starting point to call your custom pre-imaging/post init loading scripts.
            ## <SCRIPTNAME> should be changed to the script you're planning to use.
            ## Syntax of post init scripts are
            #. ${postinitpath}<SCRIPTNAME>
            . ${postinitpath}patch.fullreg
            
            1 Reply Last reply Reply Quote 0
            • Tom ElliottT
              Tom Elliott @Chris Whiteley
              last edited by

              @Chris-Whiteley PostInit pulls from /images/dev/postinitscripts (the ${postinitpath} is defined as this.)

              The /images/dev/dev should not exist but won’t hurt anything either.

              I’ll paste the code below, but just for understanding of what it does:

              It looks for postinit script in /imagesinit based on the type of task.
              Capture task: /imagesinit/ mounted would be looking at /images/dev/
              Deploy task: /imagesinit/ would be looking at /images/

              The code that sets this up:

              dots "Running post init scripts"
              [[ ! -d /imagesinit ]] && mkdir /imagesinit >/dev/null 2>&1
              umount /imagesinit >/dev/null 2>&1
              mount -o nolock,proto=tcp,rsize=32768,wsize=32768,intr,noatime "$storage" /imagesinit >/tmp/mount-output 2>&1
              if [[ $? -eq 0 ]]; then
                  if [[ -f /imagesinit/.mntcheck ]]; then
                      if [[ -f /imagesinit/postinitscripts/fog.postinit ]]; then
                          postinitpath="/imagesinit/postinitscripts/"
                      elif [[ -f /imagesinit/dev/postinitscripts/fog.postinit ]]; then
                          postinitpath="/imagesinit/dev/postinitscripts/"
                      fi
                      . ${postinitpath}fog.postinit
                  fi
                  umount /imagesinit >/dev/null 2>&1
                  echo "Done"
                  debugPause
              else
                  echo "Skipped"
                  debugPause
              fi
              

              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

              Chris WhiteleyC george1421G 2 Replies Last reply Reply Quote 0
              • Chris WhiteleyC
                Chris Whiteley @Tom Elliott
                last edited by

                @Tom-Elliott Thanks Tom for showing that. It looks like mine is pulling from /images/postinitscripts and not the /images/dev/postinitscripts for doing a full host registration and inventory. Is there a way to change “other tag” and other verbiage both in the FOG web and in the database? Basically, I am looking to put certain info inside of FOG and then find a way to export that out to a different system.

                For Instance, when my company buys computers, we have to track the Purchase Order (P.O.) they go with. I would like to have one of the prompts be asking for the P.O. and then find a way to export that or send that info to another system.

                Is that even possible?

                1 Reply Last reply Reply Quote 0
                • S
                  Sebastian Roth Moderator
                  last edited by

                  @Chris-Whiteley Run the following commands and post output here:

                  ls -al /images/dev/postinitscripts/
                  cat /images/dev/postinitscripts/fog.postinit
                  

                  I just tested and your script works as far as I can see.

                  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

                  Chris WhiteleyC 1 Reply Last reply Reply Quote 0
                  • Chris WhiteleyC
                    Chris Whiteley @Sebastian Roth
                    last edited by

                    @Sebastian-Roth

                    ls -al /images/dev/postinitscripts/

                    drwxrwsrwx. 2 fogproject root    70 Nov  3 15:26 .
                    drwsrwsrwx. 4 fogproject root    73 Nov  4 07:45 ..
                    -rwxrwxrwt. 1 fogproject root 10000 Nov  3 15:19 fog.man.reg.fix
                    -rwxrwxrwx. 1 fogproject root   279 Nov  3 15:45 fog.postinit
                    -rwxrwxrwt. 1 fogproject root   502 Nov  3 15:48 patch.fullreg
                    

                    cat /images/dev/postinitscripts/fog.postinit

                    #!/bin/bash
                    ## This file serves as a starting point to call your custom pre-imaging/post init loading scripts.
                    ## <SCRIPTNAME> should be changed to the script you're planning to use.
                    ## Syntax of post init scripts are
                    #. ${postinitpath}<SCRIPTNAME>
                    . ${postinitpath}patch.fullreg
                    
                    1 Reply Last reply Reply Quote 0
                    • george1421G
                      george1421 Moderator @Tom Elliott
                      last edited by

                      @Tom-Elliott said in Post Init Script Issues:

                      It looks for postinit script in /imagesinit based on the type of task.
                      Capture task: /imagesinit/ mounted would be looking at /images/dev/
                      Deploy task: /imagesinit/ would be looking at /images/

                      Possibly we need to take this discussion off line but shouldn’t we consider creating a symbolic links between /images/dev/postinitscripts and /images/postinitscripts if the point of view changes between image capture and deployment? This way there is only one location contains the file that are used with both capture and deployment.

                      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!

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

                        @george1421 Remember that during a capture, the $storage variable is defined, usually:

                        IPAddress:/images/dev

                        In the case of a deplooy the $storage variable is defined, usually:

                        IPAddress:/images

                        That’s why the checking.

                        If somebody wants to move the postinit into /images, then it should be symlinked, but that’s beyond our scope. That’s more of a preference .

                        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

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

                        288

                        Online

                        12.0k

                        Users

                        17.3k

                        Topics

                        155.2k

                        Posts
                        Copyright © 2012-2024 FOG Project