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

Modifying the init image to truncate hostname to 15 characters

Scheduled Pinned Locked Moved
Tutorials
2
3
2.8k
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.
  • C
    chad-bisd Moderator
    last edited by Aug 6, 2012, 11:24 PM

    FOG Version: 0.32
    OS Version: Ubuntu 10.04 LTS Server i386

    I have the problem of naming hosts after users. Usually it’s LastnameFirstname, and sometimes this goes over the 15 character limit allowed by FOG. The database limits the host name to 16 characters, but the registration script only allows 15 characters (see function isSafeHostName() in /var/www/fog/commons/functions.include.php).

    Normally if you do a full registration via PXE and you put in a host name longer than 15 characters, the hostname gets switched to the MAC address of the host (without the “:”).

    The webUI lets you use 16 characters, which matches the database field length.

    Updating your init.gz via ([url]http://www.fogproject.org/wiki/index.php/Modifying_the_Init_Image[/url]), you can edit the FOG registration script as follows.

    Once you have the init file unzipped and mounted, edit the initmountdir/bin/fog.man.reg file. Look for:
    [CODE]
    echo
    echo -n " Enter the hostname of this computer: “;
    read host;
    [/CODE]
    insert
    [CODE]
    if [ ${#host} -gt 15 ]
    then
    host=${host:0:15};
    echo " Truncated to 15 characters: $host”;
    fi
    [/CODE]
    just before
    [CODE]
    host=echo $host | base64;
    [/CODE]

    save the file and exit. Do the steps in the wiki to exit the init environment and gzip it back.

    Now if you are doing a full registration and inventory, you no longer have to count the hostname to make sure it doesn’t go over 15 characters. It will truncate it and alert you to the new truncated name, and proceed with the next steps.

    Note: If you reinstall or upgrade FOG, your customizations to init.gz may be lost. Always backup init.gz before doing FOG updates other than kernel swaps.


    If you would like to make a donation to the Fog project, please do so [U][COLOR=#0000ff][URL='http://sourceforge.net/dona…

    1 Reply Last reply Reply Quote 0
    • T
      Tom Elliott
      last edited by Jan 20, 2014, 3:53 AM

      This functionality is now a part o FOG 0.33b as well as checks to ensure hostname is unique.

      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
      • C
        chad-bisd Moderator
        last edited by Jan 20, 2014, 4:37 PM

        woohoo!


        If you would like to make a donation to the Fog project, please do so [U][COLOR=#0000ff][URL='http://sourceforge.net/dona…

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

        235

        Online

        12.0k

        Users

        17.3k

        Topics

        155.2k

        Posts
        Copyright © 2012-2024 FOG Project