rofs

package module
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 16 Imported by: 1

README

rofs

rofs is a go library for making readonly file archives available without requiring external tools or elevated privileges.

This library primarily concerns itself with removing the need to expand read-only archives when you do not actually need to modify anything in them -- the goal is to provide uniform access to such archives via the fs.FS interface.

Design Goals

  • Conform to all io/fs interfaces, including all the optional ones defined in that package along with the forthcoming ReadLinkFS interface
  • Provide an optimized io.WriterTo interface that is capable of proper sparse file handling where reasonable.
  • Allow the rofs/c.File interface to be passed in as the data source to rofs.Open. This will allow this library to be used to handle archives of archives.
  • Provide a generic low-effort way of creating an ROFS conformant archive.
  • Have reasonable symbolic link handling.

Filesystems

ISO9660

Filesystem images in ISO9660 are supported, along with RockRidge extensions including large sparse files. Joliet support may be added in a future release, but it is not a high priority.

The ISO9660 code is derived in large part from the excellent go-diskfs library by Avi Deitcher.

Squashfs

All compression variants of Squashfs are supported by default, with the exception of LZO due to GPL entanglements.

Squashfs code is derived from https://github.com/diskfs/go-diskfs/tree/master/filesystem/squashfs

Tar

Uncompressed tar files are supported, along with tar files compressed using seekable zstd.

Tar code is derived from the Go standard library archive/tar package, modified to remove all write capabilities and work with our standard FS and extent handling code.

Usage

Detailed Go documentation is available at pkg.go.dev.

Examples

There are runnable examples in the cmds/ directory. Here is one to get you started.

Tests

Standard unit tests are runnable via go test ./...

Plans

Future plans are to add the following:

  • Joliet extensions to iso9660
  • UDF filesystems for DVD handling.

Documentation

Overview

Package filesystem provides interfaces and constants required for filesystem implementations. All interesting implementations are in subpackages, e.g. gitlab.com/rackn/rofs/iso

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(src, target string) error

Create creates an archive that does not include the signature extended attributes.

func CreateSigned added in v0.5.1

func CreateSigned(src, target string, key ed25519.PrivateKey) error

CreateSigned creates a new ROFS archive at target from a directory hierarchy located at src. The individual files on the filesystem will have extended attributes added to them that cover the SHA256 of the file and an ed25519 signature of that SHA256sum if key is not nil. It currently creates a tar archive that is compressed using seekable zstd and organized to optimize compressability. In the future it may create a more highly optimized archive format such as a squashfs image.

func Open

func Open(file c.Src) (res fs.FS, err error)

Open attempts to open file as a read-only filesystem. It will attempt to try reading file as an ISO first, a tarfile second, and a squashfs file third. If no suitable filesystems are found, the final error is returned.

Types

This section is empty.

Directories

Path Synopsis
c
Package c provides common interfaces and functionality for all supported read-only filesystems.
Package c provides common interfaces and functionality for all supported read-only filesystems.
cmds
Package iso provides a common.Lookup interface to a pre-mastered ISO 9660 fs It understands basic ISO 9660 filesystems as well as ones with RockRidge extensions.
Package iso provides a common.Lookup interface to a pre-mastered ISO 9660 fs It understands basic ISO 9660 filesystems as well as ones with RockRidge extensions.
Package tar implements c.InodeProvider for uncompressed tarfiles.
Package tar implements c.InodeProvider for uncompressed tarfiles.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL