From e404a4330b52f3eff677997c01f8777995d0e1a8 Mon Sep 17 00:00:00 2001 From: taoky Date: Mon, 12 Jan 2026 02:46:43 +0800 Subject: [PATCH] Add yuki_upstream and set in pre-sync --- apt-sync/pre-sync.sh | 3 +++ aptsync/pre-sync.sh | 2 ++ archvsync/pre-sync.sh | 2 ++ base/Dockerfile.alpine | 2 +- base/Dockerfile.alpine-edge | 2 +- base/Dockerfile.debian | 2 +- base/set_upstream | 23 +++++++++++++++++++++++ crates-io-index/pre-sync.sh | 3 +++ debian-cd/pre-sync.sh | 2 ++ docker-ce/pre-sync.sh | 3 +++ fedora/pre-sync.sh | 6 ++++++ flatpak/pre-sync.sh | 3 +++ freebsd-pkg/pre-sync.sh | 5 +++++ freebsd-ports/pre-sync.sh | 5 +++++ ghcup/pre-sync.sh | 3 +++ github-release/pre-sync.sh | 3 +++ gitsync/pre-sync.sh | 3 +++ google-repo/pre-sync.sh | 4 ++++ gsutil-rsync/pre-sync.sh | 2 ++ hackage/pre-sync.sh | 4 ++++ homebrew-bottles/pre-sync.sh | 4 ++++ julia-storage/pre-sync.sh | 2 ++ lftpsync/pre-sync.sh | 3 +++ nix-channels/pre-sync.sh | 5 +++++ pypi/pre-sync.sh | 2 ++ rclone/pre-sync.sh | 22 ++++++++++++++++++++++ rsync/pre-sync.sh | 3 +++ rubygems-dynamic/pre-sync.sh | 6 ++++++ rubygems/pre-sync.sh | 2 ++ rustup/pre-sync.sh | 4 ++++ shadowmire/pre-sync.sh | 4 ++++ stackage/pre-sync.sh | 3 +++ test/pre-sync.sh | 3 +++ tsumugu/pre-sync.sh | 3 +++ winget-source/pre-sync.sh | 4 ++++ yukina/pre-sync.sh | 3 +++ yum-sync/pre-sync.sh | 3 +++ 37 files changed, 155 insertions(+), 3 deletions(-) create mode 100755 apt-sync/pre-sync.sh create mode 100755 base/set_upstream create mode 100755 crates-io-index/pre-sync.sh create mode 100755 docker-ce/pre-sync.sh create mode 100755 flatpak/pre-sync.sh create mode 100755 freebsd-pkg/pre-sync.sh create mode 100755 freebsd-ports/pre-sync.sh create mode 100755 ghcup/pre-sync.sh create mode 100755 github-release/pre-sync.sh create mode 100755 gitsync/pre-sync.sh create mode 100755 hackage/pre-sync.sh create mode 100755 homebrew-bottles/pre-sync.sh create mode 100755 lftpsync/pre-sync.sh create mode 100755 nix-channels/pre-sync.sh create mode 100755 rclone/pre-sync.sh create mode 100755 rsync/pre-sync.sh create mode 100755 rubygems-dynamic/pre-sync.sh create mode 100755 rustup/pre-sync.sh create mode 100755 shadowmire/pre-sync.sh create mode 100755 stackage/pre-sync.sh create mode 100755 test/pre-sync.sh create mode 100755 tsumugu/pre-sync.sh create mode 100755 winget-source/pre-sync.sh create mode 100755 yukina/pre-sync.sh create mode 100755 yum-sync/pre-sync.sh diff --git a/apt-sync/pre-sync.sh b/apt-sync/pre-sync.sh new file mode 100755 index 00000000..4171ea6b --- /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 8b31b812..efb7494e 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 85a5c02d..69ebfd49 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 ab79a2f5..46c8ec1a 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 00000000..7bbe3dc3 --- /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 f939098f..d923f3f0 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 00000000..d3b6d3c3 --- /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 bd1f5b1d..f0adf459 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 00000000..42990de7 --- /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 00000000..55295198 --- /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 00000000..948589f7 --- /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 00000000..4595539c --- /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 00000000..105f2f46 --- /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 00000000..1deb3770 --- /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 db6c6b69..1e85dc9a 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 91c0df99..22b26f4e 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 00000000..fad71e52 --- /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 00000000..c74d8920 --- /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 fec33a91..da23d3b0 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 00000000..37420ca9 --- /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 00000000..cff15d7f --- /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 150ec331..383139fe 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 00000000..58ec9f1f --- /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 00000000..1efb5622 --- /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 00000000..061bc420 --- /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 c1a0d121..061bc420 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 00000000..dc07b46b --- /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 00000000..79dca441 --- /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 00000000..b75315bc --- /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 00000000..6bf6d1e4 --- /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 00000000..bc543a5d --- /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 00000000..c10e3ba7 --- /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 00000000..bc543a5d --- /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 00000000..55a88cee --- /dev/null +++ b/yum-sync/pre-sync.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +set_upstream "$YUMSYNC_URL"