1
0
Fork 0

generate: generate: Add a identifying header to generated scripts

Add a header stating that the script was generated, which version
generated it and where to send bug reports.

Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
Enno Tensing 2025-07-29 09:38:39 +02:00
parent ff663f7835
commit ba7827d83b
Signed by: tenno
GPG key ID: 95265603BD36E66C

View file

@ -14,6 +14,14 @@ from pathlib import Path
from container import ConfigError, Container from container import ConfigError, Container
from log import Log from log import Log
GENERATE_VERSION = "0.0.2"
HEADER = f"""#!/bin/sh
# This script was generated by containerctl v{GENERATE_VERSION}
# Report bugs with _this script_ to <tenno+containerctl@suij.in>
"""
def load_container_config(file: Path, log: Log) -> dict | None: def load_container_config(file: Path, log: Log) -> dict | None:
"""Load a container config.""" """Load a container config."""
@ -107,7 +115,7 @@ def main() -> None:
if script_content == "": if script_content == "":
script_content = "true" script_content = "true"
with s.open("w+", encoding="utf-8") as f: with s.open("w+", encoding="utf-8") as f:
f.write("#!/bin/sh\n") f.write(HEADER)
f.write(script_content) f.write(script_content)
s.chmod( s.chmod(
stat.S_IRWXU stat.S_IRWXU