diff options
Diffstat (limited to 'cgit/sync.py')
-rw-r--r-- | cgit/sync.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cgit/sync.py b/cgit/sync.py new file mode 100644 index 0000000..506c811 --- /dev/null +++ b/cgit/sync.py @@ -0,0 +1,21 @@ +from commia.prelude import * +from commia.ssh import scp, ssh_args +from commia.util import with_written + +run_check( + [*ssh_args(), "sh", "-c", "cat > /usr/bin/cgit-about-filter.sh"], + input=b"#!/bin/sh\nmd2html", # discard arguments +) +run_check([*ssh_args(), "chmod", "+x", "/usr/bin/cgit-about-filter.sh"]) +scp("cgit/public", "asylum:/etc/cgit/public") +scp("cgit/private", "asylum:/etc/cgit/private") +if Path("cgit/css").exists(): + scp("cgit/css/style.css", "asylum:/usr/share/webapps/cgit/style.css") + scp("cgit/css/scopes", "asylum:/usr/share/cgit-syntect/scopes") + +for sym, vis in [("🗝", "public"), ("⛯", "private")]: + with_written( + f"<a href=/{'priv' if vis == 'public' else ''} id=visibility>{sym}</a>", + lambda path: scp(path, f"asylum:/etc/cgit/{vis}-header.html"), + ) + run([*ssh_args(), "chmod", "+r", f"/etc/cgit/{vis}-header.html"]) |