-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinitial-setup.bash
More file actions
executable file
·92 lines (74 loc) · 2.84 KB
/
initial-setup.bash
File metadata and controls
executable file
·92 lines (74 loc) · 2.84 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
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# Bash script to delete placeholder folders in src/ and clone repos
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SRC_PATH="$SCRIPT_DIR/src"
echo -e "\033[36mScript running from: $SCRIPT_DIR\033[0m"
echo -e "\033[36mSource path: $SRC_PATH\033[0m"
# Find all folders with "_PLACEHOLDER" in their name
placeholder_folders=$(find "$SRC_PATH" -maxdepth 1 -type d -name "*_PLACEHOLDER*" 2>/dev/null)
if [ -z "$placeholder_folders" ]; then
echo -e "\033[33mNo placeholder folders found in src/\033[0m"
else
count=$(echo "$placeholder_folders" | wc -l | tr -d ' ')
echo -e "\033[36mFound $count placeholder folder(s) to delete:\033[0m"
echo "$placeholder_folders" | while read -r folder; do
echo -e " - \033[90m$(basename "$folder")\033[0m"
done
echo ""
echo "$placeholder_folders" | while read -r folder; do
if rm -rf "$folder"; then
echo -e "\033[32mDeleted: $(basename "$folder")\033[0m"
else
echo -e "\033[31mFailed to delete: $(basename "$folder")\033[0m"
fi
done
echo ""
echo -e "\033[36mCleanup complete!\033[0m"
fi
# Clone repositories into src/
echo ""
echo -e "\033[36mCloning repositories into $SRC_PATH ...\033[0m"
# Use HTTPS URLs (works without SSH keys on CI/CD runners)
repos=(
"https://github.com/hydex-org/bridge-custody.git"
"https://github.com/hydex-org/hydex-frontend.git"
"https://github.com/hydex-org/enclaveenv.git"
"https://github.com/hydex-org/frost-pallas.git"
"https://github.com/hydex-org/hydexAPI.git"
)
# Ensure src directory exists
mkdir -p "$SRC_PATH"
for repo in "${repos[@]}"; do
repo_name=$(basename "$repo" .git)
target_dir="$SRC_PATH/$repo_name"
if [ -d "$target_dir" ]; then
echo -e "\033[33mSkipping $repo_name (already exists at $target_dir)\033[0m"
else
echo -e "Cloning \033[90m$repo_name\033[0m into $target_dir..."
if git clone "$repo" "$target_dir" 2>&1; then
echo -e "\033[32mCloned: $repo_name\033[0m"
else
echo -e "\033[31mFailed to clone: $repo_name\033[0m"
fi
fi
done
# Checkout main branch for each repository
echo ""
echo -e "\033[36mChecking out main branch...\033[0m"
for repo in "${repos[@]}"; do
repo_name=$(basename "$repo" .git)
target_dir="$SRC_PATH/$repo_name"
if [ -d "$target_dir" ]; then
echo -e "Switching \033[90m$repo_name\033[0m to main..."
if git -C "$target_dir" checkout main 2>/dev/null; then
echo -e "\033[32mChecked out main: $repo_name\033[0m"
else
echo -e "\033[31mFailed to checkout main: $repo_name (branch may not exist)\033[0m"
fi
fi
done
echo ""
echo -e "\033[36mSetup complete!\033[0m"
echo ""
echo -e "\033[36mFinal directory structure:\033[0m"
ls -la "$SRC_PATH" 2>/dev/null || echo "src/ directory not found"