Difference between revisions of "Modifying the Init Image"

From FOG Project
Jump to: navigation, search
m (fixed grammar errors on last line)
 
(By Hand)
Line 16: Line 16:
 
===By Hand===
 
===By Hand===
 
Or, to do it by hand:
 
Or, to do it by hand:
 +
==== Version 0.32 and below ====
 
<pre>
 
<pre>
 
cd /tftpboot/fog/images
 
cd /tftpboot/fog/images
Line 29: Line 30:
 
rmdir initmountdir
 
rmdir initmountdir
 
gzip init
 
gzip init
 +
</pre>
 +
 +
==== Version 1.0.0 and up ====
 +
<pre>
 +
cd /var/www/{html,}/fog/service/ipxe/
 +
xz -d init{,_32}.xz
 +
mkdir initmountdir
 +
mount -o loop init{,_32} initmountdir
 +
</pre>
 +
 +
After you're done making changes, you have to clean up and unmount the init image:
 +
<pre>
 +
cd /var/www/{html,}/fog/service/ipxe/
 +
umount initmountdir
 +
rmdir initmountdir
 +
xz -C crc32 -9 init{,_32}
 
</pre>
 
</pre>
  

Revision as of 15:57, 8 December 2014

Modifying the Boot Image

If you wish to modify the way that the pxe/tftp works files in the /tftpboot directory can be edited.

Using scripts

Modifying the boot image is easy to do. FOG comes with a script that enables you to easily modify the init image.

The script mounts the image and decompress it so you can view its files to modify them, however it tries to open nautilus to show you the files. Bear in mind that if you have no GUI (or your connected via ssh) you will have to browse the files manually in

/tmp/tmpMnt/

To run the script execute the file in here

/opt/fog/utils/Boot Image Editor/FOGMountBootImage.sh

That will execute the script, when your done modifying the Init image hit Enter and the file will be re compress and set ready to use.

By Hand

Or, to do it by hand:

Version 0.32 and below

cd /tftpboot/fog/images
gunzip init.gz
mkdir initmountdir
mount -o loop init initmountdir

After you're done making changes, you have to clean up and unmount the init image:

cd /tftpboot/fog/images
umount initmountdir/
rmdir initmountdir
gzip init

Version 1.0.0 and up

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

After you're done making changes, you have to clean up and unmount the init image:

cd /var/www/{html,}/fog/service/ipxe/
umount initmountdir
rmdir initmountdir
xz -C crc32 -9 init{,_32}

Examples

Adding sfdisk to the /sbin directory

This will add the sfdisk program into the boot environment:

cd /tftpboot/fog/images
gunzip init.gz
mkdir initmountdir
mount -o loop init initmountdir
init is now ready for modification. Make your changes:
cp /sbin/sfdisk /tftpboot/fog/images/initmountdir/sbin
Modifications Complete. Unmount and re-gzip it:
umount initmountdir
rmdir initmountdir
gzip init
Now you can use the sfdisk program from the PXE environment.

Remove Authentication from Quick Image

This example will show how to automatically authenticate users when they select Quick Image. If you are happy to allow anybody to deploy an image to a hardrive this is for you.

cd /tftpboot/fog/images
gunzip init.gz
mkdir initmountdir
mount -o loop init initmountdir
cd /tftpboot/fog/images/initmountdir/bin/

Edit fog.quickimage
Comment out the followig lines by putting a # in front

 #echo "  Enter a valid FOG username and password.";
 #echo "";
 #echo -n "      Username: ";
 #read username;
 #echo ""
 #echo -n "      Password: ";
 #stty -echo
 #read password;
 #stty echo;
 #echo "";
 #echo ""

Replace with:

 username="a valid username"
 password="a valid password";
Save the modification
cd ../..
umount initmountdir/
rmdir initmountdir
gzip init

You are done and now users can image without the need for a username and a password.