nrvr.distros.ub.rel1204.kickstart
index
/usr/lib/python2.7/site-packages/nrvr/distros/ub/rel1204/kickstart.py

nrvr.distros.ub.rel1204.kickstart - Create and manipulate Ubuntu kickstart files
 
Classes provided by this module include
Ub1204IsoImage
UbKickstartFileContent
 
To be improved as needed.
 
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
 
Public repository - https://github.com/srguiwiz/nrvr-commander
 
Copyright (c) Nirvana Research 2006-2015.
Simplified BSD License

 
Modules
       
nrvr
re

 
Classes
       
nrvr.distros.common.kickstart.DistroIsoImage(nrvr.diskimage.isoimage.IsoImage)
Ub1204IsoImage
nrvr.distros.common.kickstart.DistroKickstartFileContent(__builtin__.object)
UbKickstartFileContent

 
class Ub1204IsoImage(nrvr.distros.common.kickstart.DistroIsoImage)
    An Ubuntu .iso ISO CD-ROM or DVD-ROM disk image for use with kickstart.
 
 
Method resolution order:
Ub1204IsoImage
nrvr.distros.common.kickstart.DistroIsoImage
nrvr.diskimage.isoimage.IsoImage
__builtin__.object

Methods defined here:
__init__(self, isoImagePath)
Create new Ubuntu Ub1204IsoImage descriptor.
 
A descriptor can describe an .iso image that does or doesn't yet exist on the host disk.
modificationsIncludingKickstartFile(self, _kickstartFileContent)
Construct and return a list of modifications to be passed to method cloneWithModifications.
 
This method is called by method cloneWithAutoBootingKickstart, which takes the returned list
and passes it to method cloneWithModifications.
 
As implemented known to support Ubuntu 12.04 LTS.
Apparently much less luck using it with Ubuntu 14.04 LTS.
 
_kickstartFileContent
    A UbKickstartFileContent object.
 
Return a list of modifications which will be passed to method cloneWithModifications.

Methods inherited from nrvr.distros.common.kickstart.DistroIsoImage:
cloneWithAutoBootingKickstart(self, _kickstartFileContent, modifications=[], cloneIsoImagePath=None, ignoreJoliet=True)
Clone with kickstart file added and modified to automatically boot with it.
 
For more on behavior see documentation of class IsoImage method cloneWithModifications.
 
For details of modifications see method modificationsIncludingKickstartFile,
which is expected to be different per distro specific subclass.
 
_kickstartFileContent
    A DistroKickstartFileContent object.
 
cloneIsoImagePath
    if not given then in same directory with a timestamp in the filename.
 
return
    IsoImage(cloneIsoImagePath).
genisoimageOptions(self, bootImage='isolinux/isolinux.bin', bootCatalog='isolinux/boot.cat', label=None, udf=False, ignoreJoliet=True)
Auxiliary method, called by cloneWithModifications.
 
As implemented calls superclass method genisoimageOptions and extends the returned list.
 
Could be improved in the future.
Could be overridden for a subclass.

Methods inherited from nrvr.diskimage.isoimage.IsoImage:
cloneWithModifications(self, modifications=[], cloneIsoImagePath=None, udf=False, ignoreJoliet=True, pause=False)
Clone with any number of instances of IsoImageModification applied.
 
A temporary assembly directory in the same directory as cloneIsoImagePath needs disk space,
but it is removed automatically upon completion of cloning.
 
modifications
    a list of IsoImageModification instances.
 
cloneIsoImagePath
    if not given then in same directory with a timestamp in the filename.
 
return
    IsoImage(cloneIsoImagePath).
cloneWithModificationsUsingMount(self, modifications=[], cloneIsoImagePath=None, udf=False, ignoreJoliet=True, pause=False)
Clone with any number of instances of IsoImageModification applied.
 
This is an older implementation which regrettably because of the mount command requires
having superuser privileges.
It is still here in case a newer implementation doesn't work right, which could be for any
of a number of reasons, for example for symbolic links.
 
A temporary assembly directory in the same directory as cloneIsoImagePath needs disk space,
but it is removed automatically upon completion of cloning.
 
modifications
    a list of IsoImageModification instances.
 
cloneIsoImagePath
    if not given then in same directory with a timestamp in the filename.
 
return
    IsoImage(cloneIsoImagePath).
copyToDirectory(self, copyDirectory, udf=False, ignoreJoliet=True, tolerance=0.0)
Copy all files into a directory.
 
Not using mount command, no need to run as root.
exists(self)
Return True if .iso image exists on the host disk.
mount(self, mountDir, udf=False)
Mount .iso image.
remove(self)
Remove (delete) .iso image from the host disk.
unmount(self)
Unmount .iso image.

Class methods inherited from nrvr.diskimage.isoimage.IsoImage:
commandsUsedInImplementation(cls) from __builtin__.type
Return a list to be passed to SystemRequirements.commandsRequired().
 
This class can be passed to SystemRequirements.commandsRequiredByImplementations().

Data descriptors inherited from nrvr.diskimage.isoimage.IsoImage:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
isoImagePath
Path of the .iso image.

 
class UbKickstartFileContent(nrvr.distros.common.kickstart.DistroKickstartFileContent)
    The text content of an Anaconda kickstart file for Ubuntu.
 
 
Method resolution order:
UbKickstartFileContent
nrvr.distros.common.kickstart.DistroKickstartFileContent
__builtin__.object

