Add flash.sh

This simple script helps automate the process of flashing Fedora CoreOS
onto a SD card for a Raspberry Pi.
master
Dustin 2023-07-17 15:17:22 -05:00
parent 9dc46e2eff
commit afadd7dcf5
1 changed files with 35 additions and 0 deletions

35
flash.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/sh
# vim: set sw=4 ts=4 sts=4 et :
set -eu
ignition=${1}
dev=${2:-/dev/disk/by-id/usb-Generic_STORAGE_DEVICE_000000001206-0:0}
if [ -z "${ignition}" ]; then
printf 'usage: %s ignition\n' "${0##*/}" >&2
exit 2
fi
if [ $(id -u) -ne 0 ]; then
sudo=sudo
fi
${sudo} coreos-installer install \
-a aarch64 \
-s stable \
-i "${ignition}" \
--console ttyS0,115200n8 \
"${dev}"
sync; sync; sync
until [ -n "${efi_part}" ]; do
efi_part=$(
lsblk -o LABEL,PATH \
| awk '$1=="EFI-SYSTEM"{print $2}'
)
done
pmount "${efi_part}" coreos-efi
rsync -ah --ignore-existing RPi4boot/boot/efi/ /media/coreos-efi/
sync; sync; sync
pumount coreos-efi