ubuntu1c-autoinstall/config/update_files.sh

30 lines
497 B
Bash
Executable File

#!/bin/bash
temp_yml() {
mktemp --suffix=.yml
}
gen_files() {
./gen_files_yml.sh >"$1"
}
update_files_from() {
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"
remove_trailing_whitespace "$TARGET_YML"
update_files_from "$TARGET_YML" "$TMP_YML"
rm -f "$TMP_YML"
popd >/dev/null 2>&1