diff --git a/README.md b/README.md deleted file mode 100644 index 035a9ff..0000000 --- a/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# Personal APT repository - -This directory is a minimal Debian/apt repository that hosts personal -packages for the Clockwork Pi image. - -Currently it contains only **clockworkpi-theme**. - -## Structure -``` -apt-repository/ -├── build-repo.sh # helper to rebuild the index -├── pool/main/c/clockworkpi-theme/ -│ └── clockworkpi-theme_*.deb # package files live here -└── dists/bookworm/stable/main/binary-all/ - ├── Packages - └── Packages.gz -``` - -## Usage -1. Build / rebuild your theme package in *pi-gen* (e.g. via - `scripts/package-custom-theme.sh`). -2. Run the helper here: - ```bash - cd apt-repository - ./build-repo.sh - ``` -3. Commit & push this repo – the raw URL of the repo root is the apt - source, e.g. - ``` - deb [arch=all] https://gitea.example.com/olivier/apt-repository bookworm stable main - ``` - -## Adding more packages -Just copy additional `.deb` files into an appropriate sub-directory -under `pool/` (follow the first letter scheme) and run -`./build-repo.sh` – the script rescans the entire pool each time. diff --git a/build-repo.sh b/build-repo.sh deleted file mode 100755 index e5d7a13..0000000 --- a/build-repo.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -# ----------------------------------------------------------------------------- -# build-repo.sh – regenerate minimal Debian/apt repository -# ----------------------------------------------------------------------------- -# 1. copies the current custom-theme.deb from ../ClockworkPi-pi-gen/custom-theme/ -# (edit PKG_SRC below if your path is different) -# 2. puts it into pool/main/c/clockworkpi-theme/ -# 3. runs dpkg-scanpackages to create Packages & Packages.gz -# 4. writes a small Release stub (not signed – fine for private use, add gpg -# signing later if you wish) -# -# After running, commit & push this repo – the raw URLs will be usable as an -# apt source on any machine. -# ----------------------------------------------------------------------------- -set -euo pipefail - -PKG_SRC="../ClockworkPi-pi-gen/custom-theme/custom-theme.deb" # location of .deb -POOL_DIR="pool/main/c/clockworkpi-theme" -DIST="bookworm" -COMP="stable" -ARCH="all" - -if [[ ! -f "${PKG_SRC}" ]]; then - echo "ERROR: ${PKG_SRC} not found – build your theme package first." >&2 - exit 1 -fi - -mkdir -p "${POOL_DIR}" -cp -u "${PKG_SRC}" "${POOL_DIR}/" # copy only if newer (keeps history) - -BIN_DIR="dists/${DIST}/${COMP}/main/binary-${ARCH}" -mkdir -p "${BIN_DIR}" - -# Generate Packages & Packages.gz -if ! command -v dpkg-scanpackages >/dev/null; then - echo "ERROR: dpkg-scanpackages not found – install dpkg-dev." >&2 - exit 1 -fi - -dpkg-scanpackages --arch "${ARCH}" pool /dev/null > "${BIN_DIR}/Packages" - gzip -9c "${BIN_DIR}/Packages" > "${BIN_DIR}/Packages.gz" - -# Minimal Release file (unsigned) -mkdir -p "dists/${DIST}" -cat > "dists/${DIST}/Release" <&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 +dpkg-deb --build "$pkg_path" "$output_path" +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" +else + echo "$response" + echo "Package $output_path uploaded successfully" +fi + + + + + + + + diff --git a/builds/ucon-rotate_0.1_all.deb b/builds/ucon-rotate_0.1_all.deb new file mode 100644 index 0000000..a64a3a2 Binary files /dev/null and b/builds/ucon-rotate_0.1_all.deb differ diff --git a/pool/main/c/clockworkpi-theme/custom-theme.deb b/custom-theme.deb similarity index 100% rename from pool/main/c/clockworkpi-theme/custom-theme.deb rename to custom-theme.deb diff --git a/dists/bookworm/Release b/dists/bookworm/Release deleted file mode 100644 index 420eeaa..0000000 --- a/dists/bookworm/Release +++ /dev/null @@ -1,8 +0,0 @@ -Origin: Custom -Label: Custom Repo -Suite: stable -Version: 1.0 -Codename: bookworm -Architectures: all -Components: main -Description: Personal ClockworkPi repository diff --git a/dists/bookworm/stable/main/binary-all/Packages b/dists/bookworm/stable/main/binary-all/Packages deleted file mode 100644 index e6ce847..0000000 --- a/dists/bookworm/stable/main/binary-all/Packages +++ /dev/null @@ -1,15 +0,0 @@ -Package: ucon-rotate -Version: 0.1 -Architecture: all -Maintainer: Olivier -Depends: bash -Filename: pool/main/u/ucon-rotate/ucon-rotate_0.2_all.deb -Size: 1692 -MD5sum: 7d20aa98b4bdd694835c8bb9c46b8e87 -SHA1: 63ab5b1499b89e5a86074ea0cf31a7de340c5d82 -SHA256: fba99567ec0f0714ca43115406ad1c8ea2390f52f40d101b462b548a2bdfa0a5 -Section: utils -Priority: optional -Description: Rotate uConsole DSI display via wlr-randr - Provides the `ucon-rotate` command to rotate the primary DSI output under Wayland. - diff --git a/dists/bookworm/stable/main/binary-all/Packages.gz b/dists/bookworm/stable/main/binary-all/Packages.gz deleted file mode 100644 index 20648b9..0000000 Binary files a/dists/bookworm/stable/main/binary-all/Packages.gz and /dev/null differ diff --git a/pool/main/c/clockworkpi-theme/.gitkeep b/pool/main/c/clockworkpi-theme/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/pool/main/u/ucon-rotate/ucon-rotate_0.1_all.deb b/pool/main/u/ucon-rotate/ucon-rotate_0.1_all.deb deleted file mode 100644 index 35f8d5b..0000000 Binary files a/pool/main/u/ucon-rotate/ucon-rotate_0.1_all.deb and /dev/null differ diff --git a/pool/main/u/ucon-rotate/ucon-rotate_0.2_all.deb b/pool/main/u/ucon-rotate/ucon-rotate_0.2_all.deb deleted file mode 100644 index 56588e6..0000000 Binary files a/pool/main/u/ucon-rotate/ucon-rotate_0.2_all.deb and /dev/null differ diff --git a/ucon-rotate/DEBIAN/control b/ucon-rotate/DEBIAN/control new file mode 100644 index 0000000..b139636 --- /dev/null +++ b/ucon-rotate/DEBIAN/control @@ -0,0 +1,9 @@ +Package: ucon-rotate +Version: 0.1 +Section: utils +Priority: optional +Architecture: all +Depends: bash +Maintainer: Olivier +Description: Rotate uConsole DSI display via wlr-randr + Provides the `ucon-rotate` command to rotate the primary DSI output under Wayland. diff --git a/ucon-rotate/usr/bin/ucon-rotate b/ucon-rotate/usr/bin/ucon-rotate new file mode 100755 index 0000000..ecdc335 --- /dev/null +++ b/ucon-rotate/usr/bin/ucon-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: ucon-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 "$@"