
echo "Not using this presently as the trixie updates were merged into master"
exit

# Download EEPROM firmware
#
# 1. https://www.raspberrypi.com/software/operating-systems/
#    Check which version of Debian the RPiOS is based on,
# 2. View https://github.com/raspberrypi/rpi-eeprom/branches
#
# Temporary measure since the rpi's last release of the EEPROM
# firmware is old, yet the release for trixie has more uptodate
# firmware for the "latest" stream.

# Check here for latest updates:
# https://github.com/raspberrypi/rpi-eeprom/branches

# This downloads the latest branch that the RPiOS uses, and
# omits the last commit date.
BRANCH=trixie

TMP=/tmp/trixie-rpi
rm -rf $TMP
mkdir -p $TMP
cd $TMP
git clone https://github.com/raspberrypi/rpi-eeprom.git
cd rpi-eeprom
git fetch origin
git checkout pios/${BRANCH}
git pull
git_date="v$( git log -1 --date=format:%Y.%m.%d --format=%cd )"
echo "Last commit: $( git log -1 --format=%cd --date=human )"
# Clean up:
rm -rf debian test/ imager/ releases.md firmware/release-notes.md
find . -name '.git*' -print0 | xargs -0 rm -rf
# We don't need to ship old firmware:
find . -name old -type d -print0 | xargs -0 rm -rf
echo "Packing.."
tar -Ixz -cf /tmp/rpi-eeprom-fw-${git_date}.tar.xz .
echo "File: tmp/rpi-eeprom-fw-${git_date}.tar.xz"
