diff --git a/rmm-tasks/ESPO-03-First-Deploy.sh b/rmm-tasks/ESPO-03-First-Deploy.sh index 910e87e..693b09d 100755 --- a/rmm-tasks/ESPO-03-First-Deploy.sh +++ b/rmm-tasks/ESPO-03-First-Deploy.sh @@ -79,7 +79,7 @@ echo "--- Instanz" echo "FQDN: $FQDN (Ring $RING)" # Die Version steht je nach Stand in config.php oder in config-internal.php - EspoCRM selbst # fragen ist verlaesslicher als eine der beiden Dateien zu raten. -VERSION="$(docker exec espocrm php -r '$a=@include "data/config.php"; $b=@include "data/config-internal.php"; $c=array_merge(is_array($a)?$a:[], is_array($b)?$b:[]); echo $c["version"] ?? "";' 2>/dev/null)" +VERSION="$(docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a = @include $f; if (is_array($a) && !empty($a["version"])) { echo $a["version"]; exit; } }' 2>/dev/null)" [ -n "$VERSION" ] || VERSION="$(grep -hoP "['\"]version['\"]\s*=>\s*['\"]\K[^'\"]+" /srv/espo/data/config.php /srv/espo/data/config-internal.php 2>/dev/null | head -1)" echo "Version: ${VERSION:-unbekannt}" IMAGE="$(docker inspect -f '{{.Config.Image}}' espocrm 2>/dev/null)" diff --git a/rmm-tasks/ESPO-10-Update.sh b/rmm-tasks/ESPO-10-Update.sh index a547ba0..5ca90e2 100755 --- a/rmm-tasks/ESPO-10-Update.sh +++ b/rmm-tasks/ESPO-10-Update.sh @@ -36,7 +36,7 @@ fi # 3. Ausgangsstand festhalten, damit der Bericht ein Vorher und ein Nachher hat. VORHER_IMAGE="$(docker inspect -f '{{.Config.Image}}' espocrm 2>/dev/null)" -VORHER_VERSION="$(docker exec espocrm php -r '$a=@include "data/config.php"; $b=@include "data/config-internal.php"; $c=array_merge(is_array($a)?$a:[], is_array($b)?$b:[]); echo $c["version"] ?? "";' 2>/dev/null)" +VORHER_VERSION="$(docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a = @include $f; if (is_array($a) && !empty($a["version"])) { echo $a["version"]; exit; } }' 2>/dev/null)" echo "Vorher: Image ${VORHER_IMAGE:-unbekannt}, Version ${VORHER_VERSION:-unbekannt}" # 4. Erst der Rueckweg, dann das Update. Ohne Snapshot wird nichts angefasst. @@ -81,7 +81,7 @@ echo "--- Container" docker compose -f /srv/espo/docker-compose.yml ps --format 'table {{.Name}}\t{{.Status}}' echo "--- Instanz" NACHHER_IMAGE="$(docker inspect -f '{{.Config.Image}}' espocrm 2>/dev/null)" -NACHHER_VERSION="$(docker exec espocrm php -r '$a=@include "data/config.php"; $b=@include "data/config-internal.php"; $c=array_merge(is_array($a)?$a:[], is_array($b)?$b:[]); echo $c["version"] ?? "";' 2>/dev/null)" +NACHHER_VERSION="$(docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a = @include $f; if (is_array($a) && !empty($a["version"])) { echo $a["version"]; exit; } }' 2>/dev/null)" echo "Image: ${VORHER_IMAGE:-unbekannt} -> ${NACHHER_IMAGE:-unbekannt}" echo "Version: ${VORHER_VERSION:-unbekannt} -> ${NACHHER_VERSION:-unbekannt}" echo "Digest: $(docker image inspect --format '{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}{{.Id}}{{end}}' "$NACHHER_IMAGE" 2>/dev/null)" diff --git a/rmm-tasks/ESPO-20-Inventar.sh b/rmm-tasks/ESPO-20-Inventar.sh index 81f9a19..f70208c 100755 --- a/rmm-tasks/ESPO-20-Inventar.sh +++ b/rmm-tasks/ESPO-20-Inventar.sh @@ -25,8 +25,15 @@ ESPO_IMAGE="$(docker inspect -f '{{.Config.Image}}' espocrm 2>/dev/null)" [ -n "$ESPO_IMAGE" ] || fehler "Container 'espocrm' nicht gefunden - laeuft die Instanz?" ESPO_DIGEST="$(docker image inspect --format '{{if .RepoDigests}}{{index .RepoDigests 0}}{{else}}{{.Id}}{{end}}' "$ESPO_IMAGE" 2>/dev/null)" [ -n "$ESPO_DIGEST" ] || fehler "Digest des EspoCRM-Images nicht ermittelbar" -ESPO_VERSION="$(docker exec espocrm php -r '$a=@include "data/config.php"; $b=@include "data/config-internal.php"; $c=array_merge(is_array($a)?$a:[], is_array($b)?$b:[]); echo $c["version"] ?? "";' 2>/dev/null)" -[ -n "$ESPO_VERSION" ] || fehler "EspoCRM-Version nicht ermittelbar" +ESPO_VERSION="$(docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a = @include $f; if (is_array($a) && !empty($a["version"])) { echo $a["version"]; exit; } }' 2>/dev/null)" +[ -n "$ESPO_VERSION" ] || ESPO_VERSION="$(grep -hoP "['\"]version['\"]\s*=>\s*['\"]\K[^'\"]+" /srv/espo/data/config-internal.php /srv/espo/data/config.php 2>/dev/null | head -1)" +if [ -z "$ESPO_VERSION" ]; then + echo "--- Diagnose: vorhandene Konfigurationsdateien" + ls -l /srv/espo/data/config*.php 2>&1 + echo "--- Diagnose: erste Schluessel je Datei" + docker exec espocrm php -r 'foreach (["/var/www/html/data/config-internal.php","/var/www/html/data/config.php"] as $f) { $a=@include $f; echo $f, ": ", is_array($a) ? implode(",", array_slice(array_keys($a),0,15)) : "kein Array", "\n"; }' 2>&1 | head -5 + fehler "EspoCRM-Version nicht ermittelbar" +fi # 3. MariaDB: Image, Digest, Version. Das Passwort wird im Container aus der Secret-Datei gelesen, # damit es weder im Skript noch in der Prozessliste der VM auftaucht.