Skip to content
Draft
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
119 changes: 106 additions & 13 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,120 @@ name: Build installer zip

on:
workflow_call:
inputs:
ref:
description: 'Ref to build (default: the calling ref)'
type: string
required: false
default: ''
outputs:
commit:
value: ${{ jobs.build.outputs.commit }}
pull_request:
workflow_dispatch:
push:
branches:
- main

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
outputs:
commit: ${{ steps.checkout.outputs.commit }}
steps:
- uses: actions/checkout@v4

- name: Package installer
- uses: actions/checkout@v6
id: checkout
with:
ref: ${{ inputs.ref }}
persist-credentials: false
fetch-depth: 0

- name: Install build dependencies
run: |
wget -O install_opencentauri/decrypt https://github.com/OpenCentauri/OpenCentauri/releases/download/v0.0.0/decrypt
wget -O install_opencentauri/recovery https://github.com/OpenCentauri/OpenCentauri/releases/download/v1.1.0/recovery
wget -O install_opencentauri/wifi-network-config-tool https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/wifi-network-config-tool-linux-armv7
wget -O install_opencentauri/utf8-fix https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/utf8-fix-linux-armv7
zip -r oc-installer.zip install_opencentauri

- uses: actions/upload-artifact@v4
with:
name: installer
path: oc-installer.zip
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf busybox shellcheck

- name: Cache pigz build
uses: actions/cache@v5
with:
path: build/pigz
key: pigz-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('tools/build-pigz.sh') }}

- name: Cache curl build
uses: actions/cache@v5
with:
path: build/curl
key: curl-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('tools/build-curl.sh') }}

- name: Cache fetched ARM helpers
uses: actions/cache@v5
with:
path: |
build/recovery
build/bind-shell
key: fetch-${{ runner.os }}-${{ hashFiles('tools/fetch-binaries.sh') }}

- name: Build all installers
run: ./build.sh

- name: Upload CC1 installer
uses: actions/upload-artifact@v6
with:
name: installer-cc1
path: build/cc1
if-no-files-found: error

- name: Upload CC1 release zip
uses: actions/upload-artifact@v6
with:
name: oc-installer.zip
path: build/oc-installer.zip
if-no-files-found: error

- name: Upload CC2 installer
uses: actions/upload-artifact@v6
with:
name: installer-cc2
path: build/cc2_eeb001_*.zip.sig
if-no-files-found: error

- name: Upload C2 installer
uses: actions/upload-artifact@v6
with:
name: installer-c2
path: build/c2_eeb001_*.zip.sig
if-no-files-found: error

comment:
needs: build
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
actions: read
pull-requests: write
steps:
- uses: actions/github-script@v7
continue-on-error: true
with:
script: |
const marker = '<!-- installer-artifacts -->';
const issue = {...context.repo, issue_number: context.issue.number};
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const {data: {artifacts}} = await github.rest.actions.listWorkflowRunArtifacts({
...context.repo, run_id: context.runId,
});
const links = artifacts.filter(a => a.name.startsWith('installer-'))
.map(a => `- [${a.name}](${runUrl}/artifacts/${a.id})`).join('\n');
const body = `${marker}\n## Build artifacts\n\n` +
`Build: \`${context.payload.pull_request.head.sha.slice(0, 7)}\`\n\n` +
`${links}\n\n[View workflow run](${runUrl})`;
const comments = await github.paginate(github.rest.issues.listComments, issue);
const previous = comments.find(c => c.user?.type === 'Bot' && c.body?.includes(marker));
if (previous) {
await github.rest.issues.updateComment({...context.repo, comment_id: previous.id, body});
} else {
await github.rest.issues.createComment({...issue, body});
}
46 changes: 30 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
type: string
default: 'main'
version:
description: 'Version to release (e.g., 1.0.0). If not provided, will be inferred from the latest tag.'
required: false
description: 'Release tag (e.g., v1.0.0)'
required: true
type: string
draft:
description: 'Create as draft release'
Expand All @@ -22,34 +22,48 @@ on:
default: true

permissions:
contents: write # Required by softprops/action-gh-release@v2 to create releases and upload artifacts
id-token: write # Required by actions/attest@v2 for OIDC authentication with the attestation service
attestations: write # Required by actions/attest@v2 to create and store attestations
contents: read

