Compare commits

..

3 Commits

Author SHA1 Message Date
Matthew Tran
71988b74ff add chromium too 2026-01-23 05:09:49 -08:00
Matthew Tran
cdbacd6edd add sway too 2026-01-23 03:35:25 -08:00
Matthew Tran
0fa04ef46f add weston support 2026-01-23 02:28:53 -08:00
3 changed files with 50 additions and 4 deletions

View File

@ -17,6 +17,7 @@ UIDS = {
"crypto" : 1002,
"game" : 1003,
"nas" : 1004,
"tv" : 1005,
}
PORTS = {
@ -41,6 +42,7 @@ PORTS = {
"nas": [
"445:445", # nas
],
"tv": [],
}
def check_keys():
@ -142,10 +144,9 @@ def add_more_drive():
})
def add_packages():
# TODO update once done https://github.com/coreos/fedora-coreos-tracker/issues/681
but["systemd"] = {
"units": [
{
{ # TODO update once done https://github.com/coreos/fedora-coreos-tracker/issues/681
"name": "rpm-ostree-install.service",
"enabled": True,
"contents": "\n".join([
@ -158,13 +159,19 @@ def add_packages():
"[Service]",
"Type=oneshot",
"RemainAfterExit=yes",
f"ExecStart=/usr/bin/usermod -a -G {",".join(UIDS.keys())} core",
f"ExecStart=/usr/bin/usermod -aG {",".join(UIDS.keys())} core",
"ExecStart=/usr/bin/rpm-ostree install -y --allow-inactive " + " ".join([
"alsa-utils",
"avahi",
"chromium",
"firefox",
"htop",
"python3",
"seatd",
"sway",
"tmux",
"vim",
"weston",
"zip",
]),
"ExecStart=/bin/touch /etc/rpm/%N.stamp",
@ -173,6 +180,26 @@ def add_packages():
"WantedBy=multi-user.target",
]),
},
{ # TODO update once done https://github.com/coreos/rpm-ostree/issues/49
"name": "post-rpm-ostree-install.service",
"enabled": True,
"contents": "\n".join([
"[Unit]",
"Description=Post package install setup",
"After=local-fs.target",
"ConditionPathExists=/etc/rpm/rpm-ostree-install.stamp",
"ConditionPathExists=!/etc/rpm/%N.stamp",
"[Service]",
"Type=oneshot",
"RemainAfterExit=yes",
"ExecStart=/usr/bin/sh -c 'grep -E \"^(audio|seat|video):\" /usr/lib/group >> /etc/group'",
"ExecStart=/usr/bin/usermod -aG audio,seat,video tv",
"ExecStart=/usr/bin/systemctl enable --now seatd",
"ExecStart=/bin/touch /etc/rpm/%N.stamp",
"[Install]",
"WantedBy=multi-user.target",
]),
},
],
}
@ -201,6 +228,14 @@ def allow_port_access():
"contents": { "inline": "net.ipv4.ip_unprivileged_port_start=80" },
})
def allow_nouveau():
but["storage"]["files"].append({
"path": "/etc/modprobe.d/blacklist-nouveau.conf",
"mode": 0o644,
"overwrite": True,
"contents": { "inline": "" }
})
def add_users():
for user in UIDS:
but["passwd"]["users"].append({
@ -212,6 +247,10 @@ def add_users():
"path": f"/var/lib/systemd/linger/{user}",
"contents": { "inline": "" },
})
if user == "tv":
but["passwd"]["users"][-1]["password_hash"] = subprocess.run(
["docker", "run", "-it", "--rm", "quay.io/coreos/mkpasswd", "--method=yescrypt", cfg["core"]["tv_passwd"]],
capture_output=True, text=True, check=True).stdout.strip()
def copy_source():
but["storage"]["directories"].append({
@ -372,6 +411,7 @@ if __name__ == "__main__":
add_ssh_keys()
set_hostname()
allow_port_access()
allow_nouveau()
# server setup
add_users()

View File

@ -6,7 +6,8 @@
],
"stash_key": "<LUKS key>",
"stash_wipe": false,
"data_dir": "/var/home/core/matthewtrancom_data"
"data_dir": "/var/mnt/stash/data",
"tv_passwd": "password"
},
"drives": [
{

View File

@ -23,6 +23,7 @@ IMAGES = {
"nas": [
"nas",
],
"tv": [],
}
def generate(cfg):
@ -85,6 +86,8 @@ if __name__ == "__main__":
# run builds
for user in IMAGES:
if not IMAGES[user]:
continue
print(f"building images for {user}...")
run([f"cd {SOURCE_DIR}"] + [
f"sudo -u {user} podman build --tag {i} {SOURCE_DIR}/{i}"
@ -93,6 +96,8 @@ if __name__ == "__main__":
# restart pods
for user in IMAGES:
if not IMAGES[user]:
continue
print(f"restarting pod for {user}...")
run([
f"cd {SOURCE_DIR}",