How to Change FOG PXE Boot Host Registration Options



  • Hello, I am looking to find out how I can change the default selections when registering a device into FOG. I am doing the full host registration and inventory, and a few of the options are set to (y,N) by default and I want to change them to (Y,n). The two are the options to Join to AD after image, and to Image after inventory is complete. I figured there is a configuration file on the FOG server somewhere for this, but I am not exactly sure where to find it. Any help would be greatly appreciated!

    Thanks!

    ~Intern



  • @Tom-Elliott Phew, you weren’t wrong when you said it was a bit overkill. I’m a bit apprehensive about doing anything that I can’t understand what is happening to the FOG server. For example, if something breaks with this script, I don’t know exactly where to fix it.

    I also still don’t have a bare metal backup of my FOG server yet, and I can’t afford to have it down, especially at the beginning of the school year (I work for a Public School). Possibly once I have a backup of it, and when school is out for a break or something, I’ll return to this and attempt it.

    Unless you’ve got an easier idea to change those defaults, I’ll just put it on the back burner until further notice.


  • Senior Developer

    @InternStarz Try this:

    cd /var/www/fog/service/ipxe;xz -d init{,_32}.xz

    My only guess, for right now, is the files were extracted, but inappropriately, or they were already extracted.

    Here’s a script I use to do this. This is specific to trunk so things that don’t necessarily require a complete rebuild of the inits, it just opens the files, gets my changes, and recompresses them:

    #!/bin/bash
     # Check for webroot
     if [ -n "$1" -a -e "$1" ]; then
         webroot="$1";
     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 extremely over complicated for what you need. But you could see what areas you want and need I suppose.



  • @ch3i I am running Ubuntu 14.04 LTS & FOG 1.2.0. Just installed it about a month ago.


  • Moderator

    @InternStarz which version of software are you using ?



  • @ch3i

    Ok, now we are getting a little further. I ran the same xz -d init{,_32}.xz command, and now I’m getting

    xz: init.xz: File format not recognized. Same with init_32.xz.


  • Moderator

    @InternStarz

    cd /var/www/fog/service/ipxe/
    


  • I’m attempting to run the command:

    cd /var/www/{html,}/fog/service/ipxe/
    xz -d init{,_32}.xz
    mkdir initmountdir
    mount -o loop init{,_32} initmountdir

    but once I get to the xz -d init{,_32}.xz command, it says xz: init.xz: No such file or directory. Same thins with init_32.xz.

    Any suggestions? I am also using sudo before trying to command. I have already done the cd command to navigate to the folder.


  • Moderator

    @InternStarz said:

    Hello, I am looking to find out how I can change the default selections when registering a device into FOG. I am doing the full host registration and inventory, and a few of the options are set to (y,N) by default and I want to change them to (Y,n). The two are the options to Join to AD after image, and to Image after inventory is complete. I figured there is a configuration file on the FOG server somewhere for this, but I am not exactly sure where to find it. Any help would be greatly appreciated!

    Thanks!

    ~Intern

    Ok, it’s sure now… it’s in the init.xz.

    You have to modify the file “fog.man.reg” in the /bin folder of you init.xz and init_32.xz.
    To mount and modify this file you have to read that : https://wiki.fogproject.org/wiki/index.php/Modifying_the_Init_Image


  • Moderator

    hi, not sure but I think it’s in the init.xz.


Log in to reply
 

434
Online

38994
Users

10714
Topics

101705
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.