2024-06-14

pack

compound, compress and encrypt files with tar, xz and scrypt

to create packages from files easily

license

gpl3+

usage examples

create an automatically named package from multiple source files

pack /tmp/1 /tmp/2

creates file "1.tar"

create an explicity named package from multiple source files

pack -t 3.tar /tmp/1 /tmp/2

creates file "3.tar"

create an encrypted package

pack -e 1 2

creates file "1.tar.e"

create a compressed and encrypted package

pack -ec 1 2

creates file "1.tar.xz.e"

completely extract a package into the current working directory

pack -u 1.tar.xz

only decompress into the current working directory

pack -uc 1.tar.xz

creates file "1.tar"

completely extract a package into a target directory

pack -ut /tmp 1.tar.xz

compress a single file

pack 1

creates 1.xz. tar is not used because it is only one file

pack a list of paths read from standard input

pack -p --

creates a tar archive with every file from a newline separated list read from standard-input

general

  • two modes: pack and unpack
  • command-line interface and library
  • uses stream processing and multiple processes
  • when unpacking, multiple given source paths are unpacked in series

format layers

  • designated by filename suffixes
  • layer-name and filename-suffix: encryption e compression xz compound tar
  • there is a layer order that is adhered to (tar/xz/scrypt, for example the order xz/scrypt/tar is unsupported)

command-line interface

$ pack --help

parameters
  options ... source-path ...
description
  one program for file and directory compounding, compression and encryption
options
  --about|-a
  --compression|-c
  --delete-input-files|-d
  --dry-run
  --encryption|-e
  --help|-h
  --implicit-compression|-i [number]  add compression if source is below a certain size. the optional value is in megabits.
  --interface
  --read-paths|-p string
  --target|-t string
  --unpack|-u

dependencies

setup

  • download from releases or clone from git://git.sph.mn/sph-pack
  • extract the downloaded archive
  • link or copy the file exe/pack into a directory which is in the environment variable $PATH
  • link or copy the files modules/* into a directory which is in the environment variable $GUILE_LOAD_PATH or any other guile load path

behaviour in detail

  • source: given source file paths or other source
  • layers: layers requested (compression, compounding, encryption) for processing

1

  • source: path ...
  • layers: layer-already-indicated-in-path ...
  • skip-indicated-layers

2

  • unpack: true
  • source: standard-input
  • layers: compound
  • not-supported

3

  • unpack: true
  • source: standard-input
  • layers: compression
  • target: false/directory
  • standard-output

4

  • unpack: true
  • source: paths
  • target: false
  • target: current-working-directory

5

  • unpack: true
  • layers: false
  • unpack-all-found-layers

6

  • unpack: true
  • source: paths-with-and-without-compression
  • layer-compression: true
  • remove-compression-from-paths-with-compression
  • target: only-move-processed-files

7

  • source: standard-input/paths
  • target: "--"
  • target: standard-output

8

  • source: standard-input
  • target: false
  • target: standard-output

9

  • source: paths
  • target: false
  • target: source-filename->target

10

  • source: paths
  • layer-compound: true

11

  • source: directory-path
  • layer-compound: true

12

  • source: path
  • layers: compound
  • do-nothing

13

  • layers: false
  • layers: compression