diff --git a/apt-sync/pre-sync.sh b/apt-sync/pre-sync.sh new file mode 100755 index 0000000..4171ea6 --- /dev/null +++ b/apt-sync/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "$APTSYNC_URL" diff --git a/aptsync/pre-sync.sh b/aptsync/pre-sync.sh index 8b31b81..efb7494 100755 --- a/aptsync/pre-sync.sh +++ b/aptsync/pre-sync.sh @@ -1,5 +1,7 @@ #!/bin/bash +set_upstream "$APTSYNC_URL" + get_hostname() { sed -re 's|[^/]*//([^@]*@)?([^:/]*).*|\2|' <<< "$1" } diff --git a/archvsync/pre-sync.sh b/archvsync/pre-sync.sh index 85a5c02..69ebfd4 100755 --- a/archvsync/pre-sync.sh +++ b/archvsync/pre-sync.sh @@ -1,5 +1,7 @@ #!/bin/bash +set_upstream "rsync://$RSYNC_HOST/$RSYNC_PATH" + # override the `killer` func in entry.sh killer() { kill -- "$1" diff --git a/base/Dockerfile.alpine b/base/Dockerfile.alpine index ab79a2f..46c8ec1 100644 --- a/base/Dockerfile.alpine +++ b/base/Dockerfile.alpine @@ -6,7 +6,7 @@ RUN <" >&2 + exit 1 +fi + +if [ -z "$LOGDIR" ]; then + echo "LOGDIR environment variable is not set" >&2 + exit 1 +fi + +# Avoid leaving empty file in case of being interrupted +echo "$1" > "$LOGDIR/yuki_upstream.txt.new" +mv "$LOGDIR/yuki_upstream.txt.new" "$LOGDIR/yuki_upstream.txt" +echo "Upstream set to: $1" diff --git a/crates-io-index/pre-sync.sh b/crates-io-index/pre-sync.sh new file mode 100755 index 0000000..7bbe3dc --- /dev/null +++ b/crates-io-index/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "https://github.com/rust-lang/crates.io-index" diff --git a/debian-cd/pre-sync.sh b/debian-cd/pre-sync.sh index f939098..d923f3f 100755 --- a/debian-cd/pre-sync.sh +++ b/debian-cd/pre-sync.sh @@ -1,5 +1,7 @@ #!/bin/bash +set_upstream "rsync://$RSYNC_HOST/$RSYNC_MODULE" + # override the `killer` func in entry.sh killer() { kill -- "$1" diff --git a/docker-ce/pre-sync.sh b/docker-ce/pre-sync.sh new file mode 100755 index 0000000..d3b6d3c --- /dev/null +++ b/docker-ce/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "https://download.docker.com/" diff --git a/fedora/pre-sync.sh b/fedora/pre-sync.sh index bd1f5b1..f0adf45 100755 --- a/fedora/pre-sync.sh +++ b/fedora/pre-sync.sh @@ -1,5 +1,11 @@ #!/bin/bash +if [[ -z "$REMOTE" ]]; then + set_upstream "rsync://dl.fedoraproject.org" +else + set_upstream "$REMOTE/$MODULE" +fi + _CONF_FILE='/etc/quick-fedora-mirror.conf' LOGDIR="${LOGDIR%%/}" diff --git a/flatpak/pre-sync.sh b/flatpak/pre-sync.sh new file mode 100755 index 0000000..42990de --- /dev/null +++ b/flatpak/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "https://dl.flathub.org/repo/" diff --git a/freebsd-pkg/pre-sync.sh b/freebsd-pkg/pre-sync.sh new file mode 100755 index 0000000..5529519 --- /dev/null +++ b/freebsd-pkg/pre-sync.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +FBSD_PKG_UPSTREAM=${FBSD_PKG_UPSTREAM:-"http://pkg.freebsd.org"} + +set_upstream "$FBSD_PKG_UPSTREAM" diff --git a/freebsd-ports/pre-sync.sh b/freebsd-ports/pre-sync.sh new file mode 100755 index 0000000..948589f --- /dev/null +++ b/freebsd-ports/pre-sync.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +FBSD_PORTS_DISTFILES_UPSTREAM=${FBSD_PORTS_DISTFILES_UPSTREAM:-"http://distcache.freebsd.org/ports-distfiles"} + +set_upstream "$FBSD_PORTS_DISTFILES_UPSTREAM" diff --git a/ghcup/pre-sync.sh b/ghcup/pre-sync.sh new file mode 100755 index 0000000..4595539 --- /dev/null +++ b/ghcup/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "https://www.haskell.org/ghcup/" diff --git a/github-release/pre-sync.sh b/github-release/pre-sync.sh new file mode 100755 index 0000000..105f2f4 --- /dev/null +++ b/github-release/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "https://github.com/" diff --git a/gitsync/pre-sync.sh b/gitsync/pre-sync.sh new file mode 100755 index 0000000..1deb377 --- /dev/null +++ b/gitsync/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "$GITSYNC_URL" diff --git a/google-repo/pre-sync.sh b/google-repo/pre-sync.sh index db6c6b6..1e85dc9 100755 --- a/google-repo/pre-sync.sh +++ b/google-repo/pre-sync.sh @@ -1,5 +1,9 @@ #!/bin/sh +UPSTREAM="${UPSTREAM:-https://android.googlesource.com/mirror/manifest}" + +set_upstream "$UPSTREAM" + # Alpine's ssh does not seem to like the idea # when UID 1000 user is not in /etc/passwd. # Otherwise, `ssh -V` will not be executed successfully. diff --git a/gsutil-rsync/pre-sync.sh b/gsutil-rsync/pre-sync.sh index 91c0df9..22b26f4 100755 --- a/gsutil-rsync/pre-sync.sh +++ b/gsutil-rsync/pre-sync.sh @@ -1,4 +1,6 @@ #!/bin/bash +set_upstream "$GS_URL" + mkdir -p /.gsutil chown -R "$OWNER" /.gsutil diff --git a/hackage/pre-sync.sh b/hackage/pre-sync.sh new file mode 100755 index 0000000..fad71e5 --- /dev/null +++ b/hackage/pre-sync.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +HACKAGE_BASE_URL=${HACKAGE_BASE_URL:-https://hackage.haskell.org/} +set_upstream "$HACKAGE_BASE_URL" diff --git a/homebrew-bottles/pre-sync.sh b/homebrew-bottles/pre-sync.sh new file mode 100755 index 0000000..c74d892 --- /dev/null +++ b/homebrew-bottles/pre-sync.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +HOMEBREW_BOTTLE_DOMAIN=${HOMEBREW_BOTTLE_DOMAIN:-https://ghcr.io/v2/homebrew/} +set_upstream "$HOMEBREW_BOTTLE_DOMAIN" diff --git a/julia-storage/pre-sync.sh b/julia-storage/pre-sync.sh index fec33a9..da23d3b 100755 --- a/julia-storage/pre-sync.sh +++ b/julia-storage/pre-sync.sh @@ -3,6 +3,8 @@ # But by default, we use 1000:1000 and it has no home folder. # This script helps create a user with a home folder corresponding to $OWNER. +set_upstream "https://us-east.storage.juliahub.com, https://kr.storage.juliahub.com" + SYNC_UID=$(echo "$OWNER" | cut -d ':' -f 1) SYNC_GID=$(echo "$OWNER" | cut -d ':' -f 2) diff --git a/lftpsync/pre-sync.sh b/lftpsync/pre-sync.sh new file mode 100755 index 0000000..37420ca --- /dev/null +++ b/lftpsync/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "$LFTPSYNC_HOST/$LFTPSYNC_PATH" diff --git a/nix-channels/pre-sync.sh b/nix-channels/pre-sync.sh new file mode 100755 index 0000000..cff15d7 --- /dev/null +++ b/nix-channels/pre-sync.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +NIX_MIRROR_UPSTREAM=${NIX_MIRROR_UPSTREAM:-https://nixos.org/channels/} + +set_upstream "$NIX_MIRROR_UPSTREAM" diff --git a/pypi/pre-sync.sh b/pypi/pre-sync.sh index 150ec33..383139f 100755 --- a/pypi/pre-sync.sh +++ b/pypi/pre-sync.sh @@ -1,5 +1,7 @@ #!/bin/bash +set_upstream "https://pypi.python.org" + cat << EOF > /etc/bandersnatch.conf [mirror] directory = $TO diff --git a/rclone/pre-sync.sh b/rclone/pre-sync.sh new file mode 100755 index 0000000..58ec9f1 --- /dev/null +++ b/rclone/pre-sync.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +remote_type="$RCLONE_CONFIG_REMOTE_TYPE" +path="$RCLONE_PATH" +domain="" + +case "$remote_type" in + "swift") + domain="$RCLONE_SWIFT_STORAGE_URL/" + ;; + "http") + domain="$RCLONE_CONFIG_REMOTE_URL" + ;; + "s3") + domain="$RCLONE_CONFIG_REMOTE_ENDPOINT" + ;; + "webdav") + domain="$RCLONE_CONFIG_REMOTE_URL" + ;; +esac + +set_upstream "${domain}${path}" diff --git a/rsync/pre-sync.sh b/rsync/pre-sync.sh new file mode 100755 index 0000000..1efb562 --- /dev/null +++ b/rsync/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +set_upstream "rsync://$RSYNC_HOST/$RSYNC_PATH" diff --git a/rubygems-dynamic/pre-sync.sh b/rubygems-dynamic/pre-sync.sh new file mode 100755 index 0000000..061bc42 --- /dev/null +++ b/rubygems-dynamic/pre-sync.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set_upstream "http://rubygems.org/" + +mkdir -p "$HOME/.gem" +chown -R "$OWNER" "$HOME" diff --git a/rubygems/pre-sync.sh b/rubygems/pre-sync.sh index c1a0d12..061bc42 100755 --- a/rubygems/pre-sync.sh +++ b/rubygems/pre-sync.sh @@ -1,4 +1,6 @@ #!/bin/bash +set_upstream "http://rubygems.org/" + mkdir -p "$HOME/.gem" chown -R "$OWNER" "$HOME" diff --git a/rustup/pre-sync.sh b/rustup/pre-sync.sh new file mode 100755 index 0000000..dc07b46 --- /dev/null +++ b/rustup/pre-sync.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +UPSTREAM="${UPSTREAM:-https://static.rust-lang.org/}" +set_upstream "$UPSTREAM" diff --git a/shadowmire/pre-sync.sh b/shadowmire/pre-sync.sh new file mode 100755 index 0000000..79dca44 --- /dev/null +++ b/shadowmire/pre-sync.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +UPSTREAM=${UPSTREAM:-"https://pypi.org"} +set_upstream "$UPSTREAM" diff --git a/stackage/pre-sync.sh b/stackage/pre-sync.sh new file mode 100755 index 0000000..b75315b --- /dev/null +++ b/stackage/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +set_upstream "https://github.com/commercialhaskell/" diff --git a/test/pre-sync.sh b/test/pre-sync.sh new file mode 100755 index 0000000..6bf6d1e --- /dev/null +++ b/test/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +set_upstream "https://example.com/ustcmirror-images/" diff --git a/tsumugu/pre-sync.sh b/tsumugu/pre-sync.sh new file mode 100755 index 0000000..bc543a5 --- /dev/null +++ b/tsumugu/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +set_upstream "$UPSTREAM" diff --git a/winget-source/pre-sync.sh b/winget-source/pre-sync.sh new file mode 100755 index 0000000..c10e3ba --- /dev/null +++ b/winget-source/pre-sync.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +WINGET_REPO_URL=${WINGET_REPO_URL:-"https://cdn.winget.microsoft.com/cache"} +set_upstream "$WINGET_REPO_URL" diff --git a/yukina/pre-sync.sh b/yukina/pre-sync.sh new file mode 100755 index 0000000..bc543a5 --- /dev/null +++ b/yukina/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +set_upstream "$UPSTREAM" diff --git a/yum-sync/pre-sync.sh b/yum-sync/pre-sync.sh new file mode 100755 index 0000000..55a88ce --- /dev/null +++ b/yum-sync/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +set_upstream "$YUMSYNC_URL"