From 0687b38e38fdd7eaab1ffb8bab2415312b17ba8b Mon Sep 17 00:00:00 2001 From: Grische <2787581+grische@users.noreply.github.com> Date: Wed, 10 Jan 2024 19:19:12 +0100 Subject: [PATCH 1/3] firmware-downloader: add "---" to manifests --- github-downloader/firmware-downloader | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github-downloader/firmware-downloader b/github-downloader/firmware-downloader index 217d228..1447ab5 100755 --- a/github-downloader/firmware-downloader +++ b/github-downloader/firmware-downloader @@ -58,6 +58,8 @@ then do tail -n +5 "$manifest" >> "extracted/$branch" done + # Add --- to easily add signatures below + echo '---' >> "extracted/$branch" done mkdir -p "$FIRMWARE_DIR" cp -r extracted/*/debug extracted/*/images/* extracted/*/packages "$FIRMWARE_DIR"/ From 9706d17a897e952b6e1fe4891db268c48ce2ffff Mon Sep 17 00:00:00 2001 From: Grische <2787581+grische@users.noreply.github.com> Date: Wed, 10 Jan 2024 19:29:57 +0100 Subject: [PATCH 2/3] firmware-downloader: make shellcheck happy --- github-downloader/firmware-downloader | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/github-downloader/firmware-downloader b/github-downloader/firmware-downloader index 1447ab5..a2f99b7 100755 --- a/github-downloader/firmware-downloader +++ b/github-downloader/firmware-downloader @@ -2,11 +2,12 @@ set -eEu shopt -s nullglob # required for downloads that have no "debug" artifacts +set -o pipefail # to capture errors of jq when there is a grep after SITE=${2:-ffm} -if [ "${SITE}" = "ffm" ]; then +if [[ "${SITE}" == "ffm" ]]; then base_url=https://api.github.com/repos/freifunkMUC/site-ffm -elif [ "${SITE}" = "ffdon" ]; then +elif [[ "${SITE}" == "ffdon" ]]; then base_url=https://api.github.com/repos/freifunkMUC/sites-ffdon else echo "Unknown site ${SITE}. Aborting." @@ -14,7 +15,7 @@ else fi TAG=${1:-latest} -if [ "${TAG}" = "latest" ]; then +if [[ "${TAG}" == "latest" ]]; then TAG=$(curl -s "${base_url}/releases/latest" | jq .tag_name | tr -d \") echo "Latest tag is $TAG" fi @@ -22,7 +23,7 @@ fi TAG_ID=$(curl -s "${base_url}/releases" | jq '.[] | "\(.tag_name) \(.id)"' | grep \""${TAG}"\ | cut -d" " -f2 | sed 's/"//g') URLS=$(curl -s "${base_url}/releases/${TAG_ID}" | jq '.assets[].browser_download_url' | tr -d \") -if [ "${SITE}" = "ffm" ]; then +if [[ "${SITE}" == "ffm" ]]; then FIRMWARE_DIR=/srv/www/firmware.ffmuc.net/$TAG TEMP_DIR=/tmp/firmware/$TAG else @@ -30,13 +31,13 @@ else TEMP_DIR="/tmp/firmware/${SITE}/${TAG}" fi -if [ -d "$TEMP_DIR" ] +if [[ -d "$TEMP_DIR" ]] then # cleanup old tempdirs echo "Cleaning old temporary directory" rm -r "$TEMP_DIR" fi -if [ ! -d "$FIRMWARE_DIR" ]; +if [[ ! -d "$FIRMWARE_DIR" ]] then echo "Downloading firmware with tag $TAG" mkdir -p "$TEMP_DIR/extracted" From 40f126da50ab588d2dfbc59203b13313beb4e139 Mon Sep 17 00:00:00 2001 From: Grische <2787581+grische@users.noreply.github.com> Date: Fri, 26 Jan 2024 20:22:38 +0100 Subject: [PATCH 3/3] firmware-legacy-merger: add "---" to manifests --- github-downloader/firmware-legacy-merger | 3 +++ 1 file changed, 3 insertions(+) diff --git a/github-downloader/firmware-legacy-merger b/github-downloader/firmware-legacy-merger index 98b78b1..66efd8c 100755 --- a/github-downloader/firmware-legacy-merger +++ b/github-downloader/firmware-legacy-merger @@ -43,6 +43,9 @@ function merge_manifests() { # merge both files, ignoring all but the first entry ("-u") for a specific model ("-k1,1") sort -u -k1,1 "${tempdir}/$branch.models" >> "${tempdir}/$branch" + # Add --- to easily add signatures below + echo '---' >> "${tempdir}/$branch" + echo "Merged $branch". done }