jobs:
build:
name: Build
uses: ./.github/workflows/build.yaml
permissions:
contents: read
actions: read
pull-requests: write
with:
ref: ${{ inputs.branch || github.sha }}

release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Download CC1 release zip
uses: actions/download-artifact@v6
with:
pattern: oc-installer.zip
path: artifacts

- name: Download C2/CC2 zip.sig artifacts
uses: actions/download-artifact@v6
with:
pattern: installer-c*2
path: artifacts

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.event.inputs.version || github.ref_name }}
draft: ${{ github.event.inputs.draft || false }}
tag_name: ${{ inputs.version || github.ref_name }}
target_commitish: ${{ needs.build.outputs.commit }}
draft: ${{ github.event_name == 'workflow_dispatch' && inputs.draft }}
prerelease: false
generate_release_notes: false
files: artifacts/**/*
fail_on_unmatched_files: true

- name: Attest Release
uses: actions/attest@v2
Expand All @@ -58,7 +72,7 @@ jobs:
predicate-type: 'https://in-toto.io/attestation/release/v0.1'
predicate: |
{
"version": "${{ github.event.inputs.version || github.ref_name }}",
"commit": "${{ github.sha }}",
"branch": "${{ github.event.inputs.branch || github.ref_name }}"
}
"version": ${{ toJSON(inputs.version || github.ref_name) }},
"commit": ${{ toJSON(needs.build.outputs.commit) }},
"branch": ${{ toJSON(inputs.branch || github.ref_name) }}
}
102 changes: 101 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ This installer can
- Install OpenCentauri
- Update OpenCentauri
- Uninstall OpenCentauri
- Back up the eMMC to USB with live progress
- Install or remove a root shell (port 4567)

In `Utils`, the shell control and eMMC backup occupy the same positions as on
C2/CC2. Before installing, the shell control checks TCP port 4567. If it is
already listening, it reports `ERROR: Root shell already installed/running`
without changing anything. An installer-managed shell can still be removed.
CC1 backups use `cc1-emmc-backup-*`; the backup rules below apply to both models.
CC1 shell recovery files are stored in `/user-resource/oc-root-shell`.
After a stock OTA, restore with `sh /user-resource/oc-root-shell/reinstall.sh`.
Logs stay on USB at `/mnt/exUDISK/OCInstaller.log`.

