🗝
summary refs log tree commit diff
path: root/cgit/sync.py
blob: 506c81101cd8e71b902fa4f2ffe93a83ef3485d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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"])