Complete rebase

This commit is contained in:
2025-08-08 16:56:12 -03:00
parent 26a85d407b
commit 4ffbc4237d
13 changed files with 150 additions and 115 deletions
-36
View File
@@ -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.
-56
View File
@@ -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" <<EOF
Origin: Custom
Label: Custom Repo
Suite: ${COMP}
Version: 1.0
Codename: ${DIST}
Architectures: ${ARCH}
Components: main
Description: Personal ClockworkPi repository
EOF
echo "Repository updated commit & push."
+47
View File
@@ -0,0 +1,47 @@
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
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
Binary file not shown.
-8
View File
@@ -1,8 +0,0 @@
Origin: Custom
Label: Custom Repo
Suite: stable
Version: 1.0
Codename: bookworm
Architectures: all
Components: main
Description: Personal ClockworkPi repository
@@ -1,15 +0,0 @@
Package: ucon-rotate
Version: 0.1
Architecture: all
Maintainer: Olivier <olivier@example.com>
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+9
View File
@@ -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.
+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: 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 "$@"