|
@@ -20,3 +20,23 @@ echo_success() {
|
|
|
echo -e "${GREEN}$1${RESET}"
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+# Function to check if a repository exists and perform git pull or git clone
|
|
|
+update_repository() {
|
|
|
+ local repo_url="$1"
|
|
|
+ local repo_dir="$2"
|
|
|
+ local repo_branch="$3"
|
|
|
+
|
|
|
+ if [ -d "$repo_dir" ]; then
|
|
|
+ # If the directory exists, then do a git pull
|
|
|
+ echo_warning "Updating $repo_dir..."
|
|
|
+ cd "$repo_dir" || exit
|
|
|
+ git checkout $repo_branch
|
|
|
+ git pull
|
|
|
+ cd - || exit
|
|
|
+ else
|
|
|
+ # If the directory does not exist, then do a git clone
|
|
|
+ echo_warning "Cloning $repo_url into $repo_dir..."
|
|
|
+ git clone -b "$repo_branch" "$repo_url" "$repo_dir"
|
|
|
+ fi
|
|
|
+}
|