aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md121
1 files changed, 121 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5121644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,121 @@
+# mbpk
+
+**M**inimal **B**inary **P**ackage **K**it
+
+## What is mbpk?
+
+`mbpk` is a dead-simple binary package manager, primarily developed for [Yerba Linux](https://git.arslaancodes.com/yerbalinux.git/about).
+
+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.yml # Metadata
+-> _install.tar.zst # This will be extracted to /
+-> post-install # Optional, runs after install
+-> pre-remove # Optional, runs before remove
+```
+
+#### pkg.yml
+
+```yaml
+name: pkgname
+version: 1.2.3
+desc: testing testing 123, i like chicken nuggets, not 3
+deps:
+ - dep1
+ - dep2
+ - dep3
+maintainer: French Hacker <[email protected]>
+license: WTFPL
+```
+
+#### Scripts
+
+- `post-install`: Runs after `_install.tar.zst` is extracted
+- `pre-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:
+```ini
+# Example repository configuration for mbpk
+# Format: name = url
+
+core = https://repo.yerba.arslaancodes.com/core
+extra = https://repo.yerba.arslaancodes.com/extra
+```
+
+### Structure
+
+Repository structure is as follows:
+
+```
+core/ # Example repository name
+-> repo.yml # Repository metadata
+-> pkg/
+ -> pkg/pkgname.yml # Package metadata
+ -> pkg/pkgname2.yml # More package metadata
+-> files/
+ -> pkgname-1.2.3.mpk # Example package file
+```
+
+#### repo.yml
+
+```yaml
+name: core
+desc: Core repo for Yerba Linux
+```
+
+#### pkg/pkgname.yml
+
+```yaml
+name: pkgname
+version: 1.2.3
+desc: testing testing 123, i like chicken nuggets, not 3
+url: https://repo.yerba.arslaancodes.com/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 repository
+- `mbpk-install-local <pkgname>`: installs a local package file
+- `mbpk-remove <pkgname>`: removes a package
+- `mbpk-list`: lists all installed packages
+- `mbpk-update`: updates package repositories
+- `mbpk-upgrade <pkgname>`: upgrades the specified package
+- `mbpk-search <term>`: searches repositories for a specified term
+- `mbpk-info <pkgname>`: shows metadata of a requested installed package