Skip to content

lecram/minpkg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 

Repository files navigation

This is a minimal package manager implemented in a single shell script.

The local database of packages installed is maintained as plain text in /etc/pkg.

Packages are uncompressed *.tar files with the following structure:
  <name>-<version>.tar
    info.txt
    paths.txt
    files.tar.gz
      <package contents>
Tha actual files to be installed are compressed inside "files.tar.gz".
The file "info.txt" has colon-separated key-value pairs of metadata.
  Required keys are name, version, arch & size.
The file "paths.txt" is a list of filenames relative to the rootfs.
  Must be exactly the output of `tar tf files.tar.gz | grep -v '/$'`.
Path names in packages must not begin with a slash.
Path names in packages must not contain whitespaces.

Usage:
  minpkg [-r ROOT] COMMAND [ARGS]

Most commands need a ROOT argument that is the root path of the target file system.
For example, to manage packages on the current rootfs, use "/" as the ROOT argument.
The ROOT argument is searched in the following order:
  1. the -r command-line option;
  2. $MINPKG_ROOT environment variable;
  3. current working directory.

Commands:
  init
    initialize package management on ROOT
    this creates skeleton metadata structure on ROOT/etc/pkg
  list
    print the name (PKGID) of all packages installed on ROOT
    packages are listed in order of priority (lower first)
  add PKGFILE
    install package from PKGFILE (a *.tgz file) to ROOT
    the PKGID is inferred from PKGFILE (/path/to/foo.tgz -> foo)
  del PKGID
    uninstall package named PKGID from ROOT
  info PKGID
    show package metadata
  create ROOT
    create package from files in ROOT
  pack PKGID
    create tarball from installed package
  raise PKGID
    give all files from PKGID top priority on conflicts under ROOT
  from PATH
    print PKGID of the package effectively providing PATH on ROOT
  match PATH
    print PKGID of all packages providing PATH on ROOT
    packages are listed in order of priority (higher first)
  to PKGFILE
    print the path of each file in the package

Except for init, it's sufficient to type only the first letter of a command (r -> raise).

A conflict occurs when a new package installs a path that was already provided by another one.
In this situation, minpkg saves a backup of the old file before installing the new one.
If the newer package is uninstalled, the backup file will be restored to its original path.
The commands "from" & "raise" may be used to solve conflicts manually.

About

shell script to manage minimal packages

Topics

Resources

Stars

Watchers

Forks

Languages