-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit.sh
More file actions
executable file
·81 lines (67 loc) · 2.38 KB
/
git.sh
File metadata and controls
executable file
·81 lines (67 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
user_dir="source"
mkdir -p "$user_dir"
clone_or_pull() {
local repo_url=$1
local repo_name=$2
local target_dir="$user_dir/$repo_name"
if [ -d "$target_dir" ]; then
echo "Repository $repo_name already exists, pulling updates..."
cd "$target_dir" || { echo "Failed to enter directory: $target_dir"; return 1; }
if git pull --rebase; then
echo "Update successful: $repo_name"
else
echo "Update failed: $repo_name"
fi
cd - >/dev/null || exit
else
echo "Cloning: $repo_name"
if git clone --depth 1 "$repo_url" "$target_dir"; then
echo "Successfully cloned: $repo_name"
else
echo "Clone failed: $repo_url"
return 1
fi
fi
}
echo "Cloning repositories under hyperlane-dev organization..."
curl -s "https://api.github.com/orgs/hyperlane-dev/repos?per_page=100" |
grep -o '"clone_url": "[^"]*"' |
sed 's/"clone_url": "\(.*\)"/\1/' |
while read -r repo; do
repo_name=$(basename "$repo" .git)
clone_or_pull "$repo" "$repo_name"
done
# echo "Cloning repositories under crates-dev organization..."
# curl -s "https://api.github.com/orgs/crates-dev/repos?per_page=100" |
# grep -o '"clone_url": "[^"]*"' |
# sed 's/"clone_url": "\(.*\)"/\1/' |
# while read -r repo; do
# repo_name=$(basename "$repo" .git)
# clone_or_pull "$repo" "$repo_name"
# done
# echo "Cloning repositories under eastspire organization..."
# curl -s "https://api.github.com/orgs/eastspire/repos?per_page=100" |
# grep -o '"clone_url": "[^"]*"' |
# sed 's/"clone_url": "\(.*\)"/\1/' |
# while read -r repo; do
# repo_name=$(basename "$repo" .git)
# clone_or_pull "$repo" "$repo_name"
# done
echo "Cloning eastspire/ltpp-docs..."
clone_or_pull "https://github.com/eastspire/ltpp-docs" "ltpp-docs"
if [ -d "$user_dir/hyperlane-ai" ]; then
rm -rf "$user_dir/hyperlane-ai"
echo "Removed self-reference: $user_dir/hyperlane-ai"
fi
ltpp_docs_dir="$user_dir/ltpp-docs"
if [ -d "$ltpp_docs_dir" ]; then
echo "Cleaning up $ltpp_docs_dir..."
find "$ltpp_docs_dir" -mindepth 1 -maxdepth 1 ! -name 'src' -exec rm -rf {} + 2>/dev/null || true
src_dir="$ltpp_docs_dir/src"
if [ -d "$src_dir" ]; then
find "$src_dir" -mindepth 1 -maxdepth 1 -type d ! -name 'hyperlane*' -exec rm -rf {} + 2>/dev/null || true
fi
echo "Cleanup completed for $ltpp_docs_dir"
fi
echo "All repositories cloned/updated successfully!"