cmd-run: merge, don't replace config from -i
We pretty much always want the bits that cmd-run adds, regardless of
whether we are specifying a config or not. Make -i specify a config to
merge instead.
@@ -26,7 +26,7 @@ USAGE="Usage: $0 [-d /path/to/disk.qcow2] [--] [qemu options...]
Options:
-d DISK Root disk drive (won't be changed by default)
--persist-to-img IMG Persist changes to a separate image
- -i FILE File containing an Ignition config
+ -i FILE File containing an Ignition config to merge into the default config
--srv src Mount (via 9p) src on the host as /var/srv in guest
-m MB RAM size in MB (2048)
--size GB Disk size in GB (matches base by default)
@@ -132,7 +132,19 @@ else
ign_var_srv_mount=""
fi
-if [ -z "${IGNITION_CONFIG_FILE:-}" ]; then
+if [ -n "${IGNITION_CONFIG_FILE:-}" ]; then
+ user_config=$(base64 --wrap 0 "${IGNITION_CONFIG_FILE}")
+ user_config=$(cat << EOF
+,"config": {
+ "merge": [{
+ "source": "data:text/plain;base64,$user_config"
+ }]
+}
+EOF
+ )
+else
+ user_config=""
+fi
coreos_assembler_sysctl=$(cat << 'EOF' | base64 --wrap 0
# Written during `coreos-assembler run`.
@@ -155,7 +167,7 @@ EOF
cat > "${f}" <<EOF
{
"ignition": {
- "version": "3.0.0"
+ "version": "3.0.0"${user_config}
},
"storage": {
"files": [
@@ -204,7 +216,6 @@ EOF
jq . < "${IGNITION_CONFIG_FILE}"
exit 1
fi
-fi
if [ -z "${VM_PERSIST_IMG}" ]; then
VM_IMG=$(mktemp -p "${TMPDIR:-/var/tmp}")
