Documentation
¶
Index ¶
- Constants
- Variables
- func AddOrUpdateUsers(users []imagecustomizerapi.User, baseConfigPath string, ...) error
- func CustomizeImage(buildDir string, baseConfigPath string, config *imagecustomizerapi.Config, ...) error
- func CustomizeImageWithConfigFile(buildDir string, configFile string, imageFile string, rpmsSources []string, ...) error
- func FindLinuxLine(inputGrubCfgContent string) (grub.Line, error)
- func FindNonRecoveryLinuxLine(inputGrubCfgContent string) ([]grub.Line, error)
- func GetDefaultGrubFileLinuxArgs(defaultGrubFileContent string, varName defaultGrubFileVarName) (defaultGrubFileVarAssign, []grubConfigLinuxArg, int, error)
- func GrubArgsToString(args []string) string
- func ParseCommandLineArgs(argTokens []grub.Token) ([]grubConfigLinuxArg, error)
- func ReadGrub2ConfigFile(imageChroot safechroot.ChrootInterface) (string, error)
- func UpdateDefaultGrubFileVariable(defaultGrubFileContent string, varName string, newValue string) (string, error)
- func UpdateHostname(hostname string, imageChroot safechroot.ChrootInterface) error
- func UpdateSELinuxModeInConfigFile(selinuxMode imagecustomizerapi.SELinuxMode, ...) error
- func WriteDefaultGrubFile(grub2Config string, imageChroot safechroot.ChrootInterface) error
- type BootCustomizer
- func (b *BootCustomizer) AddKernelCommandLine(extraCommandLine string) error
- func (b *BootCustomizer) GetSELinuxMode(imageChroot safechroot.ChrootInterface) (imagecustomizerapi.SELinuxMode, error)
- func (b *BootCustomizer) IsGrubMkconfigImage() bool
- func (b *BootCustomizer) PrepareForVerity() error
- func (b *BootCustomizer) SetRootDevice(rootDevice string) error
- func (b *BootCustomizer) UpdateKernelCommandLineArgs(defaultGrubFileVarName defaultGrubFileVarName, argsToRemove []string, ...) error
- func (b *BootCustomizer) UpdateSELinuxCommandLine(selinuxMode imagecustomizerapi.SELinuxMode) error
- func (b *BootCustomizer) WriteToFile(imageChroot safechroot.ChrootInterface) error
- type DracutPackageInformation
- type ImageConnection
- func (c *ImageConnection) Chroot() *safechroot.Chroot
- func (c *ImageConnection) CleanClose() error
- func (c *ImageConnection) Close()
- func (c *ImageConnection) ConnectChroot(rootDir string, isExistingDir bool, extraDirectories []string, ...) error
- func (c *ImageConnection) ConnectLoopback(diskFilePath string) error
- func (c *ImageConnection) Loopback() *safeloopback.Loopback
- type ImageCustomizerParameters
- type IsoArtifacts
- type IsoSavedConfigs
- type IsoWorkingDirs
- type LiveOSIsoBuilder
- type OSSavedConfigs
- type PxeSavedConfigs
- type SavedConfigs
Constants ¶
const ( PxeDracutMinVersion = 102 PxeDracutMinPackageRelease = 7 PxeDracutDistroName = "azl" PxeDracutMinDistroVersion = 3 )
const ( SkippableFrameMagicNumber uint32 = 0x184D2A50 SkippableFramePayloadSize uint32 = UuidSize SkippableFrameHeaderSize int = 8 )
const ( // supported input formats ImageFormatVhd = "vhd" ImageFormatVhdFixed = "vhd-fixed" ImageFormatVhdx = "vhdx" ImageFormatQCow2 = "qcow2" ImageFormatIso = "iso" ImageFormatRaw = "raw" // qemu-specific formats QemuFormatVpc = "vpc" BaseImageName = "image.raw" PartitionCustomizedImageName = "image2.raw" )
const (
UuidSize uint32 = 16
)
Variables ¶
var ( // Version specifies the version of the Azure Linux Image Customizer tool. // The value of this string is inserted during compilation via a linker flag. ToolVersion = "" )
Functions ¶
func AddOrUpdateUsers ¶
func AddOrUpdateUsers(users []imagecustomizerapi.User, baseConfigPath string, imageChroot safechroot.ChrootInterface) error
func CustomizeImage ¶
func CustomizeImage(buildDir string, baseConfigPath string, config *imagecustomizerapi.Config, imageFile string, rpmsSources []string, outputImageFile string, outputImageFormat string, outputSplitPartitionsFormat string, outputPXEArtifactsDir string, useBaseImageRpmRepos bool, enableShrinkFilesystems bool, ) error
func FindLinuxLine ¶
Find the linux command within the grub config file.
func FindNonRecoveryLinuxLine ¶
Find the linux command within non-recovery mode menuentry block in the grub config file.
func GetDefaultGrubFileLinuxArgs ¶
func GetDefaultGrubFileLinuxArgs(defaultGrubFileContent string, varName defaultGrubFileVarName, ) (defaultGrubFileVarAssign, []grubConfigLinuxArg, int, error)
Takes the string contents of a /etc/default/grub file and the name of the command-line args variable (either "GRUB_CMDLINE_LINUX" or "GRUB_CMDLINE_LINUX_DEFAULT") and returns a list of kernel command-line args.
Params:
- defaultGrubFileContent: The string contents of the /etc/default/grub file.
- varName: The name of variable that contains kernel command-line args. Either "GRUB_CMDLINE_LINUX" or "GRUB_CMDLINE_LINUX_DEFAULT".
Returns:
- cmdLineVarAssign: The variable assignment that matches 'varName'.
- args: The list of kernel command-line args.
- insertAt: An index that new kernel command-line args can be inserted at.
func GrubArgsToString ¶
Takes a list of unescaped and unquoted kernel command-line args and combines them into a single string with appropriate quoting for a grub.cfg file.
func ParseCommandLineArgs ¶
Takes a tokenized grub.cfg file and makes a best effort to extract the kernel command-line args.
func ReadGrub2ConfigFile ¶
func ReadGrub2ConfigFile(imageChroot safechroot.ChrootInterface) (string, error)
Reads the /boot/grub2/grub.cfg file.
func UpdateDefaultGrubFileVariable ¶
func UpdateDefaultGrubFileVariable(defaultGrubFileContent string, varName string, newValue string) (string, error)
Sets the value of a variable in the /etc/default/grub file, either replacing the existing variable value (if one exists) or adding a new one.
func UpdateHostname ¶
func UpdateHostname(hostname string, imageChroot safechroot.ChrootInterface) error
func UpdateSELinuxModeInConfigFile ¶
func UpdateSELinuxModeInConfigFile(selinuxMode imagecustomizerapi.SELinuxMode, imageChroot safechroot.ChrootInterface) error
func WriteDefaultGrubFile ¶
func WriteDefaultGrubFile(grub2Config string, imageChroot safechroot.ChrootInterface) error
Writes the string contents of the /etc/default/grub file.
Types ¶
type BootCustomizer ¶
type BootCustomizer struct {
// contains filtered or unexported fields
}
func NewBootCustomizer ¶
func NewBootCustomizer(imageChroot safechroot.ChrootInterface) (*BootCustomizer, error)
func (*BootCustomizer) AddKernelCommandLine ¶
func (b *BootCustomizer) AddKernelCommandLine(extraCommandLine string) error
Inserts new kernel command-line args into the grub config file.
func (*BootCustomizer) GetSELinuxMode ¶
func (b *BootCustomizer) GetSELinuxMode(imageChroot safechroot.ChrootInterface) (imagecustomizerapi.SELinuxMode, error)
func (*BootCustomizer) IsGrubMkconfigImage ¶
func (b *BootCustomizer) IsGrubMkconfigImage() bool
Returns whether or not the OS uses grub-mkconfig.
func (*BootCustomizer) PrepareForVerity ¶
func (b *BootCustomizer) PrepareForVerity() error
Makes changes to the /etc/default/grub file that are needed/useful for enabling verity.
func (*BootCustomizer) SetRootDevice ¶
func (b *BootCustomizer) SetRootDevice(rootDevice string) error
func (*BootCustomizer) UpdateKernelCommandLineArgs ¶
func (b *BootCustomizer) UpdateKernelCommandLineArgs(defaultGrubFileVarName defaultGrubFileVarName, argsToRemove []string, newArgs []string, ) error
func (*BootCustomizer) UpdateSELinuxCommandLine ¶
func (b *BootCustomizer) UpdateSELinuxCommandLine(selinuxMode imagecustomizerapi.SELinuxMode) error
Update the image's SELinux kernel command-line args.
func (*BootCustomizer) WriteToFile ¶
func (b *BootCustomizer) WriteToFile(imageChroot safechroot.ChrootInterface) error
type ImageConnection ¶
type ImageConnection struct {
// contains filtered or unexported fields
}
func NewImageConnection ¶
func NewImageConnection() *ImageConnection
func (*ImageConnection) Chroot ¶
func (c *ImageConnection) Chroot() *safechroot.Chroot
func (*ImageConnection) CleanClose ¶
func (c *ImageConnection) CleanClose() error
func (*ImageConnection) Close ¶
func (c *ImageConnection) Close()
func (*ImageConnection) ConnectChroot ¶
func (c *ImageConnection) ConnectChroot(rootDir string, isExistingDir bool, extraDirectories []string, extraMountPoints []*safechroot.MountPoint, includeDefaultMounts bool, ) error
func (*ImageConnection) ConnectLoopback ¶
func (c *ImageConnection) ConnectLoopback(diskFilePath string) error
func (*ImageConnection) Loopback ¶
func (c *ImageConnection) Loopback() *safeloopback.Loopback
type ImageCustomizerParameters ¶
type ImageCustomizerParameters struct {
// contains filtered or unexported fields
}
type IsoArtifacts ¶
type IsoArtifacts struct {
// contains filtered or unexported fields
}
`IsoArtifacts` holds the extracted/generated artifacts necessary to build a LiveOS ISO image.
type IsoSavedConfigs ¶
type IsoSavedConfigs struct {
KernelCommandLine imagecustomizerapi.KernelCommandLine `yaml:"kernelCommandLine"`
}
func (*IsoSavedConfigs) IsValid ¶
func (i *IsoSavedConfigs) IsValid() error
type IsoWorkingDirs ¶
type IsoWorkingDirs struct {
// contains filtered or unexported fields
}
type LiveOSIsoBuilder ¶
type LiveOSIsoBuilder struct {
// contains filtered or unexported fields
}
type OSSavedConfigs ¶
type OSSavedConfigs struct {
DracutPackageInfo *DracutPackageInformation `yaml:"dracutPackage"`
}
func (*OSSavedConfigs) IsValid ¶
func (i *OSSavedConfigs) IsValid() error
type PxeSavedConfigs ¶
type PxeSavedConfigs struct {
IsoImageBaseUrl string `yaml:"isoImageBaseUrl"`
IsoImageFileUrl string `yaml:"isoImageFileUrl"`
}
func (*PxeSavedConfigs) IsValid ¶
func (p *PxeSavedConfigs) IsValid() error
type SavedConfigs ¶
type SavedConfigs struct {
Iso IsoSavedConfigs `yaml:"iso"`
Pxe PxeSavedConfigs `yaml:"pxe"`
OS OSSavedConfigs `yaml:"os"`
}
func (*SavedConfigs) IsValid ¶
func (c *SavedConfigs) IsValid() (err error)
Source Files
¶
- bootcustomizer.go
- checkfilesystem.go
- createuuid.go
- customizebootloader.go
- customizefiles.go
- customizehostname.go
- customizeos.go
- customizeoverlays.go
- customizepackages.go
- customizepartitions.go
- customizepartitionsfilecopy.go
- customizepartitionsuuids.go
- customizeselinux.go
- customizeservices.go
- customizeusers.go
- customizeverity.go
- defaultgrubutils.go
- dracututils.go
- extractpartitions.go
- grubcfgutils.go
- imageConnection.go
- imagecustomizer.go
- imageutils.go
- installedkernelcheck.go
- kernelmoduleutils.go
- liveosisobuilder.go
- partitionutils.go
- releasefile.go
- resolvconf.go
- rpmsourcesmounts.go
- runscripts.go
- savedconfigs.go
- shrinkfilesystems.go
- typeConversion.go
- versionsOfToolDependencies.go