diff --git a/config/update_files.sh b/config/update_files.sh index 4f45939..82c8c8b 100755 --- a/config/update_files.sh +++ b/config/update_files.sh @@ -9,14 +9,21 @@ gen_files() { } update_files_from() { - SRC=$1 yq -i '.autoinstall.user-data.write_files |= load(strenv(SRC)).write_files' nocloud/user-data + SRC="$2" yq -i '.autoinstall.user-data.write_files |= load(strenv(SRC)).write_files' "$1" +} + +remove_trailing_whitespace() { + sed -i 's/[ \t]*$//' "$1" } pushd config >/dev/null 2>&1 +TARGET_YML="nocloud/user-data" TMP_YML=$(temp_yml) + gen_files "$TMP_YML" -update_files_from "$TMP_YML" +remove_trailing_whitespace "$TARGET_YML" +update_files_from "$TARGET_YML" "$TMP_YML" rm -f "$TMP_YML" popd >/dev/null 2>&1