Skip to content

Commit

Permalink
sysupgrade: remove old release logic to match workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gtxaspec committed Nov 27, 2024
1 parent 4f489ed commit 58e326b
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions overlay/lower/usr/sbin/sysupgrade
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,6 @@ expand_bb() {
ln -s $workdir/busybox $workdir/$1
}

get_previous_release() {
curl -s https://api.github.com/repos/themactep/thingino-firmware/releases | \
jsonfilter -e '@[*].tag_name' | grep '^firmware-' | head -2 | tail -1
}

handle_payload() {
if [ "local" = "$upgrade" ]; then
say "Upgrading from a provided file"
Expand Down Expand Up @@ -113,18 +108,10 @@ handle_payload() {

check_free_space $bin_url $offset

say "Download firmware and checksum"
if ! download "$bin_url" "$bin_file" "-C $offset"; then
say "Latest firmware not found. Trying the previous release."
previous_release=$(get_previous_release)
[ -z "$previous_release" ] && die "Failed to retrieve the previous release tag."

bin_url="$gh_url/releases/download/$previous_release/thingino-$profile.bin"
sha_url="$gh_url/releases/download/$previous_release/$bin_file.sha256sum"

download "$bin_url" "$bin_file" "-C $offset" || die "Cannot download firmware from fallback URL."
fi

#\n- $bin_url\n- $sha_url"
say "Downloading firmware from:\n$bin_url"
download "$bin_url" "$bin_file" "-C $offset" || die "Cannot download firmware from specified URL."
say "Downloading checksum from:\n$sha_url"
download "$sha_url" "$sha_file" || die "Cannot download checksum file."

say "Verifying downloaded file"
Expand Down

0 comments on commit 58e326b

Please sign in to comment.