Skip to content

Commit

Permalink
yukina: fix bash's word splitting issue for FILTER and EXTRA args
Browse files Browse the repository at this point in the history
with xargs trick introduced by https://superuser.com/a/1529316.
  • Loading branch information
taoky committed Mar 31, 2024
1 parent 155497e commit 181d5e4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion yukina/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,23 @@ fi

export NO_COLOR=1

# handling with xargs trick
# https://github.com/ustclug/ustcmirror-images/issues/111

filter_array=()
while IFS= read -r -d '' arg; do
filter_array+=("$arg")
done < <(echo "$YUKINA_FILTER" | xargs printf "%s\0")
extra_array=()
while IFS= read -r -d '' arg; do
extra_array+=("$arg")
done < <(echo "$YUKINA_EXTRA" | xargs printf "%s\0")

exec yukina --name "$REPO" \
--log-path "/nginx-log" \
--repo-path "$TO" \
--size-limit "$YUKINA_SIZE_LIMIT" \
--url "$UPSTREAM" \
--remote-sizedb "$TO/.yukina-remote.db" \
--local-sizedb "$TO/.yukina-local.db" \
$YUKINA_FILTER $YUKINA_EXTRA
"${filter_array[@]}" "${extra_array[@]}"

0 comments on commit 181d5e4

Please sign in to comment.