fix: do not (mostly) handle /var/cache/blendOS explicitly

This commit is contained in:
Rudra Saraswat 2026-04-02 01:03:52 +01:00
parent b53795bddb
commit 956ef6fb01
3 changed files with 9 additions and 31 deletions

View file

@ -31,33 +31,6 @@ class RootFS:
def init(self) -> subprocess.CompletedProcess:
"""Initialise rootfs."""
# Create blendOS cache directory
Path("/var/cache/blendOS").mkdir(parents=True, exist_ok=True)
Path(os.path.join(self.rootfs_path, "var/cache/blendOS")).mkdir(
parents=True, exist_ok=True
)
# subprocess.run(
# ["rm", "-rf", "--", os.path.join(self.rootfs_path, "var/cache/blendOS")]
# )
# subprocess.run(
# [
# "cp",
# "-a",
# "--",
# "/var/cache/blendOS",
# os.path.join(self.rootfs_path, "var/cache/blendOS"),
# ]
# )
subprocess.run(
[
"mount",
"--bind",
"/var/cache/blendOS",
os.path.join(self.rootfs_path, "var/cache/blendOS"),
]
)
completedProcess = subprocess.run(
["bash", "-s"],
text=True,
@ -65,8 +38,6 @@ class RootFS:
cwd=self.rootfs_path,
)
subprocess.run(["umount", os.path.join(self.rootfs_path, "var/cache/blendOS")])
return completedProcess
def exec(self, cmd, **kwargs) -> subprocess.CompletedProcess:
@ -81,7 +52,6 @@ class RootFS:
"systemd-nspawn",
"--quiet",
"--pipe",
"--bind=/var/cache/blendOS",
"-D",
self.rootfs_path,
]

View file

@ -17,7 +17,13 @@ def gen_rootfs(system_config: dict, rootfs_path: str) -> RootFS:
"""Generates a rootfs for a given system configuration."""
rootfs = RootFS(rootfs_path, system_config["distro-config"])
rootfs.init()
subprocess.run(
["bash", "-s"],
text=True,
input=system_config["distro-config"]["before-stages"],
cwd=rootfs_path,
)
modules = {}

View file

@ -13,6 +13,8 @@ from .gen_rootfs import gen_rootfs
def update_cleanup() -> None:
"""Clean-up from previous rebase/update."""
# FIXME: should not ideally handle /var/cache/blendOS explicitly
subprocess.run(
["umount", "-l", "/var/cache/akshara/rootfs/var/cache/blendOS"],
stdout=subprocess.DEVNULL,