rBuilder:Installer Customization
From rPath Wiki
|
Installer Customization
Appliance developers using rBuilder and rPath Linux customize the installer to brand the appliance and modify the installer to best fit the needs of the appliance installation. Distribution developers can use the same process to customize the installer for a derivative distribution.
Requirements
rBuilder uses the Anaconda installer, which is written primarily in the Pythonâ„¢ programming language. Instructions provided here assume the audience has:
- Programming experience sufficient to be comfortable using Python
- Prior Conary packaging experience
- An rBuilder account and project
- A local build environment for Conary packaging configured for development of the rBuilder project
Customizing Packages
When rBuilder creates a build for installable ISO images, it generates a product.img file for the ISO. If a developer has created custom Anaconda packages and committed and cooked them in the project repository, rBuilder uses the packages when generating this file.
rBuilder recognizes the following four Conary packages for use in customizing Anaconda. Click each linked item for information and instructions:
Common Installer Customizations
The following are considerations and instructions for some common customizations for the installer for appliances created in rBuilder based on rPath Linux.
Adding Custom Graphics to the Installer
rBuilder brands an appliance installation based on information in the rBuilder project. It uses default graphics and information such as the project name. To customize the graphics for the installer, add custom pixmap files by creating an anaconda-custom package.
The following are the graphics typically customized when using anaconda-custom. They should be installed in /usr/share/anaconda/pixmaps:
| Filename | Size (in pixels) |
|---|---|
| anaconda_header.png | 800 x 58 |
| first.png | 800 x 600 |
| first-lowres.png | 640 x 480 |
| progress_first.png | 500 x 325 |
| progress_first-375.png | 353 x 170 |
| splash.png | 400 x 420 |
| syslinux-splash.png | 640 x 300 |
In the anaconda-custom recipe, use code as in the example here and modify it for your project:
class AnacondaCustom(PackageRecipe): name = 'anaconda-custom' version = '0.1' def setup(r): r.addSource('splash.png', dest = '/usr/share/anaconda/pixmaps/')
To ensure the appliance uses these customizations, commit the anaconda-custom package to the rBuilder project associated with the appliance's development. When creating an installable ISO image of the appliance, expand the Advanced Options when creating an appliance build in rBuilder to verify the anaconda-custom package will be included during the build process, or to choose a particular version of anaconda-custom (the most recent is used by default).
Customizing Package Selection
See Installer Software Selection for considerations and instructions for using groups in an rBuilder project to customize the package selection in the Anaconda installer.
Modifying Installer Steps/Forcing Defaults During Installation
Create a custom install class for your rBuilder project to skip Anaconda installer steps and to force default selections during installation. Use the anaconda-custom package to include this custom Python script and to install it in /usr/share/anaconda/installclasses/.
The following example is a script (class file) named custom.py created to instruct the installer to skip particular steps in installation. Use a corresponding dispatch.skipStep to skip each step:
from installclass import BaseInstallClass from rhpl.translate import * from constants import * import os import iutil class InstallClass(BaseInstallClass): hidden = 0 id = "testclass" name = N_("r_Test Install Class") pixmap = "icon.png" description = N_("Software Appliance Installation") sortPriority = 100 showLoginChoice = 1 def setSteps(self, dispatch): BaseInstallClass.setSteps(self, dispatch); # Skip a bunch of steps--should be fairly self-explanatory. dispatch.skipStep("partitionmethod") dispatch.skipStep("partition") dispatch.skipStep("authentication") dispatch.skipStep("bootloader") dispatch.skipStep("network") dispatch.skipStep("package-selection") dispatch.skipStep("firewall") dispatch.skipStep("confirminstall") def setGroupSelection(self, grpset, intf): BaseInstallClass.__init__(self, grpset) # Automatically select "Everything" in package selection. grpset.unselectAll() grpset.selectGroup("everything") def setInstallData(self, id): BaseInstallClass.setInstallData(self, id) # Default to clear ALL partitions on the system. You will be prompted first. BaseInstallClass.setDefaultPartitioning(self, id.partitions, CLEARPART_TYPE_ALL)
In the example, the line dispatch.skipStep("firewall") is included to skip the step for configuring the firewall. Using this to skip the step results in the installer accepting the Anaconda defaults, which is firewall enabled and blocking all incoming traffic. If the appliance requires the firewall to allow certain incoming connections, a developer can define the selections and still skip the firewall step in the installer. For example, the following line at the end of this file enables the firewall and allows ssh and http connections (on ports 22 and 80 respectively):
self.setFirewall(id, ports = ['22:tcp', '80:tcp'])
In the anaconda-custom recipe, use a line resembling the following to add your custom install class:
r.addSource('custom.py', dir = '/usr/share/anaconda/installclasses/')
Product Name and Version in Stage 1
Currently, the product name and version for rPath Linux is specified in a text file used in Stage 1 (first of two stages of the installation). The text file is makebootdisk.dir/.buildstamp in anaconda-templates, and currently there is no way to modify this text file besides creating a custom anaconda-templates package for the purpose. See Issue: RBL-1068
