mirror of
https://github.com/dragonlock2/matthewtran.com.git
synced 2026-02-04 01:37:44 +00:00
add weston support
This commit is contained in:
parent
542d653d17
commit
0fa04ef46f
@ -17,6 +17,7 @@ UIDS = {
|
|||||||
"crypto" : 1002,
|
"crypto" : 1002,
|
||||||
"game" : 1003,
|
"game" : 1003,
|
||||||
"nas" : 1004,
|
"nas" : 1004,
|
||||||
|
"tv" : 1005,
|
||||||
}
|
}
|
||||||
|
|
||||||
PORTS = {
|
PORTS = {
|
||||||
@ -41,6 +42,7 @@ PORTS = {
|
|||||||
"nas": [
|
"nas": [
|
||||||
"445:445", # nas
|
"445:445", # nas
|
||||||
],
|
],
|
||||||
|
"tv": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
def check_keys():
|
def check_keys():
|
||||||
@ -142,10 +144,9 @@ def add_more_drive():
|
|||||||
})
|
})
|
||||||
|
|
||||||
def add_packages():
|
def add_packages():
|
||||||
# TODO update once done https://github.com/coreos/fedora-coreos-tracker/issues/681
|
|
||||||
but["systemd"] = {
|
but["systemd"] = {
|
||||||
"units": [
|
"units": [
|
||||||
{
|
{ # TODO update once done https://github.com/coreos/fedora-coreos-tracker/issues/681
|
||||||
"name": "rpm-ostree-install.service",
|
"name": "rpm-ostree-install.service",
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"contents": "\n".join([
|
"contents": "\n".join([
|
||||||
@ -158,13 +159,17 @@ def add_packages():
|
|||||||
"[Service]",
|
"[Service]",
|
||||||
"Type=oneshot",
|
"Type=oneshot",
|
||||||
"RemainAfterExit=yes",
|
"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([
|
"ExecStart=/usr/bin/rpm-ostree install -y --allow-inactive " + " ".join([
|
||||||
|
"alsa-utils",
|
||||||
"avahi",
|
"avahi",
|
||||||
|
"firefox",
|
||||||
"htop",
|
"htop",
|
||||||
"python3",
|
"python3",
|
||||||
|
"seatd",
|
||||||
"tmux",
|
"tmux",
|
||||||
"vim",
|
"vim",
|
||||||
|
"weston",
|
||||||
"zip",
|
"zip",
|
||||||
]),
|
]),
|
||||||
"ExecStart=/bin/touch /etc/rpm/%N.stamp",
|
"ExecStart=/bin/touch /etc/rpm/%N.stamp",
|
||||||
@ -173,6 +178,26 @@ def add_packages():
|
|||||||
"WantedBy=multi-user.target",
|
"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 +226,14 @@ def allow_port_access():
|
|||||||
"contents": { "inline": "net.ipv4.ip_unprivileged_port_start=80" },
|
"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():
|
def add_users():
|
||||||
for user in UIDS:
|
for user in UIDS:
|
||||||
but["passwd"]["users"].append({
|
but["passwd"]["users"].append({
|
||||||
@ -212,6 +245,10 @@ def add_users():
|
|||||||
"path": f"/var/lib/systemd/linger/{user}",
|
"path": f"/var/lib/systemd/linger/{user}",
|
||||||
"contents": { "inline": "" },
|
"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():
|
def copy_source():
|
||||||
but["storage"]["directories"].append({
|
but["storage"]["directories"].append({
|
||||||
@ -372,6 +409,7 @@ if __name__ == "__main__":
|
|||||||
add_ssh_keys()
|
add_ssh_keys()
|
||||||
set_hostname()
|
set_hostname()
|
||||||
allow_port_access()
|
allow_port_access()
|
||||||
|
allow_nouveau()
|
||||||
|
|
||||||
# server setup
|
# server setup
|
||||||
add_users()
|
add_users()
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"stash_key": "<LUKS key>",
|
"stash_key": "<LUKS key>",
|
||||||
"stash_wipe": false,
|
"stash_wipe": false,
|
||||||
"data_dir": "/var/home/core/matthewtrancom_data"
|
"data_dir": "/var/mnt/stash/data",
|
||||||
|
"tv_passwd": "password"
|
||||||
},
|
},
|
||||||
"drives": [
|
"drives": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,6 +23,7 @@ IMAGES = {
|
|||||||
"nas": [
|
"nas": [
|
||||||
"nas",
|
"nas",
|
||||||
],
|
],
|
||||||
|
"tv": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
def generate(cfg):
|
def generate(cfg):
|
||||||
@ -85,6 +86,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# run builds
|
# run builds
|
||||||
for user in IMAGES:
|
for user in IMAGES:
|
||||||
|
if not IMAGES[user]:
|
||||||
|
continue
|
||||||
print(f"building images for {user}...")
|
print(f"building images for {user}...")
|
||||||
run([f"cd {SOURCE_DIR}"] + [
|
run([f"cd {SOURCE_DIR}"] + [
|
||||||
f"sudo -u {user} podman build --tag {i} {SOURCE_DIR}/{i}"
|
f"sudo -u {user} podman build --tag {i} {SOURCE_DIR}/{i}"
|
||||||
@ -93,6 +96,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# restart pods
|
# restart pods
|
||||||
for user in IMAGES:
|
for user in IMAGES:
|
||||||
|
if not IMAGES[user]:
|
||||||
|
continue
|
||||||
print(f"restarting pod for {user}...")
|
print(f"restarting pod for {user}...")
|
||||||
run([
|
run([
|
||||||
f"cd {SOURCE_DIR}",
|
f"cd {SOURCE_DIR}",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user