-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.sh
executable file
·31 lines (28 loc) · 1.05 KB
/
init.sh
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
#!/bin/bash
init_repository() {
local repo_name="$1"
local repo_url="$2"
if [ -d "$repo_name" ]; then
echo -e "\033[32mThe '$repo_name' directory already exists. Skipping clone operation.\033[0m"
else
read -p "Do you have an existing local '$repo_name' repository? (y/n) " choice
case "$choice" in
[Yy])
read -p "Please enter the path of the existing '$repo_name' repository: " repo_path
ln -s "$repo_path" "$repo_name"
;;
[Nn])
git clone "$repo_url"
;;
*)
echo -e "\033[31mInvalid input. Please enter 'y' or 'n'.\033[0m"
init_repository "$repo_name" "$repo_url"
;;
esac
fi
echo -e "\033[34mRepository initialization for '$repo_name' is finished.\033[0m"
}
# Handle 'hvisor' repository
init_repository "hvisor" "https://github.com/syswonder/hvisor"
# Handle 'hvisor-tool' repository
init_repository "hvisor-tool" "https://github.com/syswonder/hvisor-tool"