feat(news-aq): implement daily 00:00 GMT current-events pipeline, TZ handling, Nov 2 dossier, and RHEL packaging
This commit is contained in:
1 parent
ed3b3a2b60
commit
9861367f34
34 files changed
+10736
-121
No files matched your search
Executable
+78
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
# install.sh — Idempotent Portable Installer for current-events-isopsephic-exegesis
|
||||
# Supports RHEL 8/9/10, Fedora, Rocky, AlmaLinux, Debian/Ubuntu, and macOS.
|
||||
# Pays strict attention to env TZ when registering the daily 00:00 GMT (UTC) cron job.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BUNDLE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}"
|
||||
SKILLS_DEST="${HERMES_SKILLS_DIR:-$HERMES_HOME/skills/creative}"
|
||||
WORKSPACE_DIR="${WORKSPACE_DIR:-/workspace}"
|
||||
SCRIPTS_DEST="${HERMES_SCRIPTS_DIR:-$HERMES_HOME/scripts}"
|
||||
|
||||
echo "[1/5] Detecting environment and timezone offset for 00:00 GMT target..."
|
||||
HOST_TZ="${TZ:-}"
|
||||
if [ -z "$HOST_TZ" ] && [ -f /etc/timezone ]; then
|
||||
HOST_TZ="$(cat /etc/timezone | tr -d '[:space:]')"
|
||||
elif [ -z "$HOST_TZ" ] && [ -L /etc/localtime ]; then
|
||||
HOST_TZ="$(readlink /etc/localtime | sed 's|.*/zoneinfo/||')"
|
||||
fi
|
||||
HOST_TZ="${HOST_TZ:-UTC}"
|
||||
|
||||
# Compute local hour corresponding to 00:00 UTC using Python
|
||||
CRON_HOUR_LOCAL="$(python3 -c '
|
||||
import datetime
|
||||
utc_midnight = datetime.datetime(2026, 11, 2, 0, 0, tzinfo=datetime.timezone.utc)
|
||||
local_dt = utc_midnight.astimezone()
|
||||
print(local_dt.hour)
|
||||
')"
|
||||
CRON_MIN_LOCAL="$(python3 -c '
|
||||
import datetime
|
||||
utc_midnight = datetime.datetime(2026, 11, 2, 0, 0, tzinfo=datetime.timezone.utc)
|
||||
local_dt = utc_midnight.astimezone()
|
||||
print(local_dt.minute)
|
||||
')"
|
||||
CRON_EXPR="${CRON_MIN_LOCAL} ${CRON_HOUR_LOCAL} * * *"
|
||||
echo " -> Detected Host TZ: ${HOST_TZ} (00:00 GMT maps to local cron '${CRON_EXPR}')"
|
||||
|
||||
echo "[2/5] Installing skills into ${SKILLS_DEST}..."
|
||||
mkdir -p "${SKILLS_DEST}" 2>/dev/null || true
|
||||
if [ -w "${SKILLS_DEST}" ]; then
|
||||
cp -a "${BUNDLE_DIR}/skills/"* "${SKILLS_DEST}/"
|
||||
echo " -> Installed current-events-isopsephic-exegesis, phonetic-and-gematria-ciphers, hyperdope-ingglish-ci"
|
||||
else
|
||||
echo " -> ${SKILLS_DEST} is read-only (container mount); skipping skill copy."
|
||||
fi
|
||||
|
||||
echo "[3/5] Unpacking offline-vendored ingglish npm runtime into ${WORKSPACE_DIR}/node_modules..."
|
||||
mkdir -p "${WORKSPACE_DIR}/node_modules"
|
||||
tar -xzf "${BUNDLE_DIR}/vendor/ingglish-vendor.tgz" -C "${WORKSPACE_DIR}/node_modules"
|
||||
|
||||
echo "[4/5] Installing deterministic collector & CI scripts..."
|
||||
mkdir -p "${WORKSPACE_DIR}/ingglish-aq-archive/scripts"
|
||||
cp -f "${BUNDLE_DIR}/scripts/collect_news_aq.py" "${WORKSPACE_DIR}/ingglish-aq-archive/scripts/collect_news_aq.py"
|
||||
cp -f "${BUNDLE_DIR}/scripts/ci_provision_ingglish.py" "${WORKSPACE_DIR}/ingglish-aq-archive/scripts/ci_provision_ingglish.py"
|
||||
chmod 0755 "${WORKSPACE_DIR}/ingglish-aq-archive/scripts/collect_news_aq.py" \
|
||||
"${WORKSPACE_DIR}/ingglish-aq-archive/scripts/ci_provision_ingglish.py"
|
||||
|
||||
if mkdir -p "${SCRIPTS_DEST}" 2>/dev/null && [ -w "${SCRIPTS_DEST}" ]; then
|
||||
cp -f "${BUNDLE_DIR}/scripts/collect_news_aq.py" "${SCRIPTS_DEST}/collect_news_aq.py"
|
||||
chmod 0755 "${SCRIPTS_DEST}/collect_news_aq.py"
|
||||
fi
|
||||
|
||||
echo "[5/5] Verifying SELinux labels (RHEL/Fedora) & registering 00:00 GMT schedule..."
|
||||
if command -v chcon >/dev/null 2>&1 && [ -d /var/lib/ingglish-aq-archive ]; then
|
||||
chcon -Rt container_file_t /var/lib/ingglish-aq-archive 2>/dev/null || true
|
||||
fi
|
||||
|
||||
if command -v hermes >/dev/null 2>&1; then
|
||||
echo " -> Registering via hermes cron..."
|
||||
hermes cron add --name "current-events-isopsephic-exegesis-daily-0000-gmt" \
|
||||
--schedule "${CRON_EXPR}" \
|
||||
--skill "current-events-isopsephic-exegesis" \
|
||||
--skill "phonetic-and-gematria-ciphers" \
|
||||
--prompt "Execute current-events-isopsephic-exegesis for the completed UTC day (TZ=UTC collect_news_aq.py --mode closing-bell)." 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "Installation complete. Verified offline Ingglish + Base-36 AQ readiness."
|
||||
Reference in new issue
Block a user