Documentation
¶
Index ¶
- Constants
- Variables
- func CopyFile(dst string, src string) error
- func ExtractTar(cfg *TarCfg, fp string) error
- func FileLockPath(dir string, f string) string
- func FileSize(fp string) (int64, error)
- func FilterTar(r TarReader, filters ...TarFilter) error
- func GetFullPackageName(root string, name string) (string, bool, error)
- func GetPackageSoftLinks(root string, pkg string) ([]string, error)
- func GetUncompressedSize(fp string) (int64, error)
- func HumanReadableSize(size int64) string
- func InstallPkg(flags *InstallPkgFlags, pkgs ...string) error
- func IsDir(path string) (bool, error)
- func IsExist(path string) (bool, error)
- func IsFile(path string) (bool, error)
- func IsParentDir(parent, sub string) (bool, error)
- func IsSlackwarePkg(fp string) bool
- func IsSymlink(path string) (bool, error)
- func ListPackages(root string) ([]string, error)
- func NewCompressedFileReader(r io.Reader, format PackageType) (io.Reader, error)
- func PackageBase(fp string) string
- func PackageName(fp string) (string, error)
- func ParsePackageSoftLinks(str string) ([]string, error)
- func ReadPackageSoftLinks(path string) ([]string, error)
- func RemovePkg(flags *RemovePkgFlags, pkgNames ...string) error
- func TargetPackageInfoPath(root string, pkg string) string
- func TargetPackagePath(root string, pkg string) string
- func TargetRemovedPackagePath(root string, pkg string) string
- func TargetRemovedUninstalllScriptPath(root string, pkg string) string
- func TargetScriptPath(root string, pkg string) string
- func TargetTmpDir(root string) string
- type Encoder
- type InstallPkgFlags
- type PackageFormatKey
- type PackageInfo
- type PackageType
- type RemovePkgFlags
- type SlackwarePkg
- type TarCfg
- type TarExtracter
- type TarFilter
- type TarFilterFunc
- type TarReader
Constants ¶
View Source
const ( PriorityNone = "" PriorityAdditional = "ADD" PriorityRecommended = "REC" PriorityOptional = "OPT" PrioritySkip = "SKP" )
View Source
const ( // InstallLockDir is used to prevent install script collisions. InstallLockDir = "/run/lock/pkgtools" // PackageInstallPath is the place for special package files. PackageInstallPath = "install" PackageInstallScript = "install/doinst.sh" PackageUninstallScript = "install/douinst.sh" PackageSlackDescFile = "install/slack-desc" InstalledScriptPath = "var/lib/pkgtools/scripts" InstalledPackagePath = "var/lib/pkgtools/packages" // ADMDir is the package database directories (packages, scripts). ADMDir = "var/lib/pkgtools" // Is the removed packages/scripts log files. TmpDir = "var/lib/pkgtools/setup/tmp" LogDir = "var/log/pkgtools" InstalledRemovedPackagePath = "var/log/pkgtools/removed_packages" InstalledRemovedScriptsPath = "var/log/pkgtools/removed_scripts" InstalledRemovedUninstallScriptPath = "var/log/pkgtools/removed_uninstall_scripts" )
View Source
const ( UnsupportedPackageFormat = "unsupported package format" TGZ = "tgz" TBZ = "tbz" TLZ = "tlz" TXZ = "txz" )
View Source
const ADMDirPerms = 0755
View Source
const DefaultPerms = 0755
View Source
const DefaultTerseLength = 80
DefaultTerseLength is the default line length during terse mode.
View Source
const ExitStatusCorruptCompression = 2
ExitStatusCorruptCompression is when corrupt compression envelope.
View Source
const ExitStatusIncorrectExt = 3
ExitStatusIncorrectExt is when does not end in .tgz.
View Source
const ExitStatusMissingCompressionUtility = 5
ExitStatusMissingCompressionUtility is when external compression utility. missing
View Source
const ExitStatusNoSuchFile = 4
ExitStatusNoSuchFile is when no such file.
View Source
const ExitStatusTarError = 1
ExitStatusTarError is when tar returned error code.
View Source
const ExitStatusUserAbortFromMenu = 99
ExitStatusUserAbortFromMenu is when user abort from menu mode.
View Source
const LogDirPerms = 0755
View Source
const NewDirMod = 0755
View Source
const TmpDirPerms = 0700
View Source
const UninstallScript = "var/lib/pkgtools/douinst.sh"
Variables ¶
View Source
var DefaultInstallPkgFlags = InstallPkgFlags{ Ask: false, InfoBox: false, LockDir: InstallLockDir, MD5Sum: false, Menu: false, NoOverwrite: false, Priority: PriorityNone, Root: "/", TagFile: "", Terse: false, TerseLength: DefaultTerseLength, Warn: false, Strict: true, // contains filtered or unexported fields }
View Source
var DefaultRemovePkgFlags = RemovePkgFlags{ LockDir: InstallLockDir, Root: "/", }
Functions ¶
func GetFullPackageName ¶
func InstallPkg ¶
func InstallPkg(flags *InstallPkgFlags, pkgs ...string) error
func NewCompressedFileReader ¶
func PackageBase ¶
PackageBase is the package's filename without the (supported) extension.
func RemovePkg ¶
func RemovePkg( flags *RemovePkgFlags, pkgNames ...string, ) error
func TargetRemovedUninstalllScriptPath ¶
Types ¶
type Encoder ¶
type Encoder struct { MD5Sum bool // contains filtered or unexported fields }
func (*Encoder) Encode ¶
func (s *Encoder) Encode(pkg *PackageInfo) error
type InstallPkgFlags ¶
type InstallPkgFlags struct { Ask bool InfoBox bool LockDir string MD5Sum bool Menu bool NoOverwrite bool Priority string Root string TagFile string Terse bool TerseLength int Warn bool Strict bool // contains filtered or unexported fields }
func (*InstallPkgFlags) SetEnvValues ¶
func (s *InstallPkgFlags) SetEnvValues()
type PackageInfo ¶
type PackageInfo struct { Name string // TODO: Should be size CompressedPackageSize string UncompressedPackageSize string PackageLocation string PackageDescription string MD5Sum string FileList []string }
func GetPackageInfo ¶
func GetPackageInfo(root string, pkgName string) (*PackageInfo, error)
Use package name or package base for name
func ParsePackageInfo ¶
func ParsePackageInfo(text string) (*PackageInfo, error)
func ReadPackageInfo ¶
func ReadPackageInfo(fp string) (*PackageInfo, error)
type RemovePkgFlags ¶
func (*RemovePkgFlags) SetEnvValues ¶
func (s *RemovePkgFlags) SetEnvValues()
type SlackwarePkg ¶
type SlackwarePkg struct { Format PackageType // contains filtered or unexported fields }
func OpenSlackwarePkg ¶
func OpenSlackwarePkg(fp string) (*SlackwarePkg, error)
func (*SlackwarePkg) Close ¶
func (s *SlackwarePkg) Close() error
func (*SlackwarePkg) Next ¶
func (s *SlackwarePkg) Next() (*tar.Header, error)
func (*SlackwarePkg) PkgInfo ¶
func (s *SlackwarePkg) PkgInfo() *PackageInfo
func (*SlackwarePkg) Read ¶
func (s *SlackwarePkg) Read(b []byte) (int, error)
type TarCfg ¶
type TarExtracter ¶
type TarExtracter struct {
// contains filtered or unexported fields
}
func NewTarExtractor ¶
func NewTarExtractor(cfg *TarCfg) *TarExtracter
type TarFilterFunc ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.