blob: f27fe4ee018d8ecdfa6a58d43c7b8ccedbc64dfb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/usr/bin/env bash
set -euo pipefail
deck_host="deck@192.168.0.241"
plugin_root="Decky LSFG-VK"
install_path="/home/deck/homebrew/plugins/Decky LSFG-VK"
if [[ -z ${DEPLOY_EXPECT:-} && -f .env ]]; then
set -a
source .env
set +a
fi
if [[ -n ${DECK_PASSWORD:-} && -z ${DEPLOY_EXPECT:-} ]]; then
export DEPLOY_EXPECT=1
export DEPLOY_SCRIPT="$0"
exec expect <<'EXPECT'
set timeout -1
spawn bash $env(DEPLOY_SCRIPT)
expect {
-re {(?i)yes/no} {
send -- "yes\r"
exp_continue
}
-re {(?i)(password|passphrase).*:} {
send -- "$env(DECK_PASSWORD)\r"
exp_continue
}
eof
}
catch wait result
exit [lindex $result 3]
EXPECT
fi
package_dir="$(mktemp -d "${TMPDIR:-/tmp}/decky-plugin-package.XXXXXX")"
run_id="$(basename "$package_dir")"
remote_archive="/tmp/decky-lsfg-vk-${run_id}.zip"
remote_stage="/tmp/decky-lsfg-vk-stage-${run_id}"
trap 'rm -rf -- "$package_dir"' EXIT INT TERM
pnpm build
./cli/decky plugin build . \
--output-path "$package_dir" \
--tmp-output-path "$package_dir/tmp"
package_zip="$(find "$package_dir" -maxdepth 1 -type f -name '*.zip' -print -quit)"
test -n "$package_zip"
scp "$package_zip" "$deck_host:$remote_archive"
remote_script="$(cat <<'REMOTE'
set -euo pipefail
archive="$1"
stage="$2"
install="$3"
plugin_root="$4"
cleanup() {
rm -rf -- "$archive" "$stage"
}
trap cleanup EXIT INT TERM
mkdir -p -- "$stage"
unzip -q "$archive" -d "$stage"
test -f "$stage/$plugin_root/plugin.json"
test -f "$stage/$plugin_root/dist/index.js"
sudo -v
sudo rm -rf -- "$install"
sudo mv -- "$stage/$plugin_root" "$install"
sudo chown -R deck:deck -- "$install"
sudo systemctl restart plugin_loader.service
sleep 2
sudo chown -R deck:deck -- "$install"
test "$(systemctl is-active plugin_loader.service)" = active
echo "Deck is ready to test"
REMOTE
)"
printf -v remote_command 'bash -c %q -- %q %q %q %q' \
"$remote_script" "$remote_archive" "$remote_stage" "$install_path" "$plugin_root"
ssh -tt "$deck_host" "$remote_command"
|