Documentation ¶
Index ¶
- Constants
- func BuildEmptyDataVolume(size MegaBytes) (string, error)
- func BuildRawDataImage(dataTar io.ReadCloser, size MegaBytes, usePartitionTables bool) (string, error)
- func Compress(source, destination string) error
- func CopyDir(source string, dest string) (err error)
- func CopyFile(src, dst string) error
- func CopyToImgFile(folder, imgfile string) error
- func CreateBootImageOnFile(rootFile string, sizeOfFile DiskSize, progPath, commandline string) error
- func CreateBootImageWithSize(rootFile string, size DiskSize, progPath, commandline string) error
- func CreateSingleVolume(rootFile string, folder unikutil.RawVolume) error
- func CreateVolumes(imgFile string, volumes []unikutil.RawVolume, ...) error
- func ExtractTar(tarArchive io.ReadCloser, localFolder string) error
- func GetDirSize(dir string) (int64, error)
- func IsExists(f string) bool
- func Mount(device BlockDevice) (mntpoint string, err error)
- func PrepareGrub(folder, rootDeviceName, kernel, commandline string) error
- func RunLogCommand(name string, args ...string) error
- func Umount(point string) error
- type BlockDevice
- type Bytes
- type DeviceMapperDevice
- type DiskLabelPartioner
- type DiskSize
- type GigaBytes
- type LoDevice
- type MegaBytes
- type MsDosPartioner
- type Part
- type PartedPart
- type Partitioner
- type Resource
- type Sectors
Constants ¶
View Source
const DeviceMapFile = `(hd0) {{.GrubDevice}}
`
View Source
const GrubTemplate = `default=0
fallback=1
timeout=1
hiddenmenu
title Unik
root {{.RootDrive}}
kernel /boot/program.bin {{.CommandLine}}
`
View Source
const ProgramName = "program.bin"
View Source
const SectorSize = 512
Variables ¶
This section is empty.
Functions ¶
func BuildEmptyDataVolume ¶
func BuildRawDataImage ¶
func CopyFile ¶
CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.
func CopyToImgFile ¶
func CreateBootImageOnFile ¶
func CreateBootImageWithSize ¶
func CreateVolumes ¶
func ExtractTar ¶
func ExtractTar(tarArchive io.ReadCloser, localFolder string) error
func GetDirSize ¶
func Mount ¶
func Mount(device BlockDevice) (mntpoint string, err error)
func PrepareGrub ¶
func RunLogCommand ¶
Types ¶
type BlockDevice ¶
type BlockDevice string
func (BlockDevice) Name ¶
func (b BlockDevice) Name() string
type DeviceMapperDevice ¶
type DeviceMapperDevice struct { DeviceName string // contains filtered or unexported fields }
func (*DeviceMapperDevice) Acquire ¶
func (p *DeviceMapperDevice) Acquire() (BlockDevice, error)
func (*DeviceMapperDevice) Get ¶
func (p *DeviceMapperDevice) Get() BlockDevice
func (*DeviceMapperDevice) Offset ¶
func (p *DeviceMapperDevice) Offset() DiskSize
func (*DeviceMapperDevice) Release ¶
func (p *DeviceMapperDevice) Release() error
func (*DeviceMapperDevice) Size ¶
func (p *DeviceMapperDevice) Size() DiskSize
type DiskLabelPartioner ¶
type DiskLabelPartioner struct {
Device string
}
func (*DiskLabelPartioner) MakePart ¶
func (m *DiskLabelPartioner) MakePart(partType string, start, size DiskSize) error
func (*DiskLabelPartioner) MakeTable ¶
func (m *DiskLabelPartioner) MakeTable() error
type LoDevice ¶
type LoDevice struct {
// contains filtered or unexported fields
}
TODO: change this to api; like in here: https://www.versioneye.com/python/losetup/2.0.7 or here https://github.com/karelzak/util-linux/blob/master/sys-utils/losetup.c
func (*LoDevice) Acquire ¶
func (p *LoDevice) Acquire() (BlockDevice, error)
type MsDosPartioner ¶
type MsDosPartioner struct {
Device string
}
func (*MsDosPartioner) MakePart ¶
func (m *MsDosPartioner) MakePart(partType string, start, size DiskSize) error
func (*MsDosPartioner) MakePartTillEnd ¶
func (m *MsDosPartioner) MakePartTillEnd(partType string, start DiskSize) error
func (*MsDosPartioner) MakeTable ¶
func (m *MsDosPartioner) MakeTable() error
type Part ¶
type Part interface { Resource Size() DiskSize Offset() DiskSize Get() BlockDevice }
func ListParts ¶
func ListParts(device BlockDevice) ([]Part, error)
func NewDMPartedPart ¶
func NewDMPartedPart(start, size Sectors, device BlockDevice, partNum int64) Part
Device device name is generated, user can chagne it..
type PartedPart ¶
type PartedPart struct { Device BlockDevice // contains filtered or unexported fields }
func (*PartedPart) Acquire ¶
func (p *PartedPart) Acquire() (BlockDevice, error)
func (*PartedPart) Get ¶
func (p *PartedPart) Get() BlockDevice
func (*PartedPart) Offset ¶
func (p *PartedPart) Offset() DiskSize
func (*PartedPart) Release ¶
func (p *PartedPart) Release() error
func (*PartedPart) Size ¶
func (p *PartedPart) Size() DiskSize
type Partitioner ¶
type Resource ¶
type Resource interface { Acquire() (BlockDevice, error) Release() error }
func NewDevice ¶
func NewDevice(start, size Sectors, origDevice BlockDevice, deivceName string) Resource
func NewLoDevice ¶
Click to show internal directories.
Click to hide internal directories.