Documentation
¶
Index ¶
- func DetectCompression(path string) string
- func DetectImageSource(ref string) (types.ImageSource, error)
- func DownloadToFile(ctx context.Context, url, destPath string, onProgress ProgressFunc) error
- func FindInitrdPath(mountPoint string) string
- func FindKernelPath(mountPoint string) string
- func OpenDecompressed(path string) (io.ReadCloser, int64, error)
- type ContainerSource
- func (s *ContainerSource) Close() error
- func (s *ContainerSource) GetBootAssets() (*types.BootAssets, error)
- func (s *ContainerSource) GetInstallAssets(tmpDir string, _ uint64) (*types.InstallAssets, error)
- func (s *ContainerSource) Reference() string
- func (s *ContainerSource) Type() types.ImageSourceType
- type HTTPSource
- type ISOSource
- type ProgressFunc
- type RAWSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectCompression ¶
DetectCompression returns the compression type based on file extension.
func DetectImageSource ¶
func DetectImageSource(ref string) (types.ImageSource, error)
DetectImageSource detects the image type and returns an appropriate ImageSource.
func DownloadToFile ¶
func DownloadToFile(ctx context.Context, url, destPath string, onProgress ProgressFunc) error
DownloadToFile downloads a URL to a local file with optional progress reporting.
func FindInitrdPath ¶
FindInitrdPath searches for initrd in common locations.
func FindKernelPath ¶
FindKernelPath searches for kernel in common locations.
func OpenDecompressed ¶
func OpenDecompressed(path string) (io.ReadCloser, int64, error)
OpenDecompressed opens a file and returns a decompressed reader. Returns the reader, uncompressed size (-1 if unknown), and error.
Types ¶
type ContainerSource ¶
type ContainerSource struct {
// contains filtered or unexported fields
}
ContainerSource implements ImageSource for container registry images.
func NewContainerSource ¶
func NewContainerSource(ref string) *ContainerSource
NewContainerSource creates a new ContainerSource.
func (*ContainerSource) Close ¶
func (s *ContainerSource) Close() error
func (*ContainerSource) GetBootAssets ¶
func (s *ContainerSource) GetBootAssets() (*types.BootAssets, error)
GetBootAssets extracts kernel and initrd from UKI in container image.
func (*ContainerSource) GetInstallAssets ¶
func (s *ContainerSource) GetInstallAssets(tmpDir string, _ uint64) (*types.InstallAssets, error)
GetInstallAssets extracts the full rootfs for chroot installation.
func (*ContainerSource) Reference ¶
func (s *ContainerSource) Reference() string
func (*ContainerSource) Type ¶
func (s *ContainerSource) Type() types.ImageSourceType
type HTTPSource ¶
type HTTPSource struct {
// contains filtered or unexported fields
}
HTTPSource wraps a remote image that needs to be downloaded first.
func NewHTTPSource ¶
func NewHTTPSource(url string, targetType types.ImageSourceType) *HTTPSource
NewHTTPSource creates a new HTTPSource for downloading remote images.
func (*HTTPSource) Close ¶
func (s *HTTPSource) Close() error
func (*HTTPSource) GetBootAssets ¶
func (s *HTTPSource) GetBootAssets() (*types.BootAssets, error)
GetBootAssets downloads the image and delegates to appropriate source.
func (*HTTPSource) GetInstallAssets ¶
func (s *HTTPSource) GetInstallAssets(tmpDir string, sizeGiB uint64) (*types.InstallAssets, error)
GetInstallAssets downloads the image and delegates to appropriate source.
func (*HTTPSource) Reference ¶
func (s *HTTPSource) Reference() string
func (*HTTPSource) Type ¶
func (s *HTTPSource) Type() types.ImageSourceType
type ISOSource ¶
type ISOSource struct {
// contains filtered or unexported fields
}
ISOSource implements ImageSource for ISO files.
func (*ISOSource) GetBootAssets ¶
func (s *ISOSource) GetBootAssets() (*types.BootAssets, error)
GetBootAssets extracts kernel and initrd from ISO.
func (*ISOSource) GetInstallAssets ¶
GetInstallAssets extracts the rootfs from ISO for chroot installation.
func (*ISOSource) Type ¶
func (s *ISOSource) Type() types.ImageSourceType
type ProgressFunc ¶
type ProgressFunc func(current, total int64)
ProgressFunc is called during download to report progress.
type RAWSource ¶
type RAWSource struct {
// contains filtered or unexported fields
}
RAWSource implements ImageSource for RAW disk images.
func (*RAWSource) GetBootAssets ¶
func (s *RAWSource) GetBootAssets() (*types.BootAssets, error)
GetBootAssets extracts kernel and initrd from UKI in RAW image.
func (*RAWSource) GetInstallAssets ¶
GetInstallAssets returns the RAW image for direct writing to disk.
func (*RAWSource) Type ¶
func (s *RAWSource) Type() types.ImageSourceType