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

    PXE Menu Delete Host

    Scheduled Pinned Locked Moved
    Tutorials
    2
    4
    2.5k
    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.
    • Tom ElliottT
      Tom Elliott
      last edited by

      Alright, all completed and, from what I can tell, working great.

      First things first.
      [B]NOTE: If things aren’t running or giving permission denied errors try prepending with sudo[/B]

      EXAMPLE:
      [CODE]sudo gunzip init.gz[/CODE]
      Login to your FOG server so you are the root owner, or with someone with sudo privileges.

      Change directory into your FOG tftpboot folder usually:
      [CODE]cd /tftpboot/fog/images[/CODE]

      Create a backup of the current init.gz:
      [CODE]cp /tftpboot/fog/images/init.gz /tftpboot/fog/images/init_orig.gz[/CODE]

      Extract the init.gz file with:
      [CODE]gunzip init.gz[/CODE]

      Make a directory to mount the file (I usually create tmp inside the images folder.)
      [CODE]mkdir tmp[/CODE]

      Mount the init file to the tmp directory.
      [CODE]mount -o loop init tmp[/CODE]

      Edit (use the editor you’re comfortable with) the etc/init.d/S99fog file:
      [CODE]vi tmp/etc/init.d/S99fog[/CODE]

      Add these three lines [B]ABOVE[/B] the fi statement at the bottom of the page.
      [CODE]elif [ “$mode” == “delreg”]; then
      run=“/bin/fog.auto.del”;
      after=$afterActionTerm;[/CODE]

      Now download the fog.auto.txt file linked to this post.
      Then rename the file to fog.auto.del
      Place on your FOG Server at:
      [CODE]/tftpboot/fog/images/tmp/bin[/CODE]

      Make sure the file is owned by user root and is executable with:
      [CODE]chmod +x /tftpboot/fog/images/tmp/bin/fog.auto.del; chown root:root /tftpboot/fog/images/tmp/bin[/CODE]

      Now you should be complete with the editing of the init.gz file. Close it out:
      [CODE]cd /tftpboot/fog/images
      umount /tftpboot/fog/images/tmp
      rm -rf /tftpboot/fog/images/tmp
      gzip -9 init[/CODE]

      Now you’re going to edit the pxe file with:
      [CODE]cd /tftpboot/pxelinux.cfg
      vi default[/CODE]

      Add the following lines [B]ABOVE[/B] the PROMPT 0 line:
      [CODE]LABEL fog.del
      MENU PASSWD password
      KERNEL fog/kernel/bzImage
      APPEND initrd=fog/images/init.gz root=/dev/ram0 rw ramdisk_size=127000 ip=dhcp dns=X.X.X.X mode=delreg keymap= web=X.X.X.X/fog/ loglevel=4 consoleblank=0
      MENU LABEL Quick Host Deletion
      TEXT HELP
      Automatically delete the host from FOG.
      ENDTEXT[/CODE]

      [B]NOTE: Don’t forget to change your dns and web fields for your particular host.[/B]

      Of course change the MENU PASSWD to what yours is setup for encrypted or not.

      Now copy the auto.delete.php file attached to this post to your service directory usually located at:
      FOR MOST REDHAT DEFAULT HTTP
      [CODE]/var/www/html/fog/service[/CODE]
      or:
      FOR MOST UBUNTU DEFAULT HTTP
      [CODE]/var/www/fog/service[/CODE]

      Then you should be complete.

      Hopefully I’ve helped.

      [url=“/_imported_xf_attachments/0/399_auto.delete.php?:”]auto.delete.php[/url][url=“/_imported_xf_attachments/0/403_fog.auto.txt?:”]fog.auto.txt[/url]

      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
      • Jaymes DriverJ
        Jaymes Driver Developer
        last edited by

        AWESOME THANK YOU, this saves me time and misspellings 😄

        WARNING TO USERS: My comments are written completely devoid of emotion, do not mistake my concise to the point manner as a personal insult or attack.

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

          I don’t know 0.32 layout, but I imagine that everything is similar but they’re not fully class based php files.

          That being said, here’s the code snippets that I used to add the deletion fog menu option to allow for password changes to the files.

          On 0.33 the files where:
          [CODE]{fogwebdir}/lib/pages/FOGConfigurationPage.class.php
          {fogwebdir}/commons/functions.include.php[/CODE]

          In FOGConfigurationPage.class.php I added to the pxemenu function below the quickimage table row end statement (</tr>):
          [PHP]
          <tr>
          <td>fog.deletehost password (blank for none):</td>
          <td><input type=“password” name=“delhost” value=“” id=“delhost” /></td>
          </tr>
          [/PHP]
          Then I had to change the below line in pxemenu_post() function:
          [PHP]
          if (generatePXEMenu($conn,$_POST[“menutype”],$_POST[“masterpassword”],$_POST[“memtestpassword”],$_POST[“reginputpassword”],$_POST[“regpassword”],$_POST[“quickimage”],$_POST[“sysinfo”],$_POST[“debugpassword”],$_POST[“timeout”],$_POST[“hidemenu”] == “on”,$_POST[‘adv’],$reason))
          [/PHP]
          To:
          [PHP]if (generatePXEMenu($conn,$_POST[“menutype”],$_POST[“masterpassword”],$_POST[“memtestpassword”],$_POST[“reginputpassword”],$_POST[“regpassword”],$_POST[“quickimage”],$_POST[“sysinfo”],$_POST[“debugpassword”],$_POST[“timeout”],$_POST[“hidemenu”] == “on”,$_POST[‘adv’],$_POST[‘delhost’],$reason))[/PHP]

          In functions.include.php I added below the Quick Image ENDTEXT Stanza within the generatePXE function:
          In the line with:
          [PHP]function generatePXEMenu( $conn, $type, $masterpw, $memtestpw, $reginputpw, $regpw, $quickpw, $sysinfo, $debugpw, $timeout, $blHide, $adv, &$reason )[/PHP]
          Changed it to say:
          [PHP]function generatePXEMenu( $conn, $type, $masterpw, $memtestpw, $reginputpw, $regpw, $quickpw, $sysinfo, $debugpw, $timeout, $blHide, $adv, $delhost, &$reason )[/PHP]
          Under the line saying:
          [PHP]$encSysinfo = “MENU PASSWD " . sysLinuxEncrypt( $conn, $sysinfo );[/PHP]
          I added two new lines:
          [PHP]if ( $delhost != null )
          $encDel = “MENU PASSWD " . sysLinuxEncrypt( $conn, $delhost );[/PHP]
          Then below the fog.quickimage ENDTEXT stanza I added the following lines.
          [PHP]LABEL fog.quickdel
          $encDel
          kernel " . $GLOBALS[‘FOGCore’]->getSetting( “FOG_TFTP_PXE_KERNEL” ) . "
          append initrd=” . $GLOBALS[‘FOGCore’]->getSetting( “FOG_PXE_BOOT_IMAGE” ) . " root=/dev/ram0 rw ramdisk_size=” . $GLOBALS[‘FOGCore’]->getSetting( “FOG_KERNEL_RAMDISK_SIZE” ) . " ip=dhcp dns=" . $GLOBALS[‘FOGCore’]->getSetting( “FOG_PXE_IMAGE_DNSADDRESS” ) . " mode=delreg keymap=" . $GLOBALS[‘FOGCore’]->getSetting( “FOG_KEYMAP” ) . " web=" . $GLOBALS[‘FOGCore’]->getSetting( “FOG_WEB_HOST” ) . $GLOBALS[‘FOGCore’]->getSetting( “FOG_WEB_ROOT” ) . " loglevel=4 consoleblank=0
          MENU LABEL “.(“Quick Host Deletion”)."
          TEXT HELP
          ".
          (“Automatically delete the host from FOG.”).”
          ENDTEXT[/PHP]

          [B]NOTE: I am a developer, so some of my changes are going to be slightly different than yours, I’m working off my personal code to help the system. [I]YOUR RESULTS MAY VERY![/I][/B]

          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
          • Jaymes DriverJ
            Jaymes Driver Developer
            last edited by

            I’ve been contemplating setting up a 0.33 server, but my 0.32 server works so well! I will figure out the ins and outs of getting this to work on 0.32 and post my findings.

            WARNING TO USERS: My comments are written completely devoid of emotion, do not mistake my concise to the point manner as a personal insult or attack.

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

            221

            Online

            12.1k

            Users

            17.3k

            Topics

            155.3k

            Posts
            Copyright © 2012-2024 FOG Project