-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrelease-stable-from-testing.sh
More file actions
executable file
·61 lines (50 loc) · 1.54 KB
/
release-stable-from-testing.sh
File metadata and controls
executable file
·61 lines (50 loc) · 1.54 KB
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
#!/usr/bin/env bash
set -euo pipefail
# Promote firmware from testing -> stable by downloading from espargos.net.
# This script writes into site/content/firmware/stable.
BASE_URL="${BASE_URL:-https://espargos.net/firmware}"
SOURCE_CHANNEL="${SOURCE_CHANNEL:-testing}"
TARGET_CHANNEL="${TARGET_CHANNEL:-stable}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FIRMWARE_ROOT="$SCRIPT_DIR/site/content/firmware"
TARGET_DIR="$FIRMWARE_ROOT/$TARGET_CHANNEL"
FILES=(
"espargos-sensor-artifact.json"
"espargos-controller-artifact.json"
"espargos-sensor-firmware.bin"
"sensor-firmware-partition.bin"
"espargos-controller-firmware.bin"
"espargos-controller-assets.bin"
"espargos-controller-recovery.bin"
)
if ! command -v curl >/dev/null 2>&1; then
echo "Error: curl is required but not installed." >&2
exit 1
fi
TMP_DIR="$(mktemp -d)"
cleanup() {
rm -rf "$TMP_DIR"
}
trap cleanup EXIT
mkdir -p "$TARGET_DIR"
echo "Promoting firmware from '$SOURCE_CHANNEL' to '$TARGET_CHANNEL'"
echo "Source: $BASE_URL/$SOURCE_CHANNEL"
echo "Target: $TARGET_DIR"
echo
for file in "${FILES[@]}"; do
src="$BASE_URL/$SOURCE_CHANNEL/$file"
dst="$TMP_DIR/$file"
echo "Downloading: $src"
curl --fail --location --silent --show-error --retry 3 --retry-all-errors \
--output "$dst" "$src"
done
for file in "${FILES[@]}"; do
install -m 0644 "$TMP_DIR/$file" "$TARGET_DIR/$file"
done
echo
echo "Done. Stable channel was updated with:"
for file in "${FILES[@]}"; do
echo " - $TARGET_CHANNEL/$file"
done
echo
echo "Next step: review and commit changes."