1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
# 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.ini # Metadata
-> _install.tar.zst # This will be extracted to /
-> post-install # Optional, runs after install
-> pre-remove # Optional, runs before remove
```
#### pkg.ini
```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.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]
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
```ini
name = core
desc = Core repo for Yerba Linux
url = https://yerba.arslaancodes.com/repo/core
packages = pkgname pkgname2 (...)
```
#### pkg/pkgname.ini
```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 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
|