Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 30 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ jobs:
CHANGED="${{ steps.changed.outputs.packages }}"

# Get all noarch packages
all_noarch=$(for pkg in packages/*/APKBUILD; do
all_noarch=$(for pkg in packages/*/VELBUILD; do
if grep -q '^arch="noarch"' "$pkg"; then
basename $(dirname "$pkg")
fi
done)

# Get all multiarch packages
all_multiarch=$(for pkg in packages/*/APKBUILD; do
all_multiarch=$(for pkg in packages/*/VELBUILD; do
if grep -qE '^arch="(aarch64|armv7|aarch64 armv7)"' "$pkg"; then
basename $(dirname "$pkg")
fi
Expand Down Expand Up @@ -135,7 +135,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Lint APKBUILD files
- &install-vbuild
name: Install vbuild
run: |
set -e
curl \
--location \
'https://github.com/Eeems/vbuild/releases/download/0.0.11/vbuild-vbuild-ubuntu' \
--output /usr/local/bin/vbuild
chmod +x /usr/local/bin/vbuild

- name: Lint VELBUILD files
run: |
PACKAGES="${{ needs.setup.outputs.packages }}"
if [ "$PACKAGES" == "all" ] || [ -z "$PACKAGES" ]; then
Expand All @@ -158,7 +168,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up signing key
- *install-vbuild

- &set-up-signing-key
name: Set up signing key
run: |
if [ -n "${{ secrets.SIGNING_KEY }}" ]; then
echo "${{ secrets.SIGNING_KEY }}" > keys/packages.rsa
Expand All @@ -175,7 +188,7 @@ jobs:
docker run --rm \
-v "$PWD/dist:/dist:ro" \
-v "$PWD/keys:/keys:ro" \
alpine:edge \
ghcr.io/eeems/vbuild-builder:main \
sh -c "
cp /keys/packages.rsa.pub /etc/apk/keys/
for apk in /dist/*/*.apk; do
Expand All @@ -184,10 +197,11 @@ jobs:
done
"

- name: Get package name from APKBUILD
- &get-package-name
name: Get package name from VELBUILD
id: pkgname
run: |
pkgname=$(grep '^pkgname=' packages/${{ matrix.package }}/APKBUILD | cut -d= -f2)
pkgname=$(grep '^pkgname=' packages/${{ matrix.package }}/VELBUILD | cut -d= -f2)
echo "name=$pkgname" >> $GITHUB_OUTPUT

- name: Upload artifact
Expand All @@ -198,7 +212,8 @@ jobs:
path: dist/noarch/${{ steps.pkgname.outputs.name }}-*.apk
if-no-files-found: error

- name: Upload to S3
- &upload-to-s3
name: Upload to S3
if: github.repository == 'vellum-dev/vellum' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down Expand Up @@ -230,23 +245,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up signing key
run: |
if [ -n "${{ secrets.SIGNING_KEY }}" ]; then
echo "${{ secrets.SIGNING_KEY }}" > keys/packages.rsa
chmod 600 keys/packages.rsa
fi
- *install-vbuild

- *set-up-signing-key

- name: Build ${{ matrix.package }} for ${{ matrix.arch }}
run: ./scripts/build-package.sh "${{ matrix.package }}" "${{ matrix.arch }}"

- *verify-signature

- name: Get package name from APKBUILD
id: pkgname
run: |
pkgname=$(grep '^pkgname=' packages/${{ matrix.package }}/APKBUILD | cut -d= -f2)
echo "name=$pkgname" >> $GITHUB_OUTPUT
- *get-package-name

- name: Upload artifact
if: github.event_name == 'pull_request'
Expand All @@ -256,13 +264,7 @@ jobs:
path: dist/${{ matrix.arch }}/${{ steps.pkgname.outputs.name }}-*.apk
if-no-files-found: warn

- name: Upload to S3
if: github.repository == 'vellum-dev/vellum' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- *upload-to-s3

- name: Upload packages to S3
if: github.repository == 'vellum-dev/vellum' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
Expand Down Expand Up @@ -293,12 +295,7 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Set up signing key
run: |
if [ -n "${{ secrets.SIGNING_KEY }}" ]; then
echo "${{ secrets.SIGNING_KEY }}" > keys/packages.rsa
chmod 600 keys/packages.rsa
fi
- *set-up-signing-key

- name: Regenerate APKINDEX from S3
run: |
Expand Down Expand Up @@ -337,9 +334,8 @@ jobs:
-v "$PWD/s3-packages/$arch:/packages:Z" \
-v "$PWD/keys:/keys:ro" \
-w /packages \
alpine:edge \
ghcr.io/eeems/vbuild-builder:main \
sh -c "
apk add --no-cache apk-tools abuild
cp /keys/packages.rsa.pub /etc/apk/keys/
apk index --rewrite-arch $arch -o APKINDEX.tar.gz *.apk
abuild-sign -k /keys/packages.rsa APKINDEX.tar.gz
Expand Down Expand Up @@ -397,4 +393,3 @@ jobs:
git push origin main
echo "Changes committed and pushed to vellum-index"
fi

12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ keys/

# abuild output
packages/*/src/
# we now use VELBUILD
packages/*/APKBUILD
packages/*/*.pre-install
packages/*/*.post-install
packages/*/*.pre-upgrade
packages/*/*.post-upgrade
packages/*/*.pre-os-upgrade
packages/*/*.post-os-upgrade
packages/*/*.pre-deinstall
packages/*/*.post-deinstall
packages-metadata.json
tmp.json
110 changes: 63 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,28 @@ These packages are auto-installed on every `vellum` command and allows extension
### Adding a new package

1. Create a directory under `packages/` with the package name
2. Add an `APKBUILD` file following Alpine's format. See [APKBUILD Reference](https://wiki.alpinelinux.org/wiki/APKBUILD_Reference), [APKBUILD(5)](https://man.archlinux.org/man/APKBUILD.5.en), and [aports coding style](https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/CODINGSTYLE.md)
2. Add an `VELBUILD` file following Alpine's format. See [VELBUILD Reference](https://github.com/Eeems/vbuild?tab=readme-ov-file#velbuild-reference), and [aports coding style](https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/CODINGSTYLE.md)
3. Test it
4. Submit a PR

### APKBUILD template for QMD extensions
### VELBUILD template for QMD extensions

```sh
maintainer="Your Name <your@email.com>"
pkgname=myextension
pkgver=1.0.0
pkgrel=0
_upstream_author="your-github-username"
_category="ui"
upstream_author="your-github-username"
category="ui"
pkgdesc="Description of your extension"
url="https://github.com/you/repo"
arch="noarch"
license="SPDX License Identifier for your license"
depends="qt-resource-rebuilder remarkable-os>=3.24 remarkable-os<3.25"
_commit="1161639c9435372db1fb05024137407d20f6bb5e"
source="
https://raw.githubusercontent.com/you/repo/main/myextension.qmd
https://raw.githubusercontent.com/you/repo/main/LICENSE
https://raw.githubusercontent.com/you/repo/$_commit/myextension.qmd
https://raw.githubusercontent.com/you/repo/$_commit/LICENSE
"
options="!check !fhs"

Expand Down Expand Up @@ -110,7 +111,7 @@ Use semantic versioning (`MAJOR.MINOR.PATCH`) for `pkgver`:
- **MINOR**: new features, backward compatible
- **PATCH**: bug fixes (including updating a QMD for compatibility with a new reMarkable software release)

Use `pkgrel` for packaging changes that don't affect the upstream version (e.g., fixing the APKBUILD, changing dependencies). Reset `pkgrel` to `0` when bumping `pkgver`.
Use `pkgrel` for packaging changes that don't affect the upstream version (e.g., fixing the VELBUILD, changing dependencies). Reset `pkgrel` to `0` when bumping `pkgver`.

```sh
pkgver=1.2.0
Expand Down Expand Up @@ -147,18 +148,33 @@ mypackage-1.0.0 depends="!rm1 !rm2" # Compatible with Paper Pro and Move on

### Package Scripts

Packages can include lifecycle scripts. Add them to your package directory and reference in APKBUILD:
Packages can include lifecycle scripts. These are added as functions in the VELBUILD:

```sh
install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-deinstall"
postinstall(){
# Make changes
}

postupgrade(){
# Call postinstall
/home/root/.vellum/share/my-package/my-package.post-install
}

predeinstall(){
# Undo changes from postinstall
}

```

| Script | When it runs |
|-------------------|----------------------------------------------------|
| `post-install` | After fresh install |
| `post-upgrade` | After upgrading to a new version |
| `pre-deinstall` | Before package removal |
| `post-os-upgrade` | After reMarkable OS update (via `vellum reenable`) |
| `preinstall` | Before fresh install |
| `postinstall` | After fresh install |
| `preupgrade` | Before upgrading to a new version |
| `postupgrade` | After upgrading to a new version |
| `predeinstall` | Before package removal |
| `postdeinstall` | After package removal |
| `postosupgrade` | After reMarkable OS update (via `vellum reenable`) |

The `post-os-upgrade` hook runs when users execute `vellum reenable` after an OS update. Use this for packages that need to restore system files wiped by OS updates.
Unlike standard apk hooks, `post-os-upgrade` is a Vellum-specific hook and must be manually installed in your `package()` function:
Expand Down Expand Up @@ -188,46 +204,46 @@ It automatically detects if mount changes are required by the device.
Example for a package with a systemd service:

```sh
# mypackage.post-install
#!/bin/sh
/home/root/.vellum/bin/mount-rw
cp /home/root/.vellum/share/mypackage/mypackage.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now mypackage
/home/root/.vellum/bin/mount-restore

# mypackage.post-upgrade
#!/bin/sh
/home/root/.vellum/share/mypackage/mypackage.post-install

# mypackage.post-os-upgrade (mount-rw/mount-restore handled by vellum reenable)
#!/bin/sh
cp /home/root/.vellum/share/mypackage/mypackage.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now mypackage

# mypackage.pre-deinstall
#!/bin/sh
/home/root/.vellum/bin/mount-rw
systemctl disable --now mypackage 2>/dev/null || true
rm -f /etc/systemd/system/mypackage.service
systemctl daemon-reload
/home/root/.vellum/bin/mount-restore
postinstall(){
/home/root/.vellum/bin/mount-rw
cp /home/root/.vellum/share/mypackage/mypackage.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now mypackage
/home/root/.vellum/bin/mount-restore
}

postupgrade(){
/home/root/.vellum/share/mypackage/mypackage.post-install
}

postosupgrade(){
# mount-rw/mount-restore handled by vellum reenable
cp /home/root/.vellum/share/mypackage/mypackage.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now mypackage
}

predeinstall(){
/home/root/.vellum/bin/mount-rw
systemctl disable --now mypackage 2>/dev/null || true
rm -f /etc/systemd/system/mypackage.service
systemctl daemon-reload
/home/root/.vellum/bin/mount-restore
}
```

### Handling Purge

When users run `vellum purge` (vs `vellum del`), they expect all data to be removed. Vellum sets `VELLUM_PURGE=1` in the environment so your scripts can detect this:

```sh
# mypackage.pre-deinstall
#!/bin/sh

# Only remove user data on purge
if [ "$VELLUM_PURGE" = "1" ]; then
rm -rf /home/root/.config/mypackage
rm -rf /home/root/.local/share/mypackage
fi
predeinstall(){
# Only remove user data on purge
if [ "$VELLUM_PURGE" = "1" ]; then
rm -rf /home/root/.config/mypackage
rm -rf /home/root/.local/share/mypackage
fi
}
```

| Command | Behavior |
Expand Down Expand Up @@ -266,7 +282,7 @@ When you modify source URLs or update package versions:
# Build a single package
./scripts/build-package.sh mypackage aarch64

# Build a noarch package (auto-detected from APKBUILD)
# Build a noarch package (auto-detected from VELBUILD)
./scripts/build-package.sh mypackage
```
Built packages are output to `dist/<arch>/`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ maintainer="Mitchell Scott <mitchell@scottlabs.io>"
pkgname=add-finished-button
pkgver=1.0.1
pkgrel=0
_upstream_author="ingatellent"
_category="ui"
upstream_author="ingatellent"
category="ui"
pkgdesc="Adds a Finished button when selecting documents, moving them to the first subfolder in the current folder"
url="https://github.com/ingatellent/xovi-qmd-extensions"
arch="noarch"
Expand Down
10 changes: 7 additions & 3 deletions packages/appload/APKBUILD → packages/appload/VELBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ maintainer="Mitchell Scott <mitchell@scottlabs.io>"
pkgname=appload
pkgver=0.4.1
pkgrel=2
_upstream_author="asivery"
_category="framework"
upstream_author="asivery"
category="framework"
pkgdesc="Xovi extension for windowed and fullscreen apps on reMarkable tablets"
url="https://github.com/asivery/rm-appload"
arch="aarch64 armv7"
license="GPL-3.0"
depends="qt-resource-rebuilder remarkable-os>=3.22"
options="!check !fhs !strip !tracedeps"
install="$pkgname.post-deinstall"

source="
https://github.com/asivery/rm-appload/releases/download/v$pkgver/appload-aarch64.zip
Expand Down Expand Up @@ -40,6 +39,11 @@ package() {
echo "https://github.com/asivery/rm-appload/archive/v$pkgver.tar.gz" > \
"$pkgdir"/home/root/.vellum/licenses/$pkgname/SOURCES
}

postdeinstall(){
rmdir /home/root/shims 2>/dev/null || true
}

sha512sums="
aaa6a8a81eb68caab0f386e4c4b6c9db3840505d31c514989450a12e043593d43f5a06804a478b516175651f9ffb8a0e04132ea12c0f04e0a430c74dc987848c appload-aarch64.zip
fb30d4800d79a1bb6e820c9677c131e951dbf581074c97ad151ed27c001ff1e121c91a258f667e9500d8e75b33b12a17ede9ced7f634408465345d4207b4ebb1 appload-arm32.zip
Expand Down
3 changes: 0 additions & 3 deletions packages/appload/appload.post-deinstall

This file was deleted.

Loading