GenVM - Customization scripts

All elements is customizable with GenVM by a simple mechanism of scripts, located on a chosen directory, and executed from virtual machine, from master or from master after the installation (for operations on disk image like chown, copy, etc).

The “-t” option, set the directory containing the personalizations scripts (here scripts are located on directory “3rd”):

fhh@aaricia ~ $ su -c "genvm -t 3rd vm.vmdk"

The order and context of execution are define by the scripts names, that’s why it must respect accurate name syntax:

this is a number, in two digits (so between 00 and 99), defining the order of execution of script
define where the script is executed
chroot mean script executed on this virtual machine
host mean script executed from host
post mean script executed after the installation
this is a name of script

Files that don’t respect this name syntax are ignored.

Executions rights aren’t need (scripts are sourced).

Your virtual machine contain very few packages, so if you use on chrooted environment a command, be sure it’s available. Example, to use wget, install it first.

Example of personalizations scripts tree:

├── 01.chroot.norecommends

Variables and functions

In scripts executed in host environment or “post generation”, you can use some variables initialized by GenVM and functions defined in it.


Architecture of virtual machine.
This is the name of image disk generated.
This is the location where the future virtual machine is mounted (so where your future VM is accessible).
Name of virtual machine.
file or directory containing third party part.


set_passwd_to <username> <password>
This function set the password <password> to user <username>. User must exist.

Example of scripts

Category “scripts” offer some useful scripts to personalize your machine.

Network configuration of VM

This script executed from host set the network configuration of virtual machine.

aaricia ~ # cat >
cat > "${MOUNT_POINT}/etc/network/interfaces <<_eof_
auto lo eth0                    
iface lo inet loopback
iface eth0 inet dhcp

Obviously, you should install ifupdown, isc-dhcp-client or udhcpc on your VM (have look on GenVM - Add packages to install additional packages).

Activate NoRecommends

This script executed from the created VM, disable installation of recommended packages on Debian.

aaricia ~ # cat > ~/scripts.genvm/01.chroot.norecommends
cat > /etc/apt/apt.conf.d/02norecommends <<_eof_
APT::Install-Recommends False;

Keyboard layout

In this example, script (executed on virtual machine) set the keyboard layout to french one:

aaricia ~ # cat > ~/scripts.genvm/03.chroot.keymap
cat > /etc/default/keyboard <<_eof_

Remember to add “console-setup” on list of packages (have look on GenVM - Add packages to install additional packages).

Only run personalizations scripts

The “-T” option placed on the line used to create the virtual machine permit the execution of third party scripts only.

fhh@aaricia ~ $ su -c "genvm -Tt 3rd vm.vmdk"

Combined with “-v” or stronger with “-D” this options is ideal in development stage.