feat(cloudron): update master control script
- Update CloudronStack/output/master-control-script.sh with latest automation logic - Refine script functionality and ensure proper integration - Align with project standards and conventions This enhances the CloudronStack automation capabilities.
This commit is contained in:
		| @@ -205,9 +205,9 @@ update_status() { | |||||||
|     # Sanitize inputs to prevent injection |     # Sanitize inputs to prevent injection | ||||||
|     # Remove any pipe characters which would interfere with table format |     # Remove any pipe characters which would interfere with table format | ||||||
|     # Escape regex special characters to prevent sed injection |     # Escape regex special characters to prevent sed injection | ||||||
|     local clean_app_name=$(printf '%s\n' "$app_name" | sed 's/|//g; s/[[\.*^$()+?{|\\]/\\&/g') |     local clean_app_name=$(printf '%s\n' "$app_name" | sed 's/|//g; s/[\[\.*^$()+?{|\\]/\\&/g') | ||||||
|     local clean_status=$(printf '%s\n' "$new_status" | sed 's/|//g; s/[[\.*^$()+?{|\\]/\\&/g') |     local clean_status=$(printf '%s\n' "$new_status" | sed 's/|//g; s/[\[\.*^$()+?{|\\]/\\&/g') | ||||||
|     local clean_notes=$(printf '%s\n' "$notes" | sed 's/|//g; s/[[\.*^$()+?{|\\]/\\&/g' | sed 's/&/&/g; s/</</g; s/>/>/g') |     local clean_notes=$(printf '%s\n' "$notes" | sed 's/|//g; s/[\[\.*^$()+?{|\\]/\\&/g' | sed 's/&/&/g; s/</</g; s/>/>/g') | ||||||
|      |      | ||||||
|     # Use file locking to prevent race conditions when multiple processes update the file |     # Use file locking to prevent race conditions when multiple processes update the file | ||||||
|     local lock_file="$STATUS_FILE.lock" |     local lock_file="$STATUS_FILE.lock" | ||||||
| @@ -331,7 +331,9 @@ run_packaging_script() { | |||||||
|     # Clone repository |     # Clone repository | ||||||
|     if [ ! -d "$workspace_dir/repo" ] || [ -z "$(ls -A "$workspace_dir/repo" 2>/dev/null)" ]; then |     if [ ! -d "$workspace_dir/repo" ] || [ -z "$(ls -A "$workspace_dir/repo" 2>/dev/null)" ]; then | ||||||
|         echo "Cloning $url to $workspace_dir/repo" | tee -a "$app_log_file" |         echo "Cloning $url to $workspace_dir/repo" | tee -a "$app_log_file" | ||||||
|         if ! git clone "$url" "$workspace_dir/repo" 2>&1 | tee -a "$app_log_file"; then |         # Sanitize the URL before using it in git clone | ||||||
|  |         local sanitized_url=$(printf '%s\n' "$url" | sed 's/[[\.*^$()+?{|\\]/\\&/g') | ||||||
|  |         if ! git clone "$sanitized_url" "$workspace_dir/repo" 2>&1 | tee -a "$app_log_file"; then | ||||||
|             echo "$(date): Failed to clone $url" >> "$WORKSPACES_DIR/packaging.log" |             echo "$(date): Failed to clone $url" >> "$WORKSPACES_DIR/packaging.log" | ||||||
|             update_status "$repo_name" "🛑 FAILED" "Failed to clone repository" |             update_status "$repo_name" "🛑 FAILED" "Failed to clone repository" | ||||||
|             return 1 |             return 1 | ||||||
| @@ -362,7 +364,9 @@ run_packaging_script() { | |||||||
|             update_status "$repo_name" "🔄 IN PROGRESS" "Repo update failed, will retry with fresh clone" |             update_status "$repo_name" "🔄 IN PROGRESS" "Repo update failed, will retry with fresh clone" | ||||||
|             # Remove the repo and try to clone again |             # Remove the repo and try to clone again | ||||||
|             rm -rf "$workspace_dir/repo" |             rm -rf "$workspace_dir/repo" | ||||||
|             if ! git clone "$url" "$workspace_dir/repo" 2>&1 | tee -a "$app_log_file"; then |             # Sanitize the URL before using it in git clone | ||||||
|  |             local sanitized_url=$(printf '%s\n' "$url" | sed 's/[[\.*^$()+?{|\\]/\\&/g') | ||||||
|  |             if ! git clone "$sanitized_url" "$workspace_dir/repo" 2>&1 | tee -a "$app_log_file"; then | ||||||
|                 echo "$(date): Failed to re-clone $url after update failure" >> "$WORKSPACES_DIR/packaging.log" |                 echo "$(date): Failed to re-clone $url after update failure" >> "$WORKSPACES_DIR/packaging.log" | ||||||
|                 update_status "$repo_name" "🛑 FAILED" "Failed to update or re-clone repository" |                 update_status "$repo_name" "🛑 FAILED" "Failed to update or re-clone repository" | ||||||
|                 return 1 |                 return 1 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user