diff options
author | mia <mia@mia.jetzt> | 2024-06-08 22:56:05 -0700 |
---|---|---|
committer | mia <mia@mia.jetzt> | 2024-06-08 22:56:05 -0700 |
commit | 8cf813ff033bbc98a7dd40db6ac11e2e35c7e997 (patch) | |
tree | a451059194cbd4ba90993ebdaced4749448ec4df /cgit/sync.py | |
download | asylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.tar.gz asylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.zip |
initial commit
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"]) |