Files
snek/terminal/entry
T
retoor dc0edf6058 feat: switch container user to root and add welcome bootstrap for dev environment
- Change container user from 'ubuntu' to 'root' in Dockerfile and docker-compose config
- Set working directory to /home/retoor/projects/snek and inject SNEK_UID environment variable
- Add root password setup and copy terminal bootstrap files (entry script, .welcome.txt) into container image
- Refactor compose exec/start methods to capture stdout/stderr via pipes and handle empty output gracefully
- Remove strict returncode check in exec method, replacing with debug print for non-zero exits
2025-06-10 23:21:21 +00:00

27 lines
709 B
Python
Executable File

#!/usr/bin/env python3
import os
import sys
import pathlib
import os
os.chdir("/root")
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, "/root/bin")
sys.path.insert(0, "/root/bin/local/bin")
if not pathlib.Path(".welcome.txt").exists():
os.system("python3 -m venv --prompt '' .venv")
os.system("cp -r /opt/bootstrap/root/.* /root")
os.system("cp /opt/bootstrap/.welcome.txt /root/.welcome.txt")
pathlib.Path(".bashrc").write_text(pathlib.Path(".bashrc").read_text() + "\n" + "source .venv/bin/activate")
os.environ["SNEK"] = "1"
if pathlib.Path(".welcome.txt").exists():
with open(".welcome.txt") as f:
print(f.read())
os.system("bash")