Files
punktfunk/clients/decky/scripts/deploy.sh
T
enricobuehler 22bc81238d fix(decky): Decky's plugin list says "Punktfunk", not "punktfunk"
The label Decky shows for an installed plugin is plugin.json "name", which
we had set to the lowercase directory name — so the one place every user
sees the plugin listed was the one place it was off-brand, while the panel
header (titleView) already read "Punktfunk".

The two were conflated because the name looked load-bearing: the zip's
top-level dir becomes ~/homebrew/plugins/<dir>, and the scripts derived
that dir FROM plugin.json "name". They are in fact independent — Decky
extracts the zip as-is and locates an installed plugin by MATCHING
plugin.json "name", never by folder name (that is how a plugin can live in
DeckWebBrowser/ and list itself as "Web Browser").

So brand-case the label and pin the on-disk dir to the literal `punktfunk`
in package.sh/deploy.sh/CI instead of deriving it. Pinning is the part that
matters: had the dir followed the label, this rename would have installed a
second `Punktfunk/` folder beside the existing `punktfunk/` and the plugin
would have shown up twice.

The self-update call passes the name Decky uninstalls before extracting, so
it moves to "Punktfunk" with it. The upgrade INTO this build still passes
"punktfunk" (the installed build's own value), which matches that build's
plugin.json — so the old folder is removed and the new zip lands in the
same lowercase dir either way. Decky's per-plugin settings dir is unused
(all state lives in ~/.config/punktfunk), so nothing is stranded.
2026-08-05 23:20:28 +02:00

38 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Deploy the staged plugin tree (out/<name>, produced by scripts/package.sh) into a Steam
# Deck's ~/homebrew/plugins/, then restart Decky Loader.
#
# Decky's plugins dir is ROOT-OWNED (PluginLoader runs as root and manages it), so the install
# step needs sudo on the Deck. We rsync to a deck-writable /tmp first (no privilege), then
# sudo-copy into place. Out-of-band installs only appear after a loader restart.
#
# Usage:
# DECK=deck@192.168.1.235 bash scripts/deploy.sh # interactive sudo (prompts on the Deck)
# DECK=deck@192.168.1.235 DECKPASS=... bash scripts/deploy.sh # non-interactive (scripted/CI)
set -euo pipefail
HERE="$(cd "$(dirname "$0")/.." && pwd)"
DECK="${DECK:?set DECK=deck@<ip>}"
# The on-disk plugin DIR (what scripts/package.sh staged into out/), not plugin.json "name" —
# that field is the brand-cased label Decky shows in its plugin list. See package.sh's header.
NAME=punktfunk
STAGE_LOCAL="$HERE/out/$NAME"
[ -d "$STAGE_LOCAL" ] || { echo "$STAGE_LOCAL missing — run scripts/package.sh first" >&2; exit 1; }
# 1. push to a deck-writable temp dir (deck owns its $HOME)
rsync -azp --delete -e ssh "$STAGE_LOCAL/" "$DECK:/tmp/$NAME/"
# 2. sudo-install into the root-owned plugins dir, match Decky's root:root ownership, reload
INSTALL="rm -rf /home/deck/homebrew/plugins/$NAME \
&& cp -r /tmp/$NAME /home/deck/homebrew/plugins/$NAME \
&& chown -R root:root /home/deck/homebrew/plugins/$NAME \
&& rm -rf /tmp/$NAME \
&& systemctl restart plugin_loader"
if [ -n "${DECKPASS:-}" ]; then
ssh "$DECK" "echo '$DECKPASS' | sudo -S sh -c '$INSTALL'"
else
echo "==> sudo on the Deck will prompt for ${DECK}'s password:"
ssh -t "$DECK" "sudo sh -c '$INSTALL'"
fi
echo "deployed $NAME$DECK:~/homebrew/plugins/$NAME and restarted plugin_loader"