Documentation
¶
Overview ¶
Package pkg2go reads Linux package artifacts and the container archive formats they are built from as an io/fs.FS.
The subpackages implement individual formats: github.com/cpuguy83/pkg2go/ar for Unix ar archives (the outer container of a .deb) and github.com/cpuguy83/pkg2go/cpio for newc cpio archives (used by rpm payloads). NewFS sniffs the archive magic and dispatches to the right one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFS ¶
NewFS identifies the archive format of ra, which must contain exactly size bytes, and returns an io/fs.FS serving its contents. It recognizes ar, newc cpio, and tar archives by their magic and delegates to ar.NewFS, cpio.NewFS, or github.com/cpuguy83/tar2go respectively.
It returns an error if the format is not recognized. Compressed streams are not detected; decompress first and pass the resulting io.ReaderAt.
Types ¶
type Package ¶
type Package interface {
// Rootfs returns the files the package installs as an fs.FS rooted at the
// filesystem root.
Rootfs() (fs.FS, error)
// Close releases any temporary files created while reading the package.
Close() error
}
Package is an opened OS package whose installed files can be read as an io/fs.FS. Both *deb.Package and *rpm.Package satisfy it.
func OpenPackage ¶
OpenPackage identifies whether ra, which must contain exactly size bytes, is a Debian or RPM package by its magic and returns it as a Package. A .deb is recognized by its ar magic and read by deb.Open; a .rpm is recognized by its lead magic and read by rpm.Open.
It returns an error if the format is not recognized. The returned Package must be closed.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ar reads Unix "ar" archives and exposes their members as an io/fs.FS.
|
Package ar reads Unix "ar" archives and exposes their members as an io/fs.FS. |
|
cmd
|
|
|
mountpkg
command
Command mountpkg FUSE-mounts the root filesystem of a .deb or .rpm package.
|
Command mountpkg FUSE-mounts the root filesystem of a .deb or .rpm package. |
|
Package compress decompresses a package member into a random-access io.ReaderAt.
|
Package compress decompresses a package member into a random-access io.ReaderAt. |
|
Package cpio reads cpio archives and exposes their contents as an io/fs.FS.
|
Package cpio reads cpio archives and exposes their contents as an io/fs.FS. |
|
Package deb reads a Debian .deb package.
|
Package deb reads a Debian .deb package. |
|
Package rpm reads an RPM package.
|
Package rpm reads an RPM package. |