2023-05-16 20:43:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
temp_yml() {
|
|
|
|
mktemp --suffix=.yml
|
|
|
|
}
|
|
|
|
|
|
|
|
gen_files() {
|
|
|
|
./gen_files_yml.sh >"$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
update_files_from() {
|
2023-05-17 06:14:40 +00:00
|
|
|
SRC="$2" yq -i '.autoinstall.user-data.write_files |= load(strenv(SRC)).write_files' "$1"
|
|
|
|
}
|
|
|
|
|
|
|
|
remove_trailing_whitespace() {
|
|
|
|
sed -i 's/[ \t]*$//' "$1"
|
2023-05-16 20:43:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pushd config >/dev/null 2>&1
|
|
|
|
|
2023-05-17 06:14:40 +00:00
|
|
|
TARGET_YML="nocloud/user-data"
|
2023-05-16 20:43:02 +00:00
|
|
|
TMP_YML=$(temp_yml)
|
2023-05-17 06:14:40 +00:00
|
|
|
|
2023-05-16 20:43:02 +00:00
|
|
|
gen_files "$TMP_YML"
|
2023-05-17 06:14:40 +00:00
|
|
|
remove_trailing_whitespace "$TARGET_YML"
|
|
|
|
update_files_from "$TARGET_YML" "$TMP_YML"
|
2023-05-16 20:43:02 +00:00
|
|
|
rm -f "$TMP_YML"
|
|
|
|
|
|
|
|
popd >/dev/null 2>&1
|