Skip to content

Commit

Permalink
update: fix matching values
Browse files Browse the repository at this point in the history
Signed-off-by: nachoparker <nacho@ownyourbits.com>
  • Loading branch information
nachoparker committed Nov 30, 2019
1 parent 310877f commit c42bcc1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,17 @@ for file in etc/ncp-config.d/*; do
[ -f /usr/local/"$file" ] && {
len="$(jq '.params | length' /usr/local/"$file")"
for (( i = 0 ; i < len ; i++ )); do
id="$(jq -r ".params[$i].id" /usr/local/"$file")"
val="$(jq -r ".params[$i].value" /usr/local/"$file")"
cfg="$(jq ".params[$i].value = \"$val\"" "$file")"

for (( j = 0 ; j < len ; j++ )); do
idnew="$(jq -r ".params[$j].id" "$file")"
[ "$idnew" == "$id" ] && {
cfg="$(jq ".params[$j].value = \"$val\"" "$file")"
break
}
done

echo "$cfg" > "$file"
done
}
Expand Down

0 comments on commit c42bcc1

Please sign in to comment.