From 57815bdcc527473455070a8f3f8b5ade87071eef Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Thu, 25 Jan 2024 17:46:07 -0600 Subject: [PATCH] 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. --- flash.zsh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/flash.zsh b/flash.zsh index 4a20336..a335836 100755 --- a/flash.zsh +++ b/flash.zsh @@ -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)