From 3c56f77c2b03b6c0241f232089592f7320ad3ae6 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 17 May 2023 09:14:40 +0300 Subject: [PATCH] add remove_trailing_whitespace() --- config/update_files.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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