#!/bin/bash REPOS=( "oc-auth" "oc-catalog" "oc-datacenter" "oc-front" "oc-monitord" "oc-peer" "oc-shared" "oc-scheduler" "oc-schedulerd" "oc-workflow" "oc-workspace" ) # Function to clone repositories clone_repo() { local repo_url="https://cloud.o-forge.io/core/$1.git" local repo_name=$(basename "$repo_url" .git) local branch=$2 echo "Processing repository: $repo_name" if [ ! -d "$repo_name" ]; then echo "Cloning repository: $repo_name" git clone "$repo_url" if [ $? -ne 0 ]; then echo "Error cloning $repo_url" exit 1 fi fi echo "Repository '$repo_name' already exists. Pulling latest changes..." cd "$repo_name" && git pull origin $branch && cd .. } cd .. # Iterate through each repository in the list branch = "main" if [ -n "$1" ]; then branch = $1 fi for repo in "${REPOS[@]}"; do clone_repo $repo $branch done echo "All repositories processed successfully."