Skip to content

Skywalkr-dev/lfs-pkg-mgr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lpkg — Package Manager for Linux From Scratch

A simple, source-based package manager written in C, designed for LFS systems. It handles the full lifecycle of a package: build, install, track, and remove.


Features

  • Install packages from source tarballs using custom build scripts
  • Tracks every file installed by a package
  • Clean removal — deletes all owned files and prunes empty directories
  • Package metadata database at /var/lib/lpkg/
  • Query commands: list, info, files, search
  • Man page included

Building lpkg

make
sudo make install        # installs to /usr/local/bin by default
sudo make install PREFIX=/usr   # or wherever you prefer

Debug build:

make DEBUG=1

Usage

Install a package

sudo lpkg install curl 8.7.1 curl-8.7.1.tar.gz scripts/autotools.sh "HTTP client"

The build script runs inside the extracted source tree with bash. Three ready-made templates are in scripts/:

Script Build system
scripts/autotools.sh ./configure && make
scripts/cmake.sh CMake
scripts/meson.sh Meson + Ninja

Remove a package

sudo lpkg remove curl

Asks for confirmation, then deletes every tracked file.

List installed packages

lpkg list

Show package details

lpkg info curl

Show owned files

lpkg files curl

Search packages

lpkg search http

Database Layout

/var/lib/lpkg/
└── curl/
    ├── info       ← name, version, description, installed date
    └── files      ← one absolute file path per line

How File Tracking Works

Before extracting the tarball, lpkg creates a timestamp file. After the build script completes, it runs:

find / -newer <stamp> -not -path '/proc/*' ... -type f

Every file newer than the stamp is recorded as owned by the package. This works well for sequential LFS builds where you're the only one writing to the system during installation.


Notes

  • Must be run as root for packages that install into system directories.
  • No dependency resolution — consistent with the LFS philosophy of manual, ordered builds.
  • The remove command will skip files that are already missing (e.g. if you deleted them manually) and warn about files it couldn't remove.

About

A minimal package manager written in C for Linux, built from scratch with no dependencies.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors