mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Move files that share a delimiter-bounded name prefix within a folder (threshold 2) into a subfolder named after the prefix, dropping the prefix from the filename. Covers plugins/filter (docker, generate, has, merge, get/all), env handler subpackages, utils/roles/entity, utils/tests/swarm/write, role SQL/scripts/templates, keycloak/mailu task-includes, shared tasks/utils/load, and CI scripts. Update every import, query_file/script/include_tasks/src/lookup target, compose bind mount, and python -m path to the new locations. Extend the prefix-grouped-files lint to threshold 2 with dir-level .nocheck and file-head nocheck opt-outs, and skip groups whose shortest member's stem equals the shared prefix. Keep flat only where a loader forbids nesting: WordPress mu-plugins and the docs/requirements namespace. Ansible filter discovery is recursive, so nested filters stay Jinja-resolvable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
41 lines
1.4 KiB
Bash
41 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# Install a MediaWiki extension into the running container, idempotent.
|
|
# Runs ON THE HOSTING NODE (delegated); targets the local container via
|
|
# `container exec` / `container cp`.
|
|
#
|
|
# Required env, supplied by the calling Ansible task:
|
|
# EXT_NAME extension name (subdir under extensions/)
|
|
# EXT_TARBALL node-side path to the downloaded .tar.gz
|
|
# MEDIAWIKI_HTML_DIR target directory inside the container
|
|
# MEDIAWIKI_USER unix user to own extracted files inside the container
|
|
# MW_CID resolved container id (resolve_host_cid), local to this node
|
|
set -euo pipefail
|
|
|
|
ADDRESS="${MW_CID:?MW_CID env var (resolved container id) required}"
|
|
|
|
DST="${MEDIAWIKI_HTML_DIR}/extensions/${EXT_NAME}"
|
|
|
|
container exec "$ADDRESS" bash -lc "
|
|
set -e
|
|
if [ ! -f \"${DST}/extension.json\" ]; then
|
|
rm -rf \"${DST}\" && mkdir -p \"${DST}\"
|
|
fi
|
|
"
|
|
|
|
# nocheck: container-cp - EXT_TARBALL is downloaded on the node this script runs on
|
|
container cp "${EXT_TARBALL}" "${ADDRESS}:/tmp/${EXT_NAME}.tar.gz"
|
|
|
|
container exec "$ADDRESS" bash -lc "
|
|
set -e
|
|
if [ ! -f \"${DST}/extension.json\" ]; then
|
|
tar -xzf /tmp/${EXT_NAME}.tar.gz -C \"${DST}\" --strip-components=1
|
|
chown -R ${MEDIAWIKI_USER}:${MEDIAWIKI_USER} \"${DST}\"
|
|
rm -f /tmp/${EXT_NAME}.tar.gz
|
|
echo INSTALLED:${EXT_NAME}
|
|
else
|
|
rm -f /tmp/${EXT_NAME}.tar.gz
|
|
echo PRESENT:${EXT_NAME}
|
|
fi
|
|
"
|