Delete clone.sh
This commit is contained in:
parent
5e1ec89cda
commit
00b1e4ffd8
116
clone.sh
116
clone.sh
|
|
@ -1,116 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Moutaz Muhammad <moutazmuhamad@gmail.com>
|
||||
|
||||
# Git repository URL
|
||||
REPO_URL="https://github.com/expsa/odex25-standard-modules.git"
|
||||
|
||||
# Argument: which environment to clone (optional)
|
||||
TARGET_ENV=$1
|
||||
|
||||
# Branch types and their corresponding directories
|
||||
declare -A branch_dirs=(
|
||||
["dev"]="test"
|
||||
["preprod"]="preprod"
|
||||
["master"]="master"
|
||||
)
|
||||
|
||||
# All available branches
|
||||
branches=(
|
||||
"dev_odex-event"
|
||||
"dev_odex25_accounting"
|
||||
"dev_odex25_base"
|
||||
"dev_odex25_dms"
|
||||
"dev_odex25_fleet"
|
||||
"dev_odex25_helpdesk"
|
||||
"dev_odex25_hr"
|
||||
"dev_odex25_inventory"
|
||||
"dev_odex25_maintenance"
|
||||
"dev_odex25_mobile"
|
||||
"dev_odex25_pos"
|
||||
"dev_odex25_project"
|
||||
"dev_odex25_purchase"
|
||||
"dev_odex25_realstate"
|
||||
"dev_odex25_sales"
|
||||
"dev_odex25_survey"
|
||||
"dev_odex25_transactions"
|
||||
"dev_odex25_website"
|
||||
"dev_openeducat_erp-14.0.1.0"
|
||||
"dev_odex25_takaful"
|
||||
"dev_odex25_benefit"
|
||||
"dev_odex25_donation"
|
||||
"preprod_odex-event"
|
||||
"preprod_odex25_accounting"
|
||||
"preprod_odex25_base"
|
||||
"preprod_odex25_dms"
|
||||
"preprod_odex25_fleet"
|
||||
"preprod_odex25_helpdesk"
|
||||
"preprod_odex25_hr"
|
||||
"preprod_odex25_inventory"
|
||||
"preprod_odex25_maintenance"
|
||||
"preprod_odex25_mobile"
|
||||
"preprod_odex25_pos"
|
||||
"preprod_odex25_project"
|
||||
"preprod_odex25_purchase"
|
||||
"preprod_odex25_realstate"
|
||||
"preprod_odex25_sales"
|
||||
"preprod_odex25_survey"
|
||||
"preprod_odex25_transactions"
|
||||
"preprod_odex25_website"
|
||||
"preprod_openeducat_erp-14.0.1.0"
|
||||
"preprod_odex25_takaful"
|
||||
"preprod_odex25_benefit"
|
||||
"preprod_odex25_donation"
|
||||
"master_odex-event"
|
||||
"master_odex25_accounting"
|
||||
"master_odex25_base"
|
||||
"master_odex25_dms"
|
||||
"master_odex25_fleet"
|
||||
"master_odex25_helpdesk"
|
||||
"master_odex25_hr"
|
||||
"master_odex25_inventory"
|
||||
"master_odex25_maintenance"
|
||||
"master_odex25_mobile"
|
||||
"master_odex25_pos"
|
||||
"master_odex25_project"
|
||||
"master_odex25_purchase"
|
||||
"master_odex25_realstate"
|
||||
"master_odex25_sales"
|
||||
"master_odex25_survey"
|
||||
"master_odex25_transactions"
|
||||
"master_odex25_website"
|
||||
"master_openeducat_erp-14.0.1.0"
|
||||
"master_odex25_donation"
|
||||
"master_odex25_takaful"
|
||||
"master_odex25_benefit"
|
||||
)
|
||||
|
||||
for branch in "${branches[@]}"; do
|
||||
prefix="${branch%%_*}" # dev, preprod, master
|
||||
folder_name="${branch#*_}" # odex25_xxx
|
||||
base_dir="${branch_dirs[$prefix]}"
|
||||
full_path="$base_dir/$folder_name"
|
||||
|
||||
if [[ -n "$TARGET_ENV" && "${branch_dirs[$prefix]}" != "$TARGET_ENV" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ -d "$full_path/.git" ]]; then
|
||||
echo "Skipped $branch (already cloned)"
|
||||
continue
|
||||
elif [[ -d "$full_path" ]]; then
|
||||
echo "⚠️ Found existing folder without .git for $branch, deleting and recloning..."
|
||||
rm -rf "$full_path"
|
||||
fi
|
||||
|
||||
echo "Cloning $branch into $full_path..."
|
||||
mkdir -p "$full_path"
|
||||
git clone --depth=1 -b "$branch" "$REPO_URL" "$full_path"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "✅ Successfully cloned $branch into $full_path"
|
||||
else
|
||||
echo "❌ Failed to clone $branch"
|
||||
rm -rf "$full_path" # Cleanup if clone failed
|
||||
fi
|
||||
done
|
||||
Loading…
Reference in New Issue