summary refs log tree commit diff
path: root/fetch-current.sh
diff options
context:
space:
mode:
Diffstat (limited to 'fetch-current.sh')
-rwxr-xr-xfetch-current.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/fetch-current.sh b/fetch-current.sh
new file mode 100755
index 0000000..b8cad93
--- /dev/null
+++ b/fetch-current.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -euxo pipefail
+
+script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
+temp_dir=$(mktemp -d)
+trap 'rm -rf -- "$temp_dir"' EXIT
+
+candidate=$(curl -fLsS https://steamdeck-atomupd.steamos.cloud/meta/steamos/amd64/snapshot/steamdeck.json \
+    | jq '(.major.candidates + .minor.candidates)[0]')
+
+curl -fLSo "$temp_dir/bundle.raucb" \
+    "https://steamdeck-images.steamos.cloud/$(jq -r .update_path <<<"$candidate")"
+rauc extract --keyring="$script_dir/valve-rauc-keyring.pem" --trust-environment "$temp_dir/bundle.raucb" "$temp_dir/bundle"
+
+output_path=steamdeck-$(jq -r .image.buildid <<<"$candidate")-$(jq -r .image.version <<<"$candidate").img
+casync extract \
+    --store="https://steamdeck-images.steamos.cloud/$(jq -r .update_path <<<"$candidate" | sed -e 's/\.raucb$/.castr/')" \
+    "$temp_dir/bundle/rootfs.img.caibx" "$output_path"
+echo "$output_path"