abuild: fix eval argument splitting and simplify

A newline starts a new command in shell scripts and eval uses the shell
grammar. Use a space instead to fix multiline repo templates.

Also avoid one subshell.
This commit is contained in:
Sertonix 2024-10-10 14:40:30 +02:00
parent 9c4abc561e
commit 1d9568b669

View File

@ -2366,9 +2366,9 @@ apk_add_makedeps() {
shift
repo_args="--repository $(shell_escape "$REPODEST/$repo")"
[ -s "$repo_template" ] && repo_args=$(while read r; do
printf %s\\n "--repository $(shell_escape "$REPODEST/${r##*/}")"
done) < "$repo_template"
[ -s "$repo_template" ] && while read r; do
repo_args="$repo_args --repository $(shell_escape "$REPODEST/${r##*/}")"
done < "$repo_template"
eval "$SUDO_APK" add "$apk_opt_wait" "$repo_args" \
--virtual .${prefix}depends-$pkgname "\$@" || return