From afadd7dcf5ec665ea05f5f40de178c243363cb7b Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 17 Jul 2023 15:17:22 -0500 Subject: [PATCH] Add flash.sh This simple script helps automate the process of flashing Fedora CoreOS onto a SD card for a Raspberry Pi. --- flash.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 flash.sh diff --git a/flash.sh b/flash.sh new file mode 100644 index 0000000..53f3e96 --- /dev/null +++ b/flash.sh @@ -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