Initial commit

This commit is contained in:
2025-08-08 21:22:56 -03:00
commit e40f76d589
23 changed files with 281 additions and 0 deletions
+59
View File
@@ -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/<package>_<version>_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/<owner>/debian ...`.
+70
View File
@@ -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
Binary file not shown.
Binary file not shown.
+8
View File
@@ -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
+14
View File
@@ -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
Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

+9
View File
@@ -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.
+27
View File
@@ -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
+94
View File
@@ -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 "$@"