Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build.sh): export get_config_value and set_config_value to make ublue-update installer work #149

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,22 @@ MODULE_DIRECTORY="/tmp/modules"

# https://mikefarah.gitbook.io/yq/usage/tips-and-tricks#yq-in-a-bash-loop
get_yaml_array() {
# creates array $1 with content at key $2 from $3
# creates array $1 with content at key $2 from $3
readarray "$1" < <(echo "$3" | yq -I=0 "$2")
}

get_config_value() {
sed -n '/^'"$1"'=/{s/'"$1"'=//;p}'
}

set_config_value() {
CURRENT=$(get_config_value $1 $3)
sed -i 's/'"$1"'='"$CURRENT"'/'"$1"'='"$2"'/g' $3
}

export -f get_yaml_array # this makes the function available to all modules
export -f get_config_value
export -f set_config_value

# Declare dynamically generated variables as exported
declare -x IMAGE_NAME BASE_IMAGE OS_VERSION
Expand Down