Creating a Toltec Package#

Toltec packages are one of the best ways to distribute software for the device. They allow automatic dependency management, as well as automate the majority of the install and uninstall work. They can also be distributed outside of the toltec repository itself, either with a custom repository, or directly.

Toltecmk#

Toltecmk is a tool used to take a package recipe, and turn it into an ipk package file. It’s available in pypi and can be installed with pip.

$ pip install toltecmk

Toltecmk also requires docker to be installed, configured, and running on your system.

Example Package#

You can find more thorough documentation in the official toltec package guide.

Below is a very basic example package recipe. This will create a package that installs my-program to /opt/bin/my-program.

pkgname=my-package
pkgdesc="An example package"
url=https://example.com
pkgver=0.0.1-1
timestamp=2020-10-09T18:15Z
section=util
maintainer="My Name <me@example.com>"
license=MIT

image=toolchain:v3.1
source=(src.tar.gz)
sha256sums=(SKIP)

package() {
    install -D -m 755 -t "$pkgdir"/opt/bin \
      "$srcdir"/my-program
}

To build this package you will need to run the following command from the folder containing package and src.tar.gz:

$ toltecmk

Github Action#

The following example github action will compile a package and upload it as a build artifact to your repository:

on:
  push:
  pull_request:
jobs:
  build:
    name: Build and test package
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout the Git repository
        uses: actions/checkout@v4
      - name: Create source tarball
        run: tar -czvf src.tar.gz src
      - name: Build package
        uses: toltec-dev/build-action@v1
      - name: Test package
        uses: Eeems-Org/run-in-remarkable-action@v1
        with:
          setup: |
            set -ex
            echo "src/gz local-rmall file:///opt/tmp/src" > /opt/etc/opkg.conf.d/16-local.conf
          run: |
            set -ex
            echo Y | toltecctl generate-opkg-conf
            opkg update
            opkg install my-package
            # Add steps here to test app
            opkg remove my-package
          path: dist/rmall
      - name: Save packages
        uses: actions/upload-artifact@v3
        with:
          name: packages
          path: dist/**/*.ipk
This site was last updated on Dec 02, 2024.