Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apt-sync/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "$APTSYNC_URL"
2 changes: 2 additions & 0 deletions aptsync/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set_upstream "$APTSYNC_URL"

get_hostname() {
sed -re 's|[^/]*//([^@]*@)?([^:/]*).*|\2|' <<< "$1"
}
Expand Down
2 changes: 2 additions & 0 deletions archvsync/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set_upstream "rsync://$RSYNC_HOST/$RSYNC_PATH"

# override the `killer` func in entry.sh
killer() {
kill -- "$1"
Expand Down
2 changes: 1 addition & 1 deletion base/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN <<EOF
apk add --no-cache bash tzdata su-exec
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
EOF
ADD ["entry.sh", "savelog", "/usr/local/bin/"]
ADD ["entry.sh", "savelog", "set_upstream", "/usr/local/bin/"]
ADD ["pip.conf", "/etc/"]
VOLUME ["/data", "/log"]
CMD ["entry.sh"]
2 changes: 1 addition & 1 deletion base/Dockerfile.alpine-edge
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ RUN <<EOF
apk add --no-cache bash tzdata su-exec
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
EOF
ADD ["entry.sh", "savelog", "/usr/local/bin/"]
ADD ["entry.sh", "savelog", "set_upstream", "/usr/local/bin/"]
VOLUME ["/data", "/log"]
CMD ["entry.sh"]
2 changes: 1 addition & 1 deletion base/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ chmod +x /usr/local/bin/su-exec
echo "592f25c51d0e4c90945ece8c4fa35018d20a1091ac109c98b66eb95deef211c7 /usr/local/bin/su-exec" | sha256sum -c -
apt-get purge -y --auto-remove wget
EOF
ADD ["entry.sh", "savelog", "/usr/local/bin/"]
ADD ["entry.sh", "savelog", "set_upstream", "/usr/local/bin/"]
VOLUME ["/data", "/log"]
CMD ["entry.sh"]
23 changes: 23 additions & 0 deletions base/set_upstream
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

set -e
set -o pipefail

# Write argv[1] (upstream) to $LOGDIR/yuki_upstream.txt
# This program is expected to be called by pre-sync.sh (recommended) or post-sync.sh
# in all sync images

if [ -z "$1" ]; then
echo "Usage: $0 <upstream>" >&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"
3 changes: 3 additions & 0 deletions crates-io-index/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "https://github.com/rust-lang/crates.io-index"
2 changes: 2 additions & 0 deletions debian-cd/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set_upstream "rsync://$RSYNC_HOST/$RSYNC_MODULE"

# override the `killer` func in entry.sh
killer() {
kill -- "$1"
Expand Down
3 changes: 3 additions & 0 deletions docker-ce/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "https://download.docker.com/"
6 changes: 6 additions & 0 deletions fedora/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -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%%/}"

Expand Down
3 changes: 3 additions & 0 deletions flatpak/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "https://dl.flathub.org/repo/"
5 changes: 5 additions & 0 deletions freebsd-pkg/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

FBSD_PKG_UPSTREAM=${FBSD_PKG_UPSTREAM:-"http://pkg.freebsd.org"}

set_upstream "$FBSD_PKG_UPSTREAM"
5 changes: 5 additions & 0 deletions freebsd-ports/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions ghcup/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "https://www.haskell.org/ghcup/"
3 changes: 3 additions & 0 deletions github-release/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "https://github.com/"
3 changes: 3 additions & 0 deletions gitsync/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "$GITSYNC_URL"
4 changes: 4 additions & 0 deletions google-repo/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 2 additions & 0 deletions gsutil-rsync/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

set_upstream "$GS_URL"

mkdir -p /.gsutil
chown -R "$OWNER" /.gsutil
4 changes: 4 additions & 0 deletions hackage/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

HACKAGE_BASE_URL=${HACKAGE_BASE_URL:-https://hackage.haskell.org/}
set_upstream "$HACKAGE_BASE_URL"
4 changes: 4 additions & 0 deletions homebrew-bottles/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

HOMEBREW_BOTTLE_DOMAIN=${HOMEBREW_BOTTLE_DOMAIN:-https://ghcr.io/v2/homebrew/}
set_upstream "$HOMEBREW_BOTTLE_DOMAIN"
2 changes: 2 additions & 0 deletions julia-storage/pre-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions lftpsync/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "$LFTPSYNC_HOST/$LFTPSYNC_PATH"
5 changes: 5 additions & 0 deletions nix-channels/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

NIX_MIRROR_UPSTREAM=${NIX_MIRROR_UPSTREAM:-https://nixos.org/channels/}

set_upstream "$NIX_MIRROR_UPSTREAM"
2 changes: 2 additions & 0 deletions pypi/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set_upstream "https://pypi.python.org"

cat << EOF > /etc/bandersnatch.conf
[mirror]
directory = $TO
Expand Down
22 changes: 22 additions & 0 deletions rclone/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -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}"
3 changes: 3 additions & 0 deletions rsync/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

set_upstream "rsync://$RSYNC_HOST/$RSYNC_PATH"
6 changes: 6 additions & 0 deletions rubygems-dynamic/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set_upstream "http://rubygems.org/"

mkdir -p "$HOME/.gem"
chown -R "$OWNER" "$HOME"
2 changes: 2 additions & 0 deletions rubygems/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

set_upstream "http://rubygems.org/"

mkdir -p "$HOME/.gem"
chown -R "$OWNER" "$HOME"
4 changes: 4 additions & 0 deletions rustup/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

UPSTREAM="${UPSTREAM:-https://static.rust-lang.org/}"
set_upstream "$UPSTREAM"
4 changes: 4 additions & 0 deletions shadowmire/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

UPSTREAM=${UPSTREAM:-"https://pypi.org"}
set_upstream "$UPSTREAM"
3 changes: 3 additions & 0 deletions stackage/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

set_upstream "https://github.com/commercialhaskell/"
3 changes: 3 additions & 0 deletions test/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

set_upstream "https://example.com/ustcmirror-images/"
3 changes: 3 additions & 0 deletions tsumugu/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

set_upstream "$UPSTREAM"
4 changes: 4 additions & 0 deletions winget-source/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

WINGET_REPO_URL=${WINGET_REPO_URL:-"https://cdn.winget.microsoft.com/cache"}
set_upstream "$WINGET_REPO_URL"
3 changes: 3 additions & 0 deletions yukina/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

set_upstream "$UPSTREAM"
3 changes: 3 additions & 0 deletions yum-sync/pre-sync.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

set_upstream "$YUMSYNC_URL"