Keep the files for the server in one directory

The resources were copied from home/ and admin/, which held the same
files a second time. Everything that goes to the server is in resources/
now, and the generator only writes the four text files.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Zebreus 2026-10-25 14:01:27 +01:00
commit fd1e379fcf

View file

@ -1,9 +1,8 @@
# Builds the files for the home directories of the shell server in ../resources: the home of the root user with
# README, README.en, CODE_OF_CONDUCT and CODE_OF_CONDUCT.en as the website's pages in terminal text with escape
# sequences, and the files of ../home and ../admin, which are copied as they are.
# Builds the text files for the home directory of the shell server's root user in ../resources/home: README,
# README.en, CODE_OF_CONDUCT and CODE_OF_CONDUCT.en as the website's pages in terminal text with escape sequences.
# The other files there are edited by hand.
# Usage: python3 server/scripts/make_files.py
import pathlib
import shutil
import textwrap
ESC = '\x1b'
@ -331,19 +330,8 @@ COC_EN = {
'footer': [('Home', f'{SITE}en.html'), ('Legal notice', IMPRESSUM)],
}
out = pathlib.Path(__file__).parent.parent / 'resources'
(out / 'home').mkdir(parents=True, exist_ok=True)
out = pathlib.Path(__file__).parent.parent / 'resources' / 'home'
out.mkdir(parents=True, exist_ok=True)
for name, text in [('README', readme(DE)), ('README.en', readme(EN)),
('CODE_OF_CONDUCT', code_of_conduct(COC_DE)), ('CODE_OF_CONDUCT.en', code_of_conduct(COC_EN))]:
(out / 'home' / name).write_text(text, encoding='utf-8')
# The files of the home directories are not generated, they are copied from ../home and ../admin, where they are
# edited.
for source in 'home', 'admin':
root = pathlib.Path(__file__).parent.parent / source
for path in root.rglob('*'):
target = out / source / path.relative_to(root)
if path.is_dir():
target.mkdir(parents=True, exist_ok=True)
else:
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(path, target)
(out / name).write_text(text, encoding='utf-8')