feat(installer): use ed for config update (#2013)

This commit is contained in:
Jonas L 2022-08-01 14:37:19 +02:00 committed by GitHub
parent 6df1087abc
commit 5367bc8d61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

11
install
View File

@ -234,14 +234,15 @@ set_config() {
value="${1}" && shift value="${1}" && shift
# Build sed query # Build sed query
query="/^${1}:/" query="/^${1}:/\n"
while [[ $# -gt 1 ]]; do while [[ $# -gt 1 ]]; do
shift shift
query="${query},/${1}:/" query+="/${1}:/\n"
done done
query="${query} s|(${1}:).*|\1 ${value}|" query+="s|\(${1}:\).*|\1 ${value}|\n"
query+="wq"
sed --regexp-extended --in-place "$query" "$CONFIG_TMP_FILEPATH" echo -e "$query" | ed --quiet "$CONFIG_TMP_FILEPATH" > /dev/null
} }
# install_python_app <path> # install_python_app <path>
@ -382,7 +383,7 @@ section "Prepare"
prepare_packages_install prepare_packages_install
install_packages git make install_packages git make ed
make VERSION make VERSION
info "creating project user" info "creating project user"