From 09bed31f06a7f78fdf316b0fc3d9206a809d884d Mon Sep 17 00:00:00 2001 From: finn Date: Sun, 27 Sep 2026 17:12:21 -0700 Subject: [PATCH] added stackscript viewer --- create-linode.sh | 2 +- ss-info.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 ss-info.sh diff --git a/create-linode.sh b/create-linode.sh index 9b88bad..9efa18e 100755 --- a/create-linode.sh +++ b/create-linode.sh @@ -160,7 +160,7 @@ if [[ "$SCRIPT_ACTION" == "d" && -n "$LINODE_LABEL" ]]; then # Shut the Linode down cleanly before deleting it, so systemd stops the # Docker container and the Valheim server gets the chance to save the world # rather than being cut off mid-write. - echo "Soft Shutting down ID:$INSTANCE_ID..." + echo "Soft Shutting down ID:$INSTANCE_ID... Blocking 30s for docker..." curl -s -H "Authorization: Bearer $LINODE_API_KEY" \ -X POST https://api.linode.com/v4/linode/instances/$INSTANCE_ID/shutdown | jq . diff --git a/ss-info.sh b/ss-info.sh new file mode 100755 index 0000000..108a0b1 --- /dev/null +++ b/ss-info.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Display the StackScript used to provision the Valheim Linode. +# Sourcing create-linode.sh (with no positional parameters) loads STACKSCRIPT_ID +# and the .env values it depends on, without running any of its actions. + +# Drop any arguments passed to this script. "source" inherits the caller's +# positional parameters, so leaving them in place could make create-linode.sh +# run an action (e.g. create or destroy) instead of just defining variables. +set -- + +# With no action argument create-linode.sh only prints its help text; that is +# not relevant here, so discard it. +source ./create-linode.sh >/dev/null + +if [[ -z "$LINODE_API_KEY" ]]; then + echo "ERROR: LINODE_API_KEY is not set; check .env." >&2 + exit 1 +fi + +if [[ -z "$STACKSCRIPT_ID" ]]; then + echo "ERROR: STACKSCRIPT_ID is not set in create-linode.sh." >&2 + exit 1 +fi + +curl -s -H "Authorization: Bearer $LINODE_API_KEY" \ + https://api.linode.com/v4/linode/stackscripts/$STACKSCRIPT_ID | jq -r .script