fix(waf/packaging): CRS-Plugin-Download probiert main + master, curl -f — v1.3.13

WordPress-Plugin nutzt den Branch `master` (nicht `main`), und `curl -sL` ohne
-f wertete den 404 als Erfolg → WordPress-Plugin wurde still übersprungen. Fix:
beide Branches probieren, curl -f (harter HTTP-Fehler), Tarball-Extraktion als
Erfolgskriterium.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-08-03 10:36:51 +02:00
parent 37f729381d
commit 235b5c3b9a
2 changed files with 16 additions and 10 deletions

View File

@@ -951,17 +951,23 @@ KEEPALIVEDDROPIN
continue
fi
P_TMP="$(mktemp -d)"
if curl -sL --max-time 45 \
"https://github.com/coreruleset/${plugin}-plugin/archive/refs/heads/main.tar.gz" \
-o "${P_TMP}/p.tgz" 2>/dev/null; then
tar xzf "${P_TMP}/p.tgz" -C "${P_TMP}" 2>/dev/null || true
if ls "${P_TMP}"/*/plugins/${plugin}-*.conf >/dev/null 2>&1; then
install -m 0644 "${P_TMP}"/*/plugins/${plugin}-*.conf \
"$WAF_CRS_DIR/plugins/" 2>/dev/null \
&& echo "postinst: CRS-Plugin ${plugin} installiert"
P_OK=""
# Plugin-Repos nutzen teils 'main', teils 'master' als Default-
# Branch. curl -f (statt still einen 404 als Erfolg zu werten).
for P_BR in main master; do
if curl -fsSL --max-time 45 \
"https://github.com/coreruleset/${plugin}-plugin/archive/refs/heads/${P_BR}.tar.gz" \
-o "${P_TMP}/p.tgz" 2>/dev/null \
&& tar xzf "${P_TMP}/p.tgz" -C "${P_TMP}" 2>/dev/null; then
P_OK=1; break
fi
done
if [ -n "$P_OK" ] && ls "${P_TMP}"/*/plugins/${plugin}-*.conf >/dev/null 2>&1; then
install -m 0644 "${P_TMP}"/*/plugins/${plugin}-*.conf \
"$WAF_CRS_DIR/plugins/" 2>/dev/null \
&& echo "postinst: CRS-Plugin ${plugin} installiert"
else
echo "postinst: CRS-Plugin ${plugin} Download fehlgeschlagen (kein Internet?)" >&2
echo "postinst: CRS-Plugin ${plugin} nicht installiert (Download/Layout)" >&2
fi
rm -rf "${P_TMP}"
done