11#! /bin/bash
22
33echo " Choose the CMS (numbers):"
4- select CMS_TYPE in " sitecore" " contentful" " wordpress" ; do
4+ select CMS_TYPE in " sitecore" " contentful" " wordpress" " aem " ; do
55 case $CMS_TYPE in
66 sitecore)
77 EXAMPLE_FILE=" sitecore.zip"
@@ -15,20 +15,26 @@ select CMS_TYPE in "sitecore" "contentful" "wordpress"; do
1515 EXAMPLE_FILE=" wordpress.xml"
1616 break
1717 ;;
18+ aem)
19+ EXAMPLE_FILE=" aem_data_structure"
20+ break
21+ ;;
1822 * )
19- echo " Invalid option. Please select 1, 2, or 3 ."
23+ echo " Invalid option. Please select 1, 2, 3, or 4 ."
2024 ;;
2125 esac
2226done
2327
24- read -p " Enter the full path to your $CMS_TYPE data file (e.g., $EXAMPLE_FILE ): " CMS_DATA_PATH
25-
26- # Remove surrounding quotes if they exist
27- CMS_DATA_PATH=" ${CMS_DATA_PATH% \" } "
28- CMS_DATA_PATH=" ${CMS_DATA_PATH# \" } "
28+ # Prompt for the CMS data path
29+ echo " Enter the path to your $CMS_TYPE data:"
30+ if [[ " $CMS_TYPE " == " aem" ]]; then
31+ echo " (Path should contain a 'templates' folder with JSON files, or provide direct path to templates folder)"
32+ fi
33+ read -r CMS_DATA_PATH
2934
30- # Store original Windows path for Docker volume mounting
35+ # Store original path for Docker (Windows paths work with Docker Desktop)
3136ORIGINAL_PATH=" $CMS_DATA_PATH "
37+ DOCKER_MOUNT_PATH=" $CMS_DATA_PATH " # Path to mount in Docker
3238
3339# Convert Windows path to Unix format for Git Bash file operations ONLY
3440UNIX_PATH=" $CMS_DATA_PATH "
@@ -39,15 +45,60 @@ if [[ "$CMS_DATA_PATH" =~ ^[A-Za-z]:\\ ]]; then
3945 UNIX_PATH=$( echo " $UNIX_PATH " | sed ' s/^\([A-Za-z]\):/\/\L\1/' )
4046fi
4147
42- # Check if file exists using the converted path
43- if [ ! -f " $UNIX_PATH " ]; then
44- echo " ❌ File does not exist: $UNIX_PATH "
45- exit 1
48+ # Check if file/directory exists using the converted path
49+ if [[ " $CMS_TYPE " == " aem" ]]; then
50+ # For AEM, check if it's a directory
51+ if [ ! -d " $UNIX_PATH " ]; then
52+ echo " ❌ Directory does not exist: $UNIX_PATH "
53+ echo " Please provide the path to your AEM data structure folder"
54+ exit 1
55+ fi
56+
57+ # Check if the provided path IS the templates folder
58+ if [[ " $( basename " $UNIX_PATH " ) " == " templates" ]]; then
59+ # User provided the templates folder directly
60+ TEMPLATES_PATH=" $UNIX_PATH "
61+ # Get parent directory for Docker mounting
62+ UNIX_MOUNT_PATH=" $( dirname " $UNIX_PATH " ) "
63+ DOCKER_MOUNT_PATH=" $( dirname " $ORIGINAL_PATH " ) "
64+ echo " ℹ️ Detected direct templates path, using parent folder for Docker mounting"
65+ else
66+ # User provided the parent folder
67+ TEMPLATES_PATH=" $UNIX_PATH /templates"
68+ UNIX_MOUNT_PATH=" $UNIX_PATH "
69+
70+ # Verify templates folder exists
71+ if [ ! -d " $TEMPLATES_PATH " ]; then
72+ echo " ❌ 'templates' folder not found in: $UNIX_PATH "
73+ echo " Expected structure: your-folder/templates/*.json"
74+ echo " Or provide the direct path to the templates folder"
75+ exit 1
76+ fi
77+ fi
78+
79+ # Check if templates folder contains JSON files
80+ JSON_COUNT=$( find " $TEMPLATES_PATH " -maxdepth 1 -name " *.json" -type f 2> /dev/null | wc -l)
81+ if [ " $JSON_COUNT " -eq 0 ]; then
82+ echo " ❌ No JSON files found in templates folder: $TEMPLATES_PATH "
83+ echo " Please ensure your templates folder contains template JSON files"
84+ exit 1
85+ fi
86+
87+ echo " ✅ Found $JSON_COUNT JSON template file(s) in templates folder"
88+
89+ FILENAME=$( basename " $UNIX_MOUNT_PATH " )
90+ CONTAINER_PATH=" /data/$FILENAME "
91+ else
92+ # For other CMS types, check if it's a file
93+ if [ ! -f " $UNIX_PATH " ]; then
94+ echo " ❌ File does not exist: $UNIX_PATH "
95+ exit 1
96+ fi
97+
98+ FILENAME=$( basename " $UNIX_PATH " )
99+ CONTAINER_PATH=" /data/$FILENAME "
46100fi
47101
48- FILENAME=$( basename " $UNIX_PATH " )
49- CONTAINER_PATH=" /data/$FILENAME "
50-
51102export CMS_TYPE
52103export CMS_DATA_PATH=" $ORIGINAL_PATH "
53104export CONTAINER_PATH
@@ -73,11 +124,19 @@ set_env_var() {
73124}
74125
75126set_env_var " CMS_TYPE" " $CMS_TYPE "
76- # Use original Windows path for Docker volume mounting
127+ # Save the full path to templates (what user provided)
77128set_env_var " CMS_DATA_PATH" " $ORIGINAL_PATH "
129+ # Save the Docker mount path (may be parent directory for AEM)
130+ set_env_var " DOCKER_MOUNT_PATH" " $DOCKER_MOUNT_PATH "
78131set_env_var " CONTAINER_PATH" " $CONTAINER_PATH "
79132set_env_var " NODE_BACKEND_API" " http://migration-api:5001"
80133
134+ # Set AEM-specific environment variables
135+ if [[ " $CMS_TYPE " == " aem" ]]; then
136+ set_env_var " AEM_TEMPLATES_DIR" " templates"
137+ echo " ℹ️ Set AEM_TEMPLATES_DIR to: templates"
138+ fi
139+
81140# Check if docker-compose.yml exists before running
82141if [ ! -f " docker-compose.yml" ]; then
83142 echo " ❌ docker-compose.yml not found in current directory"
@@ -87,10 +146,30 @@ if [ ! -f "docker-compose.yml" ]; then
87146 exit 1
88147fi
89148
149+ # Check if Docker is running
150+ if ! docker info > /dev/null 2>&1 ; then
151+ echo " "
152+ echo " ❌ Docker is not running!"
153+ echo " Please start Docker Desktop and try again."
154+ exit 1
155+ fi
156+
157+ echo " "
90158echo " ✅ Starting Docker Compose with the following configuration:"
159+ echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
91160echo " CMS_TYPE: $CMS_TYPE "
92- echo " CMS_DATA_PATH (for Docker): $ORIGINAL_PATH "
93- echo " CMS_DATA_PATH (for file check): $UNIX_PATH "
94- echo " CONTAINER_PATH: $CONTAINER_PATH "
161+ echo " CMS_DATA_PATH: $ORIGINAL_PATH "
162+ if [[ " $CMS_TYPE " == " aem" ]]; then
163+ echo " DOCKER_MOUNT_PATH: $DOCKER_MOUNT_PATH "
164+ echo " CONTAINER_PATH: $CONTAINER_PATH "
165+ echo " Templates accessible at: $CONTAINER_PATH /templates"
166+ else
167+ echo " CONTAINER_PATH: $CONTAINER_PATH "
168+ fi
169+ echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
170+ echo " "
171+
172+ # Export for docker-compose
173+ export DOCKER_MOUNT_PATH
95174
96175MSYS_NO_PATHCONV=1 docker compose up --build
0 commit comments