#!/bin/bash set -e APP_DIR="/home/def/otb_billing" cd "$APP_DIR" || exit 1 STAMP="$(date +%Y%m%d-%H%M%S)" BKDIR="backups/shared-brand-$STAMP" mkdir -p "$BKDIR" cp -av templates/includes/site_nav.html static/css/style.css templates/portal_*.html "$BKDIR"/ cp -av /home/def/otb-shared-brand/header.html templates/includes/site_nav.html FOOTER="$(cat /home/def/otb-shared-brand/footer.html)" BRANDCSS="$(cat /home/def/otb-shared-brand/brand.css)" python3 - <' in text: text = re.sub(r'
.*?
\s*', footer, text, count=1, flags=re.S) else: text = text.replace('{% include "footer.html" %}', footer + '\n\n {% include "footer.html" %}') p.write_text(text, encoding="utf-8") cssp = Path("static/css/style.css") css = cssp.read_text(encoding="utf-8") if "/* ===== OTB shared branding ===== */" in css: css = re.sub(r'/\* ===== OTB shared branding ===== \*/.*', brandcss, css, flags=re.S) else: css += "\n\n" + brandcss cssp.write_text(css, encoding="utf-8") print("portal deploy complete") PY sudo systemctl restart otb_billing.service