-
Notifications
You must be signed in to change notification settings - Fork 179
Add mirror-clone.sh wrapper for sjtug/mirror-clone #200
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| _here=$(dirname "$(realpath "$0")") | ||
| mirror_clone="${MIRRORCLONE_BIN:-${_here}/mirror-clone}" | ||
|
|
||
| TUNASYNC_MIRRORCLONE_OPTIONS=${TUNASYNC_MIRRORCLONE_OPTIONS:-} | ||
| TUNASYNC_MIRRORCLONE_SOURCE=${TUNASYNC_MIRRORCLONE_SOURCE:-} | ||
| TUNASYNC_MIRRORCLONE_ARGS=${TUNASYNC_MIRRORCLONE_ARGS:-} | ||
|
|
||
| if [ -z "$TUNASYNC_MIRRORCLONE_SOURCE" ]; then | ||
| echo "Error: TUNASYNC_MIRRORCLONE_SOURCE is not set" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| [ ! -d "${TUNASYNC_WORKING_DIR}" ] && mkdir -p "${TUNASYNC_WORKING_DIR}" | ||
| cd "${TUNASYNC_WORKING_DIR}" | ||
|
|
||
| exec "$mirror_clone" \ | ||
| --target-type file \ | ||
| --file-buffer-path "${TUNASYNC_WORKING_DIR}/.tmp" \ | ||
| --file-base-path "${TUNASYNC_WORKING_DIR}" \ | ||
| $TUNASYNC_MIRRORCLONE_OPTIONS \ | ||
| "$TUNASYNC_MIRRORCLONE_SOURCE" \ | ||
| $TUNASYNC_MIRRORCLONE_ARGS | ||
|
Comment on lines
+24
to
+26
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The unquoted expansion is intentional: it lets per-mirror configs pass multiple positional flags through |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the convention used by other scripts in this repo (chef.sh/cvmfs.sh/termux.sh) — they all dereference
TUNASYNC_WORKING_DIRdirectly and rely on the tunasync framework to set it. Keeping consistent with that.