Public-flip audit: generalize internal hosts/paths + drop Sulkta-internal refs
URLs, mount paths, and LAN host bindings parameterized via env or relative paths so the repo stands up from a clean clone anywhere. Drop cross-codebase refs internal client/merchant test fixtures, and audit-changelog scaffolding from comments. README terser, technical content preserved.
This commit is contained in:
parent
79af13b8ef
commit
9d70a23df5
6 changed files with 731 additions and 64 deletions
|
|
@ -1,30 +1,34 @@
|
|||
#!/usr/bin/env bash
|
||||
# Build addon.zip for torttube — runs from a host with SSH access to the build host.
|
||||
# Build addon.zip for torttube.
|
||||
#
|
||||
# Cross-compiles the sidecar via messense/rust-musl-cross:aarch64-musl
|
||||
# (one-shot container, no host-toolchain mutation), bundles yt-dlp's
|
||||
# aarch64 release binary, packages with the Kodi addon dir layout, and
|
||||
# drops the zip at /srv/downloads/torttube/ on the build host.
|
||||
# (one-shot docker container, no host toolchain mutation), bundles
|
||||
# yt-dlp's universal Python zipapp, packages with the Kodi addon dir
|
||||
# layout, and drops the zip in dist/ at the repo root.
|
||||
#
|
||||
# Usage: bash scripts/build-addon-zip.sh
|
||||
#
|
||||
# Expected: ssh alias "build-host" works (per your SSH config), and the
|
||||
# torttube source is at /build/torttube/
|
||||
# on the build host (rsync first if you're iterating locally).
|
||||
# Requirements: docker, zip, curl. Runs from any clone of the repo.
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="${VERSION:-0.0.1}"
|
||||
SRC=/build/torttube
|
||||
CARGO_HOME_CACHE=/build/.cargo-aarch64
|
||||
TARGET_DIR=/build/.aarch64-target
|
||||
STAGE=/tmp/torttube-stage
|
||||
DEST_DIR=/srv/downloads/torttube
|
||||
|
||||
# Resolve repo root from script location — works from any clone path.
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SRC="${REPO_ROOT}"
|
||||
CARGO_HOME_CACHE="${REPO_ROOT}/.cargo-aarch64"
|
||||
TARGET_DIR="${REPO_ROOT}/.aarch64-target"
|
||||
STAGE="$(mktemp -d -t torttube-stage.XXXXXX)"
|
||||
DEST_DIR="${DEST_DIR:-${REPO_ROOT}/dist}"
|
||||
trap 'rm -rf "$STAGE"' EXIT
|
||||
|
||||
mkdir -p "$CARGO_HOME_CACHE" "$TARGET_DIR" "$DEST_DIR"
|
||||
|
||||
echo ">>> Cross-compile sidecar for aarch64-musl"
|
||||
ssh build-host "docker run --rm \
|
||||
-v $SRC/sidecar:/src \
|
||||
-v $CARGO_HOME_CACHE:/cargo-home \
|
||||
-v $TARGET_DIR:/target \
|
||||
docker run --rm \
|
||||
-v "$SRC/sidecar":/src \
|
||||
-v "$CARGO_HOME_CACHE":/cargo-home \
|
||||
-v "$TARGET_DIR":/target \
|
||||
-e PATH=/root/.cargo/bin:/usr/local/musl/bin:/usr/local/bin:/usr/bin:/bin \
|
||||
-e CARGO_HOME=/cargo-home \
|
||||
-e CARGO_TARGET_DIR=/target \
|
||||
|
|
@ -32,29 +36,29 @@ ssh build-host "docker run --rm \
|
|||
-e CC_aarch64_unknown_linux_musl=aarch64-unknown-linux-musl-gcc \
|
||||
-w /src \
|
||||
messense/rust-musl-cross:aarch64-musl \
|
||||
cargo build --release"
|
||||
cargo build --release
|
||||
|
||||
echo ">>> Stage addon tree"
|
||||
ssh build-host "rm -rf $STAGE && mkdir -p $STAGE/plugin.video.torttube/bin"
|
||||
ssh build-host "rsync -a $SRC/addon/plugin.video.torttube/ $STAGE/plugin.video.torttube/ --exclude bin"
|
||||
ssh build-host "cp $TARGET_DIR/aarch64-unknown-linux-musl/release/torttube-sidecar $STAGE/plugin.video.torttube/bin/"
|
||||
mkdir -p "$STAGE/plugin.video.torttube/bin"
|
||||
rsync -a "$SRC/addon/plugin.video.torttube/" "$STAGE/plugin.video.torttube/" --exclude bin
|
||||
cp "$TARGET_DIR/aarch64-unknown-linux-musl/release/torttube-sidecar" \
|
||||
"$STAGE/plugin.video.torttube/bin/"
|
||||
|
||||
echo ">>> Fetch yt-dlp universal Python zipapp"
|
||||
# Pure-Python zipapp runs on any Python 3.9+ — works around LibreELEC's
|
||||
# armhf userspace (where yt-dlp's dynamic aarch64 binary can't find
|
||||
# ld-linux-aarch64.so.1). Kodi 20 ships Python 3.11.
|
||||
ssh build-host "curl -sSL -o $STAGE/plugin.video.torttube/bin/yt-dlp \
|
||||
https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp"
|
||||
ssh build-host "chmod +x $STAGE/plugin.video.torttube/bin/*"
|
||||
curl -sSL -o "$STAGE/plugin.video.torttube/bin/yt-dlp" \
|
||||
https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp
|
||||
chmod +x "$STAGE/plugin.video.torttube/bin/"*
|
||||
|
||||
echo ">>> Build addon.zip"
|
||||
ssh build-host "cd $STAGE && rm -f plugin.video.torttube.zip && \
|
||||
zip -r plugin.video.torttube.zip plugin.video.torttube/ -x '*.DS_Store' > /dev/null"
|
||||
( cd "$STAGE" && \
|
||||
rm -f plugin.video.torttube.zip && \
|
||||
zip -r plugin.video.torttube.zip plugin.video.torttube/ -x '*.DS_Store' > /dev/null )
|
||||
|
||||
echo ">>> Drop at $DEST_DIR/plugin.video.torttube-$VERSION.zip"
|
||||
ssh build-host "mkdir -p $DEST_DIR && cp $STAGE/plugin.video.torttube.zip \
|
||||
$DEST_DIR/plugin.video.torttube-$VERSION.zip"
|
||||
|
||||
ssh build-host "ls -la $DEST_DIR/"
|
||||
echo ">>> done — install via Kodi: Settings > Add-ons > Install from zip"
|
||||
echo " SMB path: smb://fileserver/downloads/torttube/plugin.video.torttube-$VERSION.zip"
|
||||
OUT="$DEST_DIR/plugin.video.torttube-$VERSION.zip"
|
||||
cp "$STAGE/plugin.video.torttube.zip" "$OUT"
|
||||
ls -la "$DEST_DIR/"
|
||||
echo ">>> done — $OUT"
|
||||
echo " Install via Kodi: Settings > Add-ons > Install from zip"
|
||||
|
|
|
|||
Reference in a new issue