Creating System Installers
This guide shows how to create a custom system installer package. System installers allow aux4 to install system-level dependencies using package managers that aren't included by default.
What is a System Installer?
A system installer is an aux4 package that provides install and uninstall commands for a specific package manager. When another package declares a system dependency using that package manager, aux4 uses your system installer to install it.
For example, the aux4/system-installer-brew package enables the brew: prefix in system dependencies.
Package Structure
1system-installer-mypm/
2├── .aux4
3├── LICENSE
4└── README.mdStep 1: Create the .aux4 File
System installers must:
- Include system-installer in the tags array
- Depend on aux4/pkger
- Implement the aux4:pkger:system profile with your package manager name
- Provide install and uninstall commands
1{
2 "scope": "myorg",
3 "name": "system-installer-mypm",
4 "description": "aux4 system installer for MyPM package manager",
5 "version": "1.0.0",
6 "license": "MIT",
7 "dependencies": [
8 "aux4/pkger"
9 ],
10 "tags": [
11 "aux4",
12 "system-installer"
13 ],
14 "profiles": [
15 {
16 "name": "aux4:pkger:system",
17 "commands": [
18 {
19 "name": "mypm",
20 "execute": [
21 "profile:aux4:pkger:system:mypm"
22 ],
23 "help": {
24 "text": "Manage MyPM packages"
25 }
26 }
27 ]
28 },
29 {
30 "name": "aux4:pkger:system:mypm",
31 "commands": [
32 {
33 "name": "install",
34 "execute": [
35 "mypm install ${package}"
36 ],
37 "help": {
38 "text": "Install a MyPM package",
39 "variables": [
40 {
41 "name": "package",
42 "text": "Package name",
43 "arg": true
44 }
45 ]
46 }
47 },
48 {
49 "name": "uninstall",
50 "execute": [
51 "mypm uninstall ${package}"
52 ],
53 "help": {
54 "text": "Uninstall a MyPM package",
55 "variables": [
56 {
57 "name": "package",
58 "text": "Package name",
59 "arg": true
60 }
61 ]
62 }
63 }
64 ]
65 }
66 ]
67}Profile Naming Convention
The profile names must follow this convention:
- Entry profile: aux4:pkger:system
- Command name: Your package manager identifier (e.g., mypm)
- Implementation profile: aux4:pkger:system:<identifier> (e.g., aux4:pkger:system:mypm)
Step 2: Create Supporting Files
LICENSE
1cat > LICENSE << 'EOF'
2MIT License
3...
4EOFREADME.md
1cat > README.md << 'EOF'
2# System Installer for MyPM
3
4Enables aux4 packages to declare MyPM dependencies.
5
6## Usage
7
8After installing this package, other packages can use:
9
10```json
11{
12 "system": [
13 [
14 "test:mytool --version",
15 "mypm:mytool"
16 ]
17 ]
18}
19```
20EOFStep 3: Build and Publish
1aux4 aux4 pkger build ./out .
2aux4 aux4 login
3aux4 aux4 pkger publish ./out/myorg_system-installer-mypm_1.0.0.zipStep 4: Use in Other Packages
Once your system installer is published, other packages can use it:
1{
2 "scope": "myorg",
3 "name": "my-tool",
4 "version": "1.0.0",
5 "license": "MIT",
6 "system": [
7 [
8 "test:sometool --version",
9 "mypm:sometool"
10 ]
11 ],
12 "profiles": [...]
13}When myorg/my-tool is installed:
- aux4 sees the mypm:sometool dependency
- aux4 installs myorg/system-installer-mypm if not already installed
- aux4 runs the test command sometool --version
- If the test fails, aux4 runs aux4 aux4:pkger:system mypm install sometool
Real-World Examples
Homebrew (brew)
1{
2 "name": "aux4:pkger:system:brew",
3 "commands": [
4 {
5 "name": "install",
6 "execute": [
7 "brew install ${package}"
8 ],
9 "help": {
10 "text": "Install brew package",
11 "variables": [
12 {
13 "name": "package",
14 "text": "Package name",
15 "arg": true
16 }
17 ]
18 }
19 },
20 {
21 "name": "uninstall",
22 "execute": [
23 "brew uninstall ${package}"
24 ],
25 "help": {
26 "text": "Uninstall brew package",
27 "variables": [
28 {
29 "name": "package",
30 "text": "Package name",
31 "arg": true
32 }
33 ]
34 }
35 }
36 ]
37}APT (Debian/Ubuntu)
1{
2 "name": "aux4:pkger:system:apt",
3 "commands": [
4 {
5 "name": "install",
6 "execute": [
7 "apt-get install -y ${package}"
8 ],
9 "help": {
10 "text": "Install apt package",
11 "variables": [
12 {
13 "name": "package",
14 "text": "Package name",
15 "arg": true
16 }
17 ]
18 }
19 },
20 {
21 "name": "uninstall",
22 "execute": [
23 "apt-get remove -y ${package}"
24 ],
25 "help": {
26 "text": "Uninstall apt package",
27 "variables": [
28 {
29 "name": "package",
30 "text": "Package name",
31 "arg": true
32 }
33 ]
34 }
35 }
36 ]
37}npm (Global packages)
1{
2 "name": "aux4:pkger:system:npm",
3 "commands": [
4 {
5 "name": "install",
6 "execute": [
7 "npm install -g ${package}"
8 ],
9 "help": {
10 "text": "Install npm package globally",
11 "variables": [
12 {
13 "name": "package",
14 "text": "Package name",
15 "arg": true
16 }
17 ]
18 }
19 },
20 {
21 "name": "uninstall",
22 "execute": [
23 "npm uninstall -g ${package}"
24 ],
25 "help": {
26 "text": "Uninstall npm package globally",
27 "variables": [
28 {
29 "name": "package",
30 "text": "Package name",
31 "arg": true
32 }
33 ]
34 }
35 }
36 ]
37}Available System Installers
| Package | Prefix | Package Manager |
|---|---|---|
| aux4/system-installer-brew | brew: | Homebrew (macOS) |
| aux4/system-installer-apt | apt: | APT (Debian/Ubuntu) |
| aux4/system-installer-dnf | dnf: | DNF (Fedora/RHEL) |
| aux4/system-installer-yum | yum: | YUM (CentOS/RHEL) |
| aux4/system-installer-apk | apk: | APK (Alpine Linux) |
| aux4/system-installer-npm | npm: | npm (Node.js) |
| aux4/system-installer-pkgx | pkgx: | pkgx |