#!/bin/bash # To be run by user mkt. Refreshes the version-controlled GUI-customization # snapshot ($CUSTOM_SRC) from the running EspoCRM pod. Run this after making # customizations in the EspoCRM GUI (Entity Manager, Layout Manager, Label # Manager, etc.) so create_pod_espocrm.sh can restore them on reset+reprovision. # Commit the result to the repo afterwards. # Environment variables WEB_CTR='espocrm_ctr' SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" CUSTOM_SRC="$SCRIPT_DIR/espocrm-custom" # contains custom/ and client/custom/ if ! podman exec "$WEB_CTR" true 2>/dev/null; then echo "ERROR: container $WEB_CTR is not running. Start the pod first." >&2 exit 1 fi # Pull /var/www/html/{custom,client/custom} into a clean snapshot dir. rm -rf "$CUSTOM_SRC" mkdir -p "$CUSTOM_SRC" podman exec "$WEB_CTR" tar -C /var/www/html -cf - custom client/custom \ | tar -C "$CUSTOM_SRC" -xf - --no-same-owner echo "Refreshed snapshot at $CUSTOM_SRC (rc=$?)" echo "Files: $(find "$CUSTOM_SRC" -type f | wc -l)" echo "Review and commit, e.g.: git -C \"$SCRIPT_DIR\" add espocrm-custom && git -C \"$SCRIPT_DIR\" commit -m 'Update EspoCRM customizations snapshot'"