flash: Add option to specify image URL

The `flash.zsh` script now takes an optional `--image-url` argument,
which can be used to specify a different FCOS base image.  This could be
to use a custom image or to simply avoid downloading the same image from
the Internet repeatedly.
master
Dustin 2024-01-25 17:46:07 -06:00
parent eb0430392e
commit 57815bdcc5
1 changed files with 17 additions and 4 deletions

View File

@ -67,10 +67,15 @@ function hybridize_gpt() {
function install_coreos() {
local ignition="$1"
local dev="$2"
local url="$3"
coreos-installer install \
-a aarch64 \
-s stable \
if [ -z "${url}" ]; then
set -- -a aarch64 -s stable
else
set -- --image-url "${url}"
fi
coreos-installer install "$@" \
-i "${ignition}" \
--console ttyS0,115200n8 \
"${dev}"
@ -79,6 +84,7 @@ function install_coreos() {
function parse_args() {
pi=4
image_url=
while [ $# -gt 0 ]; do
case "$1" in
--pi)
@ -88,6 +94,13 @@ function parse_args() {
--pi=*)
pi=${1#--pi=}
;;
--image-url)
shift
image_url=${1}
;;
--image-url=*)
image_url=${1#--image-url=}
;;
*)
if [ -z "${ignition-}" ]; then
ignition="${1}"
@ -128,7 +141,7 @@ if [ $(id -u) -ne 0 ]; then
exec sudo "$0" "$@"
fi
install_coreos "${ignition}" "${dev}"
install_coreos "${ignition}" "${dev}" "${image_url}"
case "${pi}" in
2|3)