cd /home/def/otb_billing || exit 1 set -e STAMP="$(date +%Y%m%d-%H%M%S)" echo "===== backups =====" cp templates/includes/site_nav.html "templates/includes/site_nav.html.bak.${STAMP}" cp templates/portal_login.html "templates/portal_login.html.bak.${STAMP}" cp templates/portal_dashboard.html "templates/portal_dashboard.html.bak.${STAMP}" 2>/dev/null || true cp templates/portal_set_password.html "templates/portal_set_password.html.bak.${STAMP}" 2>/dev/null || true cp templates/portal_terms.html "templates/portal_terms.html.bak.${STAMP}" 2>/dev/null || true cp templates/portal_invoice_detail.html "templates/portal_invoice_detail.html.bak.${STAMP}" 2>/dev/null || true cp templates/portal_forgot_password.html "templates/portal_forgot_password.html.bak.${STAMP}" 2>/dev/null || true echo "===== replace shared nav include from otb-shared-brand =====" cp /opt/otb/otb-shared-brand/fragments/header.html templates/includes/site_nav.html echo "===== create shared portal statusbar include =====" cat > templates/includes/otb_statusbar.html <<'EOF'
EOF echo "===== replace inline portal statusbars with include =====" python3 <<'PY' from pathlib import Path import re files = [ Path("templates/portal_login.html"), Path("templates/portal_dashboard.html"), Path("templates/portal_set_password.html"), Path("templates/portal_terms.html"), Path("templates/portal_invoice_detail.html"), Path("templates/portal_forgot_password.html"), ] replacement = '{% include "includes/otb_statusbar.html" %}' for p in files: if not p.exists(): continue text = p.read_text() new_text = re.sub( r'\s*', replacement, text, count=1, flags=re.S ) if new_text != text: p.write_text(new_text) print(f"updated: {p}") else: print(f"no inline statusbar found: {p}") PY echo "===== verify includes =====" grep -n "video.outsidethebox.top" templates/includes/site_nav.html grep -Rni 'includes/otb_statusbar.html' templates/portal_*.html | sed -n '1,50p' echo "===== restart service =====" sudo systemctl restart otb-billing echo "===== quick verify from template side =====" sed -n '1,40p' templates/includes/site_nav.html