#!/usr/bin/env bash # BlueSCSI - Copyright (c) 2025 Eric Helgeson # # BlueSCSI file is licensed under the GPL version 3 or any later version. # # https://www.gnu.org/licenses/gpl-3.0.html # ---- # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . SCRIPT_DIR=$(dirname "$(readlink -f "$0")") cd "$SCRIPT_DIR/.." || exit 1 OUT_DIR=./dist mkdir -p $OUT_DIR || exit 1 DATE=$(date +%Y-%m-%d) VERSION=$(git rev-parse --short HEAD) for file in .pio/build/*/firmware.bin .pio/build/*/firmware.elf .pio/build/*/firmware.uf2 do BUILD_ENV=$(echo "$file" | cut -d'/' -f3) if [[ "$BUILD_ENV" == *"Pico_2"* ]]; then BOARD="Pico2" elif [[ "$BUILD_ENV" == *"Pico"* ]]; then BOARD="Pico1" else echo "Warning: Could not determine board for $file" continue fi VARIANT="" if [[ "$BUILD_ENV" == *"DaynaPORT"* ]]; then VARIANT="-DaynaPORT" fi EXT="${file##*.}" RENAME="BlueSCSI-${BOARD}${VARIANT}-${DATE}-${VERSION}.${EXT}" echo "$file to $OUT_DIR/$RENAME" cp "$file" "$OUT_DIR/$RENAME" done # Make a zip file with all the pico1 and pico2 files together by variant such as DaynaPORT #zip -j "dist/BlueSCSI-Universal-DaynaPORT-${DATE}-${VERSION}.zip" dist/BlueSCSI-Pico*-DaynaPORT-${DATE}-${VERSION}.* #find dist/ -maxdepth 1 -type f -name "BlueSCSI-Pico*-${DATE}-${VERSION}.*" ! -name "*-DaynaPORT-*" -print0 | xargs -0 zip -j "dist/BlueSCSI-Universal-${DATE}-${VERSION}.zip"