Screwed up fog.man.reg in init.xz


  • Testers

    Hey everyone,
    I made a rash decision and ended up messing up the fog.man.reg file in my init.xz (no backup, I’m a moron) whilst trying to remove some superfluous options (like primary user). I know there is a way to do it using post init scripts, but I don’t even know what post init scripts are :(

    I guess I’d like to know my options. Is there a way to regenerate this file? Like running the install again?

    Thanks!


  • Moderator

    @fry_p Your current efforts has not gone to waste. When the other method is proven, you will just move your patched fog.mag.reg to the fog server postinits directory and add in the postinit scripts to copy it over each time. What you have created to day will work just fine moving forward, you just won’t have to unpack and repack the inits after each change.


  • Testers

    @george1421 I will most likely try post init scripts eventually for that reason. I saw your post on the other thread and it honestly looks easier than what I did lol. I’m burned out today, plus I just got the thing working :)


  • Moderator

    @fry_p Ok that will work.

    We are also (in the other thread) working out a way to dynamic replace the init’s fog.reg.man file with a patched one so you don’t need to keep messing with the inits. The down side is if the original one gets changed as new features are added then your off-line one will be out of sync with production.


  • Testers

    @george1421 I use a script for auto updating to stable versions once a week. I added an rsync -ccommand to copy my init.xz to the /var/www/html/fog/service/ipxe folder based on checksum. It appears to work. I’ll let you guys know if I run into any trouble.


  • Moderator

    @fry_p said in Screwed up fog.man.reg in init.xz:

    My question is will an upgrade replace my custom init?

    The short answer is yes. You can either take a diff (linux application) of the changes between original and your fixed version and then apply that to the new version or just manually edit the new version.


  • Testers

    @george1421 That worked perfectly, thank you! So it is the way I want it. I don’t do RC’s for the time being because I need it to be stable, but when a new stable version comes out, I go for it. My question is will an upgrade replace my custom init?


  • Moderator

    @fry_p

    This is the section in question starting at line 245

    while [[ -z $askme ]]; do
        echo -n "    Would you like this host to join a domain, (using default settings)? (y/N) "
        read askme
        case $askme in
            [Nn]|[Nn][Oo]|"")
                askme="N"
                ;;
            [Yy]|[Yy][Ee][Ss])
                blDoAD=$(echo -n 1 | base64)
                askme="Y"
                ;;
            *)
                askme=""
                echo " * Invalid input, please try again"
                ;;
        esac
    done
    

    I might tweak it this way (to cause as little damage as possible)

    while [[ -z $askme ]]; do
        # echo -n "    Would you like this host to join a domain, (using default settings)? (y/N) "
        # read askme
    
        # force the answer to be Yes, always
        askme="Y"
        case $askme in
            [Nn]|[Nn][Oo]|"")
                askme="N"
                ;;
            [Yy]|[Yy][Ee][Ss])
                blDoAD=$(echo -n 1 | base64)
                askme="Y"
                ;;
            *)
                askme=""
                echo " * Invalid input, please try again"
                ;;
        esac
    done
    

  • Testers

    @george1421 I changed my mind on automatically saying yes to deploying an image. However, I still want an auto-yes for joining AD. I can’t seem to find where I would set the variable to force a yes. Would you guys take a peek at https://github.com/FOGProject/fogproject/blob/master/src/buildroot/package/fog/scripts/bin/fog.man.reg
    and tell me where I can force this? Thanks, I’m lousy at coding.


  • Moderator

    @fry_p While I haven’t look at the script in a while, I assume the questions just set a variable with y or n. So hide the question and then set the default for the variable. That sounds doable.

    Great job so far!


  • Testers

    Sorry for the double post, but I got the registration items I wanted to remove removed. My next task (if possible) is to change something so the “Would you like this host to join AD” and the “Would you like to deploy an image now” would be hidden as well but they should always be set to “yes”. If that makes any sense.


  • Testers

    Thanks, you guys rule. I’ll try again later, but for now, it is back to the default


  • Developer

    also, if you just need the original to compare against, to find your mistake, you can find it here:
    https://github.com/FOGProject/fogproject/tree/master/src/buildroot/package/fog/scripts/bin


  • Moderator

    wget -P /var/www/html/fog/service/ipxe/ https://fogproject.org/inits/init.xz
    wget -P /var/www/html/fog/service/ipxe/ https://fogproject.org/inits/init_32.xz

    There is another post that is doing the same thing (minus the afu of the registration script).
    Ref: https://forums.fogproject.org/topic/9754/custom-full-host-registration-for-1-3-4 I still owe the OP of that thread a little time to understand why the post init scripts are not running as they should.


  • Moderator

    You can rerun the installer or just download the inits again. Either way. I’ll grab the inits link in a second.


Log in to reply
 

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