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

Post Registration Questions and Functions

Scheduled Pinned Locked Moved
FOG Problems
3
5
1.1k
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
    TreyBentley
    last edited by May 23, 2016, 4:26 PM

    I didn’t see anything, so the answer is probably “No,” or I didn’t know how to word my search query, but I’ll ask it anyways.

    Is there any way to have the questions that are asked during Full Host Inventory and Registration have any custom questions appended that won’t be overwritten anytime we update the trunk? The same goes for any scripts as well.

    My goals behind asking this question are:

    • Pass the MAC address through to PacketFence for auto-approval.
    • Depending on the answer to the Active Directory question, if yes, then ask what OU the unit should be in.

    I’ve the code already written in our .32 version of Fog or about 2 years or so, so I’m not worried about that. It may take some tweaking, but that’s fine. I just don’t want to modify a 64-bit init.xz and a 32-bit init.xz separately, only to have them both “updated” at next “git pull” & “./installsh -y”

    1 Reply Last reply Reply Quote 0
    • G
      george1421 Moderator
      last edited by May 23, 2016, 4:37 PM

      Just thinking out loud on the first question (btw: I know what packetfence is/does/used it).

      You want to create way to call an external url with the mac address of the device to authorize it in your network. Now the request can come from the target computer or the FOG server. You may be able to do this if you wrote a custom plugin and hooked into the registration event. I can say I don’t know how to write plugins, but I bet that is the cleanest route for you do you don’t have to mess with the inits with each release.

      As for the proper OU. Is there something unique about the OU that can be calculated at deployment time? For example all computers deployed at IP subnet of 192.168.112.x go to ou “ou=madrid,dc=company,dc=com”. FOG has a way to execute custom bash scripts post image deployment but pre first windows boot. I use something similar to update the unattend.xml file with location specific setting just after partclone lays down the image.

      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 May 23, 2016, 4:45 PM Reply Quote 0
      • T
        TreyBentley @george1421
        last edited by May 23, 2016, 4:45 PM

        @george1421 said in Post Registration Questions and Functions:

        a custom plugin and hooked into the registration event.

        Very interesting suggestion! I like it and will attempt some research on it!

        Is there something unique about the OU that can be calculated at deployment time? For example all computers deployed at IP subnet of 192.168.112.x go to ou “ou=madrid,dc=company,dc=com”. FOG has a way to execute custom bash scripts post image deployment but pre first windows boot.

        Unfortunately, no. Most all computers are imaged in a central location, and then taken to their destination. But thank you for the suggestion, though. Also, computers might have already been imaged (via vendor), and just need registration; so post image deployment won’t work in all cases.

        1 Reply Last reply Reply Quote 0
        • T
          TreyBentley
          last edited by May 23, 2016, 7:04 PM

          her-doy…

          It just hit me that I can change up the reg questions, save the xz file with a different name, and point FOG_PXE_BOOT_IMAGE[_32] to the new file in the settings. Another thread created for not thinking well…

          1 Reply Last reply Reply Quote 0
          • T
            Tom Elliott
            last edited by May 23, 2016, 9:21 PM

            I may think of a mechanism to do a “post-registrationscripts” setup that works similarly to post-download script. However, part of the registration system does not require storage information which is really what’s needed to do this properly.

            Your mechanism of updating an init for yourself would work, but it does make keeping up with changes in the init’s a little more difficult, though I don’t imagine much of the changes affecting the way your init would work.

            I have a script that allows me to customize init’s on the fly in the case my build system is just taking too long.

            #!/bin/bash
            # Check for webroot
            if [ -n "$1" -a -e "$1" ]; then
                webroot="$1";
            elif [ -e "/srv/http/fog" ]; then
                webroot="/srv/http/fog";
            elif [ -e "/var/www/html/fog" ]; then
                webroot="/var/www/html/fog";
            elif [ -e "/var/www/fog" ]; then
                webroot="/var/www/fog";
            fi
            if [ ! -e "$webroot/service" ]; then
                echo "No service directory to work from"
                exit 1
            fi
            if [ ! -e "$webroot/service/ipxe" ]; then
                echo "No ipxe directory to work from"
                exit 1
            fi
            ipxeroot="$webroot/service/ipxe"
            currDirectory=`pwd`
            init64=''
            init32=''
            if [ ! -f "$ipxeroot/init.xz" -a ! -f "$ipxeroot/init" ]; then
                echo "No 64 bit init to process"
                init64='no'
            fi
            if [ ! -f "$ipxeroot/init_32.xz" -a ! -f "$ipxeroot/init_32" ]; then
                echo "No 32 bit init to process"
                init32='no'
            fi
            if [ -n "$init64" -a -n "$init32" ]; then
                echo "No init files to process"
                exit 1
            fi
            if [ ! -e "$ipxeroot/tmp" ]; then
                mkdir $ipxeroot/tmp >/dev/null 2>&1
            fi
            copyTrunkFiles() {
                svn up /root/trunk/ >/dev/null 2>&1
                cp -r /root/trunk/src/buildroot/package/fog/scripts/bin/* $ipxeroot/tmp/bin/ >/dev/null 2>&1
                cp -r /root/trunk/src/buildroot/package/fog/scripts/usr/* $ipxeroot/tmp/usr/ >/dev/null 2>&1
                cp -r /root/trunk/src/buildroot/package/fog/scripts/etc/* $ipxeroot/tmp/etc/ >/dev/null 2>&1
                cp -r /root/trunk/src/buildroot/system/skeleton/etc/* $ipxeroot/tmp/etc/ >/dev/null 2>&1
                errorStat $?
            }
            mountTmpFolder() {
                mount -o loop $ipxeroot/$1 $ipxeroot/tmp >/dev/null 2>&1
                if [ -z "$2" ]; then
                    errorStat $?
                elif [ "$?" != "0" -a -f "$ipxeroot/$1" ]; then
                    unmountTmpFolder "true"
                    mountTmpFolder "$1"
                fi
            }
            unmountTmpFolder() {
                umount $ipxeroot/tmp >/dev/null 2>&1
                if [ -z "$1" ]; then
                    errorStat $?
                fi
            }
            initFSCheck() {
                fsck.ext2 -a $ipxeroot/$1 >/dev/null 2>&1
                errorStat $?
            }
            recompressInit() {
                xz -9 -C crc32 >/dev/null 2>&1 < $ipxeroot/$1 > $ipxeroot/${1}.xz
                errorStat $?
            }
            decompressInit() {
                xz -d >/dev/null 2>&1 < $ipxeroot/${1}.xz > $ipxeroot/$1
                errorStat $?
            }
            errorStat() {
                if [ "$1" != "0" ]; then
                    echo "Failed"
                    exit 1
                fi
                echo "OK"
            }
            if [ -z "$init64" ]; then
                if [ -f "$ipxeroot/init.xz" -a ! -f "$ipxeroot/init" ]; then
                    echo -n " * Decompressing 64 bit init..."
                    decompressInit "init"
                else
                    echo " * 64 bit init already extracted"
                fi
                echo -n " * Mounting 64 bit init..."
                mountTmpFolder "init" "yes"
                echo -n " * Copying trunk files..."
                copyTrunkFiles
                echo -n " * Unmounting init..."
                unmountTmpFolder
                echo -n " * Checking ext2 filesystem..."
                initFSCheck "init"
                echo -n " * Recompressing 64 bit Init..."
                recompressInit "init"
            fi
            if [ -z "$init_32" ]; then
                if [ -f "$ipxeroot/init_32.xz" -a ! -f "$ipxeroot/init_32" ]; then
                    echo -n " * Decompressing 32 bit init..."
                    decompressInit "init_32"
                else
                    echo " * 32 bit init already extracted"
                fi
                echo -n " * Mounting 32 bit init..."
                mountTmpFolder "init_32" "yes"
                echo -n " * Copying trunk files..."
                copyTrunkFiles
                echo -n " * Unmounting init..."
                unmountTmpFolder
                echo -n " * Checking ext2 filesystem..."
                initFSCheck "init_32"
                echo -n " * Recompressing 32 bit Init..."
                recompressInit "init_32"
            fi
            

            I realize this is probably not customized for your needs, but it should do what you need in a pinch. Of course you’re more than welcome to editing it.

            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
            1 / 1
            • First post
              5/5
              Last post

            316

            Online

            12.0k

            Users

            17.3k

            Topics

            155.2k

            Posts
            Copyright © 2012-2024 FOG Project