## Usage
1. [Download](https://github.com/OpenCentauri/oc-installer/releases/latest/download/oc-installer.zip) the latest release
Expand All @@ -14,4 +25,93 @@ This installer can
5. On your Centauri Carbon, navigate to the files tab, `Usb Drive`, then `install_opencentauri`
6. Touch hold the `IMPORT_ME_DO_NOT_PRINT` file, then select `Import`
7. Run `Install OpenCentauri (Online)`
8. Restart when the install process finished
8. Restart when the install process finished

For a local OpenCentauri/COSMOS install, place `update.swu` or
`cosmos-centauri-carbon-1.swu` inside `install_opencentauri/` on the USB drive.
`update.swu` takes precedence if both exist; other `.swu` filenames are ignored.

## Centauri 2 / Centauri Carbon 2

This installer can
- Install COSMOS online or from USB
- Check the boot slot
- Install or remove a root shell
- Back up the eMMC to USB

### Usage
1. Download `installer-c2` or `installer-cc2` from the build artifacts
2. Extract the `.zip.sig` file onto a FAT32-formatted thumbdrive
3. Insert the drive and select the update in the printer's update menu
4. Choose a tool, then `Exit and Reboot` when finished

The update opens the installer without flashing firmware. It stops the stock
updater and clears its pending update flags. Only the COSMOS install buttons
flash firmware. C2 and CC2 use the same COSMOS image.

Recommended before a first COSMOS install (especially on C2/CC2): run
`Utils → Backup eMMC to USB` and keep the finished backup somewhere safe.
`Utils → Start temp root shell (port 4567)` gives you a root shell for the
session without installing anything, which is handy for inspecting or
recovering the stock system before you flash.

The installer extracts to `/oc-installer`, not `/opt/usr`. Bootstrap, GUI and
command output, errors and exit statuses append to `/mnt/exUDISK/OCInstaller.log`.
Keep that USB mount writable; the installer does not fall back to internal logs.
Every Reboot action removes `/oc-installer` and syncs before rebooting.

For an offline install, put `update.swu` or `cosmos-centauri-carbon-2.swu`
in the USB drive's root. `update.swu` takes precedence if both exist.
The old `install_c2/update.swu` path remains a fallback. Empty files and
directories are ignored; the selected USB original is never deleted.

### Root shell

On CC1 and C2/CC2, `Start temp root shell (port 4567)` runs the extracted
binary in the background without installing a service or changing autostart.
It refuses to start if port 4567 is already listening.

Installing starts the shell immediately and at boot. Connect with
`nc <printer-ip> 4567`. There is no authentication; use a trusted network and
remove the shell when finished. `Reload menu` updates the install/remove label.
Shell recovery files are stored in `/opt/usr/oc-root-shell`.
After a stock OTA wipe, reinstall with `sh /opt/usr/oc-root-shell/reinstall.sh`.

### eMMC backup

Keep at least 5 GiB free. Do not print or remove the USB drive during backup.
The screen shows bytes read and percentage, then checks the gzip archive.
Compression uses two-worker pigz at level 1; the bundled static binary also
checks the archive.
This copies a running system, not a consistent filesystem snapshot.

Each run creates a dated `c2-emmc-backup-*` directory. Previous backups are
left alone. A `.partial` directory is incomplete; a finished backup contains
`OK.txt`. Remove unwanted backups on your computer to reclaim space.

FAT32 output is split into 1 GiB parts. exFAT/ext4 output is a single gzip file,
if the printer supports and mounts that filesystem. On a computer:

```sh
# FAT32: reassemble the parts inside the backup directory
cat c2-emmc-backup.bin.gz.part-* > c2-emmc-backup.bin.gz

gzip -t c2-emmc-backup.bin.gz
gzip -dc c2-emmc-backup.bin.gz | wc -c
```

The decompressed size on the tested C2/CC2 eMMC is `7837581312` bytes. Use host
tools for this check; the stock printer's `wc` counter wraps above 4 GiB.

### Building

Run `./build.sh` with Python 3.11+, OpenSSL, BusyBox, ShellCheck, curl, make
and `gcc-arm-linux-gnueabihf` installed.
It builds static pigz from pinned musl/zlib/pigz sources, tests the scripts,
and writes `oc-installer.zip` for CC1 plus both C2/CC2 `.zip.sig` files under
`build/`. The CC1 ZIP includes the same static pigz and bind-shell helpers.
CI caches the pigz build.
Third-party notices are included in the installer.
The bundled GUI is built from OpenCentauri/atomscreen with live task output.
The root-shell binary comes from OpenCentauri. The OTA
wrapper follows the format used by [COSMOS](https://github.com/OpenCentauri/cosmos).
24 changes: 24 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")"

sh tools/build-pigz.sh
sh tools/build-curl.sh
sh tools/fetch-binaries.sh

[ -s install_opencentauri/decrypt ] || curl -fLsS -o install_opencentauri/decrypt https://github.com/OpenCentauri/OpenCentauri/releases/download/v0.0.0/decrypt
[ -s install_opencentauri/utf8-fix ] || curl -fLsS -o install_opencentauri/utf8-fix https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/utf8-fix-linux-armv7
[ -s install_opencentauri/wifi-network-config-tool ] || curl -fLsS -o install_opencentauri/wifi-network-config-tool https://github.com/OpenCentauri/OpenCentauri/releases/latest/download/wifi-network-config-tool-linux-armv7

python3 tests/test_build.py
python3 -m unittest discover -s tests -p "test_*.py"
python3 tests/test_install_scripts.py

python3 tools/make_cc1.py
rm -f build/c2-tools-bootstrap.swu build/*_eeb001_*.zip.sig
python3 tools/make_swu.py
python3 tools/make_zipsig.py build/c2-tools-bootstrap.swu --out build/

python3 tests/test_build.py --post-build

ls -l build/
Loading
Loading