commit e40f76d5899f90da1839093f7ce011516b9d917e Author: Olivier Date: Fri Aug 8 21:22:56 2025 -0300 Initial commit diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..a22e82c --- /dev/null +++ b/README.MD @@ -0,0 +1,59 @@ +## Overview + +This repository contains simple Debian packages and a helper script to build and upload them to a Gitea Package Registry. + +### Layout + +- Each package lives in its own directory (for example `uconsole-custom-theme/`, `uconsole-rotate/`). + - Inside each package: + - `DEBIAN/control`: package metadata (name, version, architecture, etc.) + - Payload files arranged exactly as they should be installed (for example `usr/share/...`). + - `README.md` file to document the package. +- `builds/`: output folder for built `.deb` files (created automatically via the build-upload script). +- `build-upload.sh`: interactive helper to build and upload a package. + +### Requirements + +- Packages: `dpkg-deb`, `curl` +- A self-hosted Gitea server >= 1.17 (introduced [packages](https://docs.gitea.com/usage/packages/overview)) + +### Build and upload a package + +1) Create or modify package paylod/script (ex: `usr/bin/uconsole-rotate`) +2) Edit `DEBIAN/control` in the package directory (Bump `Version`). +3) From within the directory, run: + +``` +./build-upload.sh +``` + +3) Select a package from the list, then enter your Gitea username/password (or personal access token). The script: +- Builds and output to `builds/__all.deb` +- Uploads it to: `https://git.chiasson.cloud/api/packages/Olivier/debian/pool/bookworm/main/upload` +- Handles Gitea response + +### Consumer setup (APT on target systems) + +Add the source and key (example for `bookworm`, owner `Olivier`): + +``` +sudo curl -fsSL https://git.chiasson.cloud/api/packages/Olivier/debian/repository.key \ + | sudo gpg --dearmor -o /etc/apt/keyrings/chiasson-cloud.gpg +echo "deb [signed-by=/etc/apt/keyrings/chiasson-cloud.gpg] \ +https://git.chiasson.cloud/api/packages/Olivier/debian bookworm main" \ +| sudo tee /etc/apt/sources.list.d/chiasson-cloud.list +sudo apt update +``` + +Install packages: + +``` +sudo apt install uconsole-custom-theme uconsole-rotate +``` + +### Notes + +- If your package overwrites files from other packages, declare appropriate `Replaces` (and optionally `Conflicts/Breaks`) in `DEBIAN/control`. +- For Gitea, the Debian registry path is owner-scoped: `/api/packages//debian ...`. + + diff --git a/build-upload.sh b/build-upload.sh new file mode 100755 index 0000000..ac77e5f --- /dev/null +++ b/build-upload.sh @@ -0,0 +1,70 @@ +remote_url='https://git.chiasson.cloud/api/packages/Olivier/debian/pool/bookworm/main/upload' +script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +cd "$script_dir" + +# Build list of package directories (those containing DEBIAN/control) +dirs=() +for d in "$script_dir"/*/; do + [[ -f "$d/DEBIAN/control" ]] && dirs+=("$(basename "$d")") +done + +if ((${#dirs[@]} == 0)); then + echo "No package directories with DEBIAN/control found in $script_dir" >&2 + exit 1 +fi + +PS3="Choose a package directory: " +select pkg in "${dirs[@]}"; do + if [[ -n "$pkg" ]]; then + pkg_path="$pkg" + break + fi + echo "Invalid selection" +done +version=$(awk -F': ' '/^Version:/{print $2; exit}' "$pkg_path/DEBIAN/control") +output_file="${pkg_path}_${version}_all.deb" +output_path="builds/${output_file}" +read -p "Enter your username: " user +read -s -p "Enter your password: " pass +echo + +mkdir -p builds + +# Temporarily move top-level README files out during build, then restore +backup_dir=$(mktemp -d) +moved_readmes=() +restore_readmes() { + for f in "${moved_readmes[@]}"; do + [ -f "$backup_dir/$f" ] && mv "$backup_dir/$f" "$pkg_path/$f" + done +} +# Always clean up backup dir; README files are restored immediately after build +trap 'rm -rf "$backup_dir"' EXIT + +for f in README.md readme.md README Readme.md; do + if [ -f "$pkg_path/$f" ]; then + mv "$pkg_path/$f" "$backup_dir/$f" + moved_readmes+=("$f") + fi +done + +dpkg-deb --build "$pkg_path" "$output_path" +# Restore README files now so the repo looks unchanged for the rest of the script +restore_readmes +response=$(curl --silent --show-error --user "$user:$pass" --upload-file "$output_path" "$remote_url" 2>&1) +if echo "$response" | grep -q "package file already exists"; then + echo "Upload skipped: package file already exists on the server. You might have forgot to update the version number in the control file" +elif echo "$response" | grep -q "authGroup.Verify"; then + echo "Upload failed: authentication failed" +else + echo "$response" + echo "Package $output_path uploaded successfully" +fi + + + + + + + + diff --git a/builds/uconsole-custom-theme_0.1_all.deb b/builds/uconsole-custom-theme_0.1_all.deb new file mode 100644 index 0000000..fb335dd Binary files /dev/null and b/builds/uconsole-custom-theme_0.1_all.deb differ diff --git a/builds/uconsole-rotate_0.1_all.deb b/builds/uconsole-rotate_0.1_all.deb new file mode 100644 index 0000000..62006a0 Binary files /dev/null and b/builds/uconsole-rotate_0.1_all.deb differ diff --git a/uconsole-custom-theme/DEBIAN/control b/uconsole-custom-theme/DEBIAN/control new file mode 100755 index 0000000..24a00a9 --- /dev/null +++ b/uconsole-custom-theme/DEBIAN/control @@ -0,0 +1,8 @@ +Package: uconsole-custom-theme +Version: 0.1 +Maintainer: Olivier +Architecture: all +Priority: optional +Replaces: rpd-plym-splash, raspberrypi-ui-mods, piwiz +Description: uconsole-custom-theme + Custom uConsole theme providing wallpapers, boot splash screen and user avatar diff --git a/uconsole-custom-theme/README.md b/uconsole-custom-theme/README.md new file mode 100644 index 0000000..0a167bc --- /dev/null +++ b/uconsole-custom-theme/README.md @@ -0,0 +1,14 @@ +# uconsole-custom-theme + +A private theme payload used by my custom uConsole image build. It ships artwork and theming assets (wallpapers, splash, avatars) that are referenced by scripts/config during the image build. + +## Important + +This package is not intended for public use and will not work on its own. It assumes the custom image build will place and reference these assets appropriately. + +To build a custom image that consumes these assets, see: [ClockworkPi-pi-gen](https://github.com/ak-rex/ClockworkPi-pi-gen) (Huge thank you to [ak-rex](https://linktr.ee/ak_rex)). + +## Notes + +- Designed to be pulled by the image build via APT +- Replace/override files from Raspberry Pi UI packages as part of the build theming diff --git a/uconsole-custom-theme/usr/share/piwiz/raspberry-pi-logo.png b/uconsole-custom-theme/usr/share/piwiz/raspberry-pi-logo.png new file mode 100644 index 0000000..63b1bce Binary files /dev/null and b/uconsole-custom-theme/usr/share/piwiz/raspberry-pi-logo.png differ diff --git a/uconsole-custom-theme/usr/share/plymouth/themes/pix/splash.png b/uconsole-custom-theme/usr/share/plymouth/themes/pix/splash.png new file mode 100644 index 0000000..04bd91c Binary files /dev/null and b/uconsole-custom-theme/usr/share/plymouth/themes/pix/splash.png differ diff --git a/uconsole-custom-theme/usr/share/raspberrypi-artwork/pookie-bear.png b/uconsole-custom-theme/usr/share/raspberrypi-artwork/pookie-bear.png new file mode 100644 index 0000000..63b1bce Binary files /dev/null and b/uconsole-custom-theme/usr/share/raspberrypi-artwork/pookie-bear.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/DevTerm_teardown.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/DevTerm_teardown.png new file mode 100755 index 0000000..125d427 Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/DevTerm_teardown.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystem.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystem.png new file mode 100755 index 0000000..e8de8d0 Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystem.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemBlack.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemBlack.png new file mode 100755 index 0000000..e8de8d0 Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemBlack.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemBlue.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemBlue.png new file mode 100755 index 0000000..8f7e185 Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemBlue.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemGreen.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemGreen.png new file mode 100755 index 0000000..8abeb99 Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemGreen.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemRed.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemRed.png new file mode 100755 index 0000000..fc75a5b Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemRed.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemWhite.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemWhite.png new file mode 100755 index 0000000..74262bb Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/RPiSystemWhite.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/aang.gif b/uconsole-custom-theme/usr/share/rpd-wallpaper/aang.gif new file mode 100644 index 0000000..0a97b4a Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/aang.gif differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/clockwork-wallpaper.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/clockwork-wallpaper.png new file mode 100755 index 0000000..d48273b Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/clockwork-wallpaper.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/rpi_1.png b/uconsole-custom-theme/usr/share/rpd-wallpaper/rpi_1.png new file mode 100644 index 0000000..071ba70 Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/rpi_1.png differ diff --git a/uconsole-custom-theme/usr/share/rpd-wallpaper/uconsole_teardown.webp b/uconsole-custom-theme/usr/share/rpd-wallpaper/uconsole_teardown.webp new file mode 100755 index 0000000..820e965 Binary files /dev/null and b/uconsole-custom-theme/usr/share/rpd-wallpaper/uconsole_teardown.webp differ diff --git a/uconsole-rotate/DEBIAN/control b/uconsole-rotate/DEBIAN/control new file mode 100644 index 0000000..0487631 --- /dev/null +++ b/uconsole-rotate/DEBIAN/control @@ -0,0 +1,9 @@ +Package: uconsole-rotate +Version: 0.1 +Section: utils +Priority: optional +Architecture: all +Depends: bash +Maintainer: Olivier +Description: Rotate uConsole DSI display via wlr-randr + Provides the `uconsole-rotate` command to rotate the primary DSI output under Wayland. diff --git a/uconsole-rotate/README.md b/uconsole-rotate/README.md new file mode 100644 index 0000000..4d13f5c --- /dev/null +++ b/uconsole-rotate/README.md @@ -0,0 +1,27 @@ +# uconsole-rotate + +Command-line helper to rotate the uConsole display on Wayland (sway/wayfire) using wlr-randr. + +## Important + +This rotation is not persisted across reboots. Re-run the command after login or add it to your session autostart if you want it applied automatically. + +I use this to quickly rotate the display to play games in other orientations. + +## Usage + +``` +uconsole-rotate [right|left|0|90|180|270] +``` + +- No argument: rotate 90° clockwise from current orientation +- right/left: rotate relative to current orientation +- 0/90/180/270: set rotation (device-specific mapping handled internally) + +## Notes + +- Automatically detects the DSI output +- Requires a Wayland session with `wlr-randr` available +- Exits with non-zero status if no DSI output is found or transform cannot be resolved + + diff --git a/uconsole-rotate/usr/bin/uconsole-rotate b/uconsole-rotate/usr/bin/uconsole-rotate new file mode 100755 index 0000000..de670e8 --- /dev/null +++ b/uconsole-rotate/usr/bin/uconsole-rotate @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Map logical degrees -> wlr-randr transform for this device +# Device reality: 0° logical == 270 transform (normal handheld portrait) +map_degree() { + local d=${1:-} + case "$d" in + 0) echo 270;; # logical 0 -> transform 270 + 90) echo 180;; # logical 90 -> transform 180 (fixed) + 180) echo 90;; # logical 180 -> transform 90 + 270) echo normal;; # logical 270 -> transform normal (fixed) + *) echo "";; + esac +} + +# Pick the DSI output name dynamically (DSI-1 or DSI-2) +detect_output() { + local out + out=$(wlr-randr | awk '/^DSI-[12]/{print $1; exit}') || true + if [[ -z "$out" ]]; then + echo "Error: No DSI output found (need Wayland + wlr-randr)" >&2 + exit 1 + fi + echo "$out" +} + +# Read current transform from wlr-randr line like: +# DSI-1 … transform: 270 +current_transform() { + local out="$1" + # Query the single output and print the value on the "Transform:" line (field 2) + # Use only POSIX-friendly awk features for compatibility + local val + val=$(wlr-randr --output "$out" | awk 'tolower($1)=="transform:" {print $2; exit}') || true + if [[ -z "$val" ]]; then + # Fallback: parse from the summary line for that output + val=$(wlr-randr | awk -v o="$out" 'tolower($1)==tolower(o) {for(i=1;i<=NF;i++){if(tolower($i)=="transform:"){print $(i+1); exit}}}') || true + fi + echo "$val" +} + +# Compute transform after rotating by a delta (in logical degrees), +# using the device-specific logical<->transform mapping. +compute_transform_with_delta() { + local cur="$1" + local delta="$2" # can be negative (e.g., -90) + # Reverse-map current PHYSICAL state: transform -> logical degrees + local logical + case "$cur" in + 270) logical=0;; + 180) logical=90;; + 90) logical=180;; + normal|0) logical=270;; + *) logical=0;; + esac + # Normalize wrap-around for negative values safely + local next=$(( ( (logical + delta) % 360 + 360 ) % 360 )) + map_degree "$next" +} + +main() { + local out; out=$(detect_output) + local arg=${1:-} + local transform + + if [[ -z "$arg" ]]; then + local cur; cur=$(current_transform "$out") + transform=$(compute_transform_with_delta "$cur" 90) + else + # normalize arg (allow 0/90/180/270) + case "$arg" in + right) + local cur; cur=$(current_transform "$out") + transform=$(compute_transform_with_delta "$cur" 90) + ;; + left) + local cur; cur=$(current_transform "$out") + transform=$(compute_transform_with_delta "$cur" -90) + ;; + 0|90|180|270) transform=$(map_degree "$arg");; + *) echo "Usage: uconsole-rotate [right|left|0|90|180|270]" >&2; exit 2;; + esac + fi + + if [[ -z "$transform" ]]; then + echo "Error: could not resolve transform" >&2 + exit 1 + fi + + exec wlr-randr --output "$out" --transform "$transform" +} + +main "$@"