Methods defined here:
__init__(self, string)
Create new kickstart file content container.
ubActivateGraphicalLogin(self)
Boot into graphical login on the installed system.
 
Do not use in a kickstart that does not install the X Window System.
 
return
    self, for daisychaining.
ubAddNetworkConfigurationDhcp(self, device)
Add an additional network device with DHCP.
 
device
    a string, e.g. "eth0".
    
    Should be increased past "eth0" if adding more than one additional configuration.
    
    As implemented there is no protection against a conflict in case there would be a
    pre-existing network configuration for the device.
 
return
    self, for daisychaining.
ubAddNetworkConfigurationStatic(self, device, ipaddress, netmask='255.255.255.0', gateway=None, nameservers=None)
Add an additional network device with static IP.
 
As implemented only supports IPv4.
 
device
    a string, e.g. "eth0".
    
    Should be increased past "eth0" if adding more than one additional configuration.
    
    As implemented there is no protection against a conflict in case there would be a
    pre-existing network configuration for the device.
 
ipaddress
    IP address.
 
netmask
    netmask.
    Defaults to 255.255.255.0.
 
gateway
    gateway.
    If None then default to ip.1.
 
nameservers
    one nameserver or a list of nameservers.
    If None then default to gateway.
    If empty list then remove option.
 
return
    self, for daisychaining.
ubCreateNetworkConfigurationSection(self)
Create the necessary network configuration section.
 
As implemented there is no protection against a conflict in case there would be a
pre-existing network configuration section.
 
return
    self, for daisychaining.
ubReplaceHostname(self, hostname)
Replace hostname value in preseed variable.
 
hostname
    new hostname.
 
return
    self, for daisychaining.
ubSetPreseedValue(self, qowner, qname, qtype, qvalue)
Set a preseed value in the command section.
 
qowner
    "d-i" or other owner.
 
qname
    name string, e.g. "pkgsel/update-policy".
 
qtype
    type string, e.g. "boolean", "string", "select", or "multiselect".
 
qvalue
    value string.
 
return
    self, for daisychaining.
ubSetUpdatePolicyNone(self)
Set policy for applying updates to "none".
 
No automatic updates.
 
return
    self, for daisychaining.
ubSetUpdatePolicyUnattended(self)
Set policy for applying updates to "unattended-upgrades".
 
Install security updates automatically.
 
return
    self, for daisychaining.
ubSetUpgradeFull(self)
Set whether to upgrade packages after debootstrap to "full-upgrade".
 
return
    self, for daisychaining.
ubSetUpgradeNone(self)
Set whether to upgrade packages after debootstrap to "none".
 
return
    self, for daisychaining.
ubSetUpgradeSafe(self)
Set whether to upgrade packages after debootstrap to "safe-upgrade".
 
return
    self, for daisychaining.
ubSetUser(self, username, pwd=None, fullname=None)
Set the one user Ubuntu kickstart can set up.
 
Ubuntu kickstart differs from Enterprise Linux in syntax.
Also, a full name is effectively required.
Also, only one user can be set by Ubuntu kickstart.
 
username
    username to set.
    
    The Linux username.
 
pwd
    pwd will be encrypted.  If starting with $ it is assumed to be encrypted already.
 
fullname
    the user's full name, which Ubuntu apparently expects to be given.
    
    If None then default to username.capitalize().
 
return
    self, for daisychaining.

Methods inherited from nrvr.distros.common.kickstart.DistroKickstartFileContent:
addPackage(self, package)
Add package or package group to %packages section.
 
return
    self, for daisychaining.
removeAllPackages(self)
Remove all packages and package groups from %packages section.
 
return
    self, for daisychaining.
removePackage(self, package)
Remove package or package group from %packages section.
 
return
    self, for daisychaining.
replaceAllPackages(self, packages)
Replace all packages and package groups in %packages section.
 
packages
    a list of packages and package groups.
 
return
    self, for daisychaining.
replaceLang(self, lang)
Replace lang option.
 
lang
    e.g. "de_DE.UTF-8" to replace "en_US.UTF-8".
    
    As implemented does not do any sanity checking.
 
return
    self, for daisychaining.
replaceRootpw(self, pwd)
Replace rootpw option.
 
pwd
    pwd will be encrypted.  If starting with $ it is assumed to be encrypted already.
 
return
    self, for daisychaining.
sectionByName(self, name)
Return section by name.
 
Return a KickstartFileSection, or None.
 
Setting a returned KickstartFileSection's string modifies the DistroKickstartFileContent.
 
If more than one section with same name returns first.
sectionsByName(self, name)
Return sections by name.
 
Return a list of KickstartFileSection, or empty list [].
 
Setting a returned KickstartFileSection's string modifies the DistroKickstartFileContent.
setSwappiness(self, swappiness)
Set swappiness.
 
swappiness
    an int between 0 and 100.
 
return
    self, for daisychaining.

Class methods inherited from nrvr.distros.common.kickstart.DistroKickstartFileContent:
cryptedPwd(cls, plainPwd) from __builtin__.type
Encrypt in a format acceptable for kickstart.
parseIntoSections(cls, whole) from __builtin__.type
Return sections as list of KickstartFileSection objects.

Data descriptors inherited from nrvr.distros.common.kickstart.DistroKickstartFileContent:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
sections
string
The whole content.
 
As implemented this is dynamically built, but it is
for the sake of correctness and maintainability.

Data and other attributes inherited from nrvr.distros.common.kickstart.DistroKickstartFileContent:
firstWordOfLineRegex = <_sre.SRE_Pattern object>