forked from unimatrix/web
12 lines
798 B
Python
12 lines
798 B
Python
"""Publish the separate clan CP shell through the existing clan virtual host."""
|
|
from pathlib import Path
|
|
import os
|
|
import sys
|
|
source=Path(__file__).resolve().parents[1]/'ops'
|
|
target=Path('/home/dunerealms/htdocs/clans.dunerealms.com')
|
|
files={'index.html':(source/'clan-center-index.html').read_bytes(),'clan-shell.js':(source/'clan-cp-shell.js').read_bytes()}
|
|
if '--apply' not in sys.argv:print('Plan: publish separate Clan CP shell');sys.exit(0)
|
|
if os.geteuid()!=0:raise RuntimeError('Deployment operator required')
|
|
for name,data in files.items():
|
|
path=target/name;stat=path.stat();temporary=path.with_name(name+'.clan-cp-new');temporary.write_bytes(data);temporary.chmod(0o644);os.chown(temporary,stat.st_uid,stat.st_gid);os.replace(temporary,path)
|
|
print('Published separate Clan CP shell')
|

Staff