diff options
| author | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2025-02-17 11:23:33 +0100 |
|---|---|---|
| committer | Czarek Nakamoto <cyjan@mrcyjanek.net> | 2025-02-17 11:23:33 +0100 |
| commit | e64ac9c4f14f9c0e45606fe67aeeeb3a5f9af777 (patch) | |
| tree | 6ada5abb929ebb331b007ca5719c589fac40eef1 /tools/mirror/pack_mirror.sh | |
| parent | 9d9b1f2f2373fc9a99c6556a93eea63fe343cf58 (diff) | |
Add mirror fot git repo
Improve apply_patches.sh
Improve build_single.sh
Create tools to mirror all repositories in git bundles
Diffstat (limited to 'tools/mirror/pack_mirror.sh')
| -rw-r--r-- | tools/mirror/pack_mirror.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tools/mirror/pack_mirror.sh b/tools/mirror/pack_mirror.sh new file mode 100644 index 0000000..5e13708 --- /dev/null +++ b/tools/mirror/pack_mirror.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -e + +cd "$(dirname "$0")" + +MIRROR_DIR="$(pwd)/mirror_work/mirror.git" +PACK_DIR="$(pwd)/mirror_work/pack" + +if [ ! -d "$MIRROR_DIR" ]; then + echo "Error: Mirror repository not found at $MIRROR_DIR" + exit 1 +fi + +rm -rf "$PACK_DIR" +mkdir -p "$PACK_DIR" + +cp -r "$MIRROR_DIR" "$PACK_DIR/mirror.git" + +cd "$PACK_DIR/mirror.git" + +echo "Optimizing repository..." +git gc --aggressive --prune=now + +git pack-refs --all + +rm -rf hooks/* info/* logs/* packed-refs.old + +git show-ref > info/refs + +git update-server-info + +mkdir -p objects + +while read -r hash ref; do + dir=${hash:0:2} + file=${hash:2} + mkdir -p "objects/$dir" + + git cat-file -p "$hash" > "objects/$dir/$file" +done < info/refs + +rm -rf "$TEMP_REPO" + +rm -f config + +cd "$PACK_DIR" + +echo rsync --delete -raz --progress "$PACK_DIR/mirror.git" "mrcyjanek@static.mrcyjanek.net:/home/mrcyjanek/web/static.mrcyjanek.net/public_html/download_mirror/git/" +echo "Mirror packaged successfully at: $PACK_DIR/mirror.git"
\ No newline at end of file |
