diff --git a/cloud/deploy/build_cafe24_package.sh b/cloud/deploy/build_cafe24_package.sh index 04b3adc..7096db5 100755 --- a/cloud/deploy/build_cafe24_package.sh +++ b/cloud/deploy/build_cafe24_package.sh @@ -225,13 +225,30 @@ echo ">> [6/6] zipping" rm -f "$ZIP" if command -v zip >/dev/null 2>&1; then ( cd "$STAGE" && zip -rq "$ZIP" . ) +elif command -v python3 >/dev/null 2>&1; then + # No `zip` (common on Windows/Git Bash). Use Python's zipfile with POSIX (forward-slash) + # arcnames. PowerShell's Compress-Archive writes BACKSLASH path separators, which Cafe24's + # extractor and some unzip tools do NOT normalise — the app tree then unpacks as flat files + # (move_detect_app\src\... as one filename) and the deploy silently breaks. Prefer python. + ( cd "$STAGE" && python3 - "$ZIP" <<'PY' +import os, sys, zipfile +with zipfile.ZipFile(sys.argv[1], "w", zipfile.ZIP_DEFLATED) as z: + for root, _dirs, files in os.walk("."): + for name in files: + full = os.path.join(root, name) + arc = os.path.relpath(full, ".").replace(os.sep, "/") # force forward slashes + z.write(full, arc) +PY + ) elif command -v powershell >/dev/null 2>&1; then - # No zip on the box (common on Windows/Git Bash) — PowerShell ships Compress-Archive. + # Last resort. Compress-Archive uses backslash separators (see above) — the .htaccess/README + # note the operator to extract with a slash-aware tool, or prefer the python path. win_stage="$(cygpath -w "$STAGE" 2>/dev/null || echo "$STAGE")" win_zip="$(cygpath -w "$ZIP" 2>/dev/null || echo "$ZIP")" powershell -NoProfile -Command "Compress-Archive -Path '${win_stage}\\*' -DestinationPath '${win_zip}' -Force" + echo " WARN: archived via Compress-Archive (backslash paths). Verify the host unpacks the tree correctly." else - echo " WARN: no zip/powershell — skipping the archive; upload $STAGE/ directly." + echo " WARN: no zip/python3/powershell — skipping the archive; upload $STAGE/ directly." fi echo ""