aboutsummaryrefslogtreecommitdiff
path: root/workstation
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2026-12-05 22:09:29 +0100
committeralex <alex@pdp7.net>2026-12-05 22:09:29 +0100
commit23199f5526db9be1d43a900dc8b8674a7babb966 (patch)
treea71fb5363998439c2edfada2940fe9ead8841180 /workstation
parentabd668108d9932e39c5de075b9aee116f667987f (diff)
Somewhat blocked by https://bugzilla.redhat.com/show_bug.cgi?id=2521543
Diffstat (limited to 'workstation')
-rw-r--r--workstation/README.md3
-rwxr-xr-xworkstation/root-setup.py12
-rwxr-xr-xworkstation/test.py41
-rwxr-xr-xworkstation/user-setup.py18
4 files changed, 74 insertions, 0 deletions
diff --git a/workstation/README.md b/workstation/README.md
new file mode 100644
index 00000000..6a13bd3a
--- /dev/null
+++ b/workstation/README.md
@@ -0,0 +1,3 @@
+# workstation
+
+Yet another attempt to automate workstation configuration because I am stubborn and I do not want to lock myself into any Linux distro.
diff --git a/workstation/root-setup.py b/workstation/root-setup.py
new file mode 100755
index 00000000..4d764a50
--- /dev/null
+++ b/workstation/root-setup.py
@@ -0,0 +1,12 @@
+#!/usr/bin/python3
+import subprocess
+
+
+def _(*args):
+ subprocess.run(args, check=True)
+
+
+_("apt", "update")
+_("apt", "install", "-y", "git", "tasksel", "pipx")
+_("tasksel", "install", "desktop")
+_("systemctl", "start", "gdm3")
diff --git a/workstation/test.py b/workstation/test.py
new file mode 100755
index 00000000..92aeb0c7
--- /dev/null
+++ b/workstation/test.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python3
+import os
+import pathlib
+import subprocess
+
+
+INSTANCE_NAME="workstation-test"
+USER="alex"
+
+THIS_REPO = pathlib.Path(__file__).parent.parent
+THIS_UID = os.getuid()
+
+
+def _(*args, check=True, input=None):
+ return subprocess.run(args, check=check, input=input, text=True)
+
+
+# _("incus", "launch",
+# "images:debian/13",
+# INSTANCE_NAME,
+# "--ephemeral",
+# "--vm",
+# "-c", "limits.cpu=4",
+# "-c", "limits.memory=6GiB",
+# "-d", "root,size=50GiB")
+
+# while _("incus", "exec", INSTANCE_NAME, "uptime", check=False).returncode != 0:
+# print("waiting...")
+# time.sleep(1)
+
+# _("incus", "config", "device", "add", INSTANCE_NAME, "here", "disk", f"source={THIS_REPO}", "path=/here")
+# _("incus", "exec", INSTANCE_NAME, "--", "apt", "full-upgrade", "-U")
+# _("incus", "exec", INSTANCE_NAME, "--", "apt", "install", "-y", "python3")
+# _("incus", "exec", INSTANCE_NAME, "--", "/here/workstation/root-setup.py")
+# _("incus", "exec", INSTANCE_NAME, "--", "adduser", USER, "--disabled-password", "--comment", "")
+# _("incus", "exec", INSTANCE_NAME, "--", "passwd", USER, "--stdin", input=USER)
+
+# Comment out to test with real repo
+_("incus", "exec", INSTANCE_NAME, "--", "mount", "/here/", f"/home/{USER}/git/alexpdp7/", "-o", f"bind,X-mount.idmap={THIS_UID}:1000:1")
+
+_("incus", "exec", INSTANCE_NAME, "--", "sudo", "-u", USER, "/here/workstation/user-setup.py")
diff --git a/workstation/user-setup.py b/workstation/user-setup.py
new file mode 100755
index 00000000..535aa968
--- /dev/null
+++ b/workstation/user-setup.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python3
+import pathlib
+import subprocess
+
+
+def _(*args):
+ subprocess.run(args, check=True)
+
+HOME = pathlib.Path.home()
+BIN = HOME / ".local" / "bin"
+GIT = HOME / "git"
+ALEXPDP7_REPO = GIT / "alexpdp7"
+
+if not ALEXPDP7_REPO.exists():
+ _("git", "clone", "https://github.com/alexpdp7/alexpdp7.git", ALEXPDP7_REPO)
+
+_("pipx", "install", "-e", ALEXPDP7_REPO / "scripts", "--force")
+_(BIN / "setup-ubpkg")