Personal tools
     DOCUMENTATION

rPath Linux:Custom Install Classes

From rPath Wiki

Jump to: navigation, search

Create a custom install class to aid in customizing the installer for appliances created in rBuilder based on rPath Linux. Use custom install classes to direct Anaconda to:

  • Skip steps in the install process
  • Apply default settings for steps
  • Customize package selection

To create a custom install class, add a Python script to a anaconda-custom package for the rBuilder project. Write the package recipe to install this script in /usr/share/anaconda/installclasses/

The following is an example install class and a sample anaconda-custom recipe used to incorporate the script.

custom.py

import os
import iutil
 
from rhpl.translate import *
 
from constants import *
from installclass import BaseInstallClass
 
class InstallClass(BaseInstallClass):
    hidden = 0
 
    id = "testclass"
    name = N_("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)

anaconda-custom.recipe

class AnacondaCustom(PackageRecipe):
    name = 'anaconda-custom'
    version = '0.1'
 
    def setup(r):
        r.addSource('custom.py', dir = '/usr/share/anaconda/installclasses/')
        r.addArchive('pixmaps.tar.gz', dir = '/usr/share/anaconda/')