Skip to content

Commit e888034

Browse files
committed
flatcar-install: add option to download ignition file with url
1 parent 8bd8a82 commit e888034

File tree

1 file changed

+37
-25
lines changed

1 file changed

+37
-25
lines changed

bin/flatcar-install

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,30 @@ fi
8686
8787
USAGE="Usage: $0 {{-d <device>}|-s} [options]
8888
Options:
89-
-d DEVICE Install Flatcar Container Linux to the given device.
90-
-D Download a Flatcar Container Linux image to the current directory, without installing it
91-
-s EXPERIMENTAL: Install Flatcar Container Linux to the smallest unmounted disk found
92-
(min. size 10GB). It is recommended to use it with -e or -I to filter the
93-
block devices by their major numbers. E.g., -e 7 to exclude loop devices
94-
or -I 8,259 for certain disk types. Read more about the numbers here:
95-
https://www.kernel.org/doc/Documentation/admin-guide/devices.txt.
96-
-V VERSION Version to install (e.g. current, or current-2022 for the LTS 2022 stream) [default: ${VERSION_ID}].
97-
-B BOARD Flatcar Container Linux board to use [default: ${BOARD}].
98-
-C CHANNEL Release channel to use (e.g. beta) [default: ${CHANNEL_ID}].
99-
-I|e <M,..> EXPERIMENTAL (used with -s): List of major device numbers to in-/exclude
100-
when finding the smallest disk.
101-
-o OEM OEM type to install (e.g. 'ami' or '' to force none), using flatcar_production_<OEM>_image.bin.bz2 [default: ${OEM_ID:-(none, i.e., the empty string)}].
102-
-c CLOUD Insert a cloud-init config to be executed on boot.
103-
-i IGNITION Insert an Ignition config to be executed on boot.
104-
-b BASEURL URL to the image mirror (overrides BOARD and CHANNEL).
105-
-k KEYFILE Override default GPG key for verifying image signature.
106-
-f IMAGE Install unverified local image file to disk instead of fetching.
107-
-n Copy generated network units to the root partition.
108-
-u Create UEFI boot entry
109-
-y Dry-run. Run some checks and print option settings.
110-
-v Super verbose, for debugging.
111-
-h This ;-).
89+
-d DEVICE Install Flatcar Container Linux to the given device.
90+
-D Download a Flatcar Container Linux image to the current directory, without installing it
91+
-s EXPERIMENTAL: Install Flatcar Container Linux to the smallest unmounted disk found
92+
(min. size 10GB). It is recommended to use it with -e or -I to filter the
93+
block devices by their major numbers. E.g., -e 7 to exclude loop devices
94+
or -I 8,259 for certain disk types. Read more about the numbers here:
95+
https://www.kernel.org/doc/Documentation/admin-guide/devices.txt.
96+
-V VERSION Version to install (e.g. current, or current-2022 for the LTS 2022 stream) [default: ${VERSION_ID}].
97+
-B BOARD Flatcar Container Linux board to use [default: ${BOARD}].
98+
-C CHANNEL Release channel to use (e.g. beta) [default: ${CHANNEL_ID}].
99+
-I|e <M,..> EXPERIMENTAL (used with -s): List of major device numbers to in-/exclude
100+
when finding the smallest disk.
101+
-o OEM OEM type to install (e.g. 'ami' or '' to force none), using flatcar_production_<OEM>_image.bin.bz2 [default: ${OEM_ID:-(none, i.e., the empty string)}].
102+
-c CLOUD Insert a cloud-init config to be executed on boot.
103+
-i IGNITION Insert an Ignition config to be executed on boot.
104+
-U IGNITIONURL Download an Ignition config to be executed on boot.
105+
-b BASEURL URL to the image mirror (overrides BOARD and CHANNEL).
106+
-k KEYFILE Override default GPG key for verifying image signature.
107+
-f IMAGE Install unverified local image file to disk instead of fetching.
108+
-n Copy generated network units to the root partition.
109+
-u Create UEFI boot entry
110+
-y Dry-run. Run some checks and print option settings.
111+
-v Super verbose, for debugging.
112+
-h This ;-).
112113
113114
This tool installs Flatcar Container Linux on a block device. If you PXE booted
114115
Flatcar Container Linux on a machine then use this tool to make a permanent install.
@@ -501,13 +502,14 @@ WXo7A5nj0plrH9Jn23wzGSTpf0QCApG55iOsKtrnvWTEGihjLFD9ccnMHb9AGQmG
501502
DEVICE=
502503
CLOUDINIT=
503504
IMAGE_FILE=
505+
IGNITION_URL=
504506
KEYFILE=
505507
VERSION_SUMMARY='Flatcar Container Linux'
506508
CREATE_UEFI=
507509
508510
WGET_ARGS="--tries 10 --timeout=20 --retry-connrefused"
509511
510-
while getopts "V:B:C:DI:d:o:c:e:i:t:b:k:f:nusyvh" OPTION
512+
while getopts "V:B:C:DI:d:o:c:e:i:U:t:b:k:f:nusyvh" OPTION
511513
do
512514
case $OPTION in
513515
V) VERSION_ID="$OPTARG"; VERSION_SPECIFIED=1 ;;
@@ -520,6 +522,7 @@ do
520522
c) CLOUDINIT="$OPTARG" ;;
521523
e) EXCLUDE_MAJOR="-e $OPTARG" ;;
522524
i) IGNITION="$OPTARG" ;;
525+
U) IGNITION_URL="$OPTARG" ;;
523526
t) ;; # compatibility option; previously set TMPDIR
524527
b) BASE_URL="${OPTARG%/}" ;;
525528
k) KEYFILE="$OPTARG" ;;
@@ -543,6 +546,7 @@ Settings:
543546
OEM: ${OEM_ID:-(none)}
544547
CLOUD: ${CLOUDINIT:-(none)}
545548
IGNITION: ${IGNITION:-(none)}
549+
IGNITION_URL: ${IGNITION_URL:-(none)}
546550
BASEURL: ${BASE_URL:-(none)}
547551
KEYFILE: ${KEYFILE:-(none)}
548552
IMAGE: ${IMAGE_FILE:-(none)}"
@@ -598,6 +602,14 @@ if [[ -z "${DOWNLOAD_ONLY}" ]]; then
598602
exit 1
599603
fi
600604
fi
605+
606+
if [[ -n "${IGNITION_URL}" ]]; then
607+
IGNITION=config.ign
608+
if ! wget ${WGET_ARGS} --quiet -O ${IGNITION} "${IGNITION_URL}"; then
609+
echo "$0: Ignition config url (${IGNITION_URL}) not found." >&2
610+
exit 1
611+
fi
612+
fi
601613
fi
602614
603615
if [[ -n "${DRY_RUN}" ]]; then
@@ -829,4 +841,4 @@ else
829841
fi
830842
831843
rm -rf "${WORKDIR}"
832-
trap - EXIT
844+
trap - EXIT

0 commit comments

Comments
 (0)