mbpk
Minimal Binary Package Kit
What is mbpk?
mbpk is a dead-simple binary package manager, primarily developed for Yerba Linux.
Core functions are handled in libmbpk, whereas the commands themselves are simply wrappers around the library.
Package Format
A package is a .tar.zst archive with the file extension .mpk.
Structure
pkgname-1.2.3.mpk
-> pkg.ini # Metadata
-> _install.tar.zst # This will be extracted to /
-> post-install # Optional, runs after install
-> pre-remove # Optional, runs before remove
pkg.ini
name = pkgname
version = 1.2.3
desc = testing testing 123, i like chicken nuggets, not 3
deps = dep1 dep2 dep
maintainer = French Hacker <[email protected]>
license = WTFPL
Scripts
post-install: Runs after_install.tar.zstis extractedpre-remove: Runs before files are removed
If they don't exist, mbpk simply ignores them.
If they do exist, they are executed at their respective times.
Failure to execute these scripts will be ignored and the package manager will continue, warning the user.
Repositories
Repository configuration is stored in /etc/mbpk-repos.ini.
Configuration format is as follows:
# Example repository configuration for mbpk
# Format: name = url
[core]
url = https://yerba.arslaancodes.com/repo/core
[extra]
url = https://yerba.arslaancodes.com/repo/extra
Repos will be synchronized by copying them into /var/lib/mbpk-repo/.
For example, the repos from the previous configuration example would be at the following locations:
- /var/lib/mbpk-repo/core
- /var/lib/mbpk-repo/extra
Structure
Repository structure is as follows:
core/ # Example repository name
-> repo.ini # Repository metadata
-> pkg/
-> pkgname.ini # Package metadata
-> pkgname2.ini # More package metadata
-> files/
-> pkgname-1.2.3.mpk # Example package file
repo.ini
name = core
desc = Core repo for Yerba Linux
url = https://yerba.arslaancodes.com/repo/core
packages = pkgname pkgname2 (...)
pkg/pkgname.ini
name = pkgname
version = 1.2.3
desc = testing testing 123, i like chicken nuggets, not 3
url = https://yerba.arslaancodes.com/repo/core/files/pkgname-1.2.3.mpk
deps = dep1 dep2 dep3
maintainer = French Hacker <[email protected]>
license = WTFPL
Database & Package Installation/Removal
The database is dead-simple.
Upon installing a package, the .mpk file will first be extracted to /var/lib/mbpk/<package-name>. From there, the package manager will continue to extract _install.tar.zst to /.
This installation flow ensures that the package database is automatically handled, because /var/lib/mbpk itself acts as a database of all packages.
Removal of a package is simple:
- Read package metadata from the database
- Check for pre-remove, and run if it exists
- Use libarchive to list all files in _install.tar.zst and remove them respectively
Usage
mbpk is not one standalone command-line tool, it is actually a combination of many binaries wrapping the libmbpk library.
mbpk-install <pkgname>: installs a package from a repositorymbpk-install-local <pkgname>: installs a local package filembpk-remove <pkgname>: removes a packagembpk-list: lists all installed packagesmbpk-update: updates package repositoriesmbpk-upgrade <pkgname>: upgrades the specified packagembpk-search <term>: searches repositories for a specified termmbpk-info <pkgname>: shows metadata of a requested installed package
