fix: add a base arch profile

This commit is contained in:
2025-08-02 14:05:36 +02:00
parent b201011fa9
commit 3d6aea794c
+21 -22
View File
@@ -19,26 +19,23 @@ class Installer:
self.script_dir = self.script_file.parent self.script_dir = self.script_file.parent
self.source_dir = self.script_dir self.source_dir = self.script_dir
self.dest_dir = Path.home() self.dest_dir = Path.home()
self.distro = platform.freedesktop_os_release().get("NAME", "Unknown") self.distro = platform.freedesktop_os_release().get("NAME", "Unknown")
self.profile = profile self.profile = profile
self.has_error = False self.has_error = False
# Package query functions by distro
self.pkg_query = {"Arch Linux": self._pkg_query_arch} self.pkg_query = {"Arch Linux": self._pkg_query_arch}
# Packages by distro and profile
self.pkgs = { self.pkgs = {
"Arch Linux hyprland": [ "Arch Linux base": [
"alacritty", "alacritty",
"tmux", "tmux",
"zsh", "zsh",
"libnewt",
"vim", "vim",
"unzip", "unzip",
"npm", "npm",
"nvim", "nvim",
"firefox", "firefox",
],
"Arch Linux hyprland": [
"libnewt",
"hyprland", "hyprland",
"uwsm", "uwsm",
"fnott", "fnott",
@@ -62,9 +59,8 @@ class Installer:
"breeze", "breeze",
"pavucontrol", "pavucontrol",
"otf-font-awesome", "otf-font-awesome",
] ],
} }
self.symlinks = [ self.symlinks = [
".config/alacritty", ".config/alacritty",
".config/dolphinrc", ".config/dolphinrc",
@@ -103,15 +99,12 @@ class Installer:
".Xresources", ".Xresources",
".zprofile", ".zprofile",
] ]
self.copies = [ self.copies = [
".config/gtk-3.0", ".config/gtk-3.0",
".config/gtk-4.0", ".config/gtk-4.0",
".gtkrc-2.0", ".gtkrc-2.0",
] ]
self.symlink_map = {"zsh/rc": ".zshrc"} self.symlink_map = {"zsh/rc": ".zshrc"}
self.gsettings = [ self.gsettings = [
["org.gnome.desktop.interface", "color-scheme", "prefer-dark"] ["org.gnome.desktop.interface", "color-scheme", "prefer-dark"]
] ]
@@ -139,19 +132,27 @@ class Installer:
def check_packages_installed(self) -> None: def check_packages_installed(self) -> None:
"""Check if required packages are installed.""" """Check if required packages are installed."""
key = f"{self.distro} {self.profile}" profile = f"{self.distro} {self.profile}"
if key not in self.pkgs: if profile not in self.pkgs:
self.error(f"No package list defined for {key}") self.error(f"No package list defined for {profile}")
return return
if self.distro not in self.pkg_query: if self.distro not in self.pkg_query:
self.error(f"No package query function for {self.distro}") self.error(f"No package query function for {self.distro}")
return return
missing: list[str] = [] pkg_list: list[str] = []
pkg_list = self.pkgs[key]
if self.profile != "base":
base = f"{self.distro} base"
if base in self.pkgs:
pkg_list.extend(self.pkgs[base])
pkg_list.extend(self.pkgs[profile])
print("Package list:", pkg_list)
query_func = self.pkg_query[self.distro] query_func = self.pkg_query[self.distro]
missing: list[str] = []
for pkg in pkg_list: for pkg in pkg_list:
if not query_func(pkg): if not query_func(pkg):
missing.append(pkg) missing.append(pkg)
@@ -313,7 +314,8 @@ class Installer:
except FileNotFoundError: except FileNotFoundError:
self.error("infocmp command not found") self.error("infocmp command not found")
def set_gsettings(self): def set_gsettings(self) -> None:
"""Set gsettings."""
for setting in self.gsettings: for setting in self.gsettings:
result = subprocess.run( result = subprocess.run(
["gsettings", "set", *setting], ["gsettings", "set", *setting],
@@ -322,10 +324,7 @@ class Installer:
check=False, check=False,
) )
if result.returncode != 0: if result.returncode != 0:
self.error( self.error(f"Failed to set gsettings: {setting}")
f"Failed to set gsettings: {setting}"
)
def run( def run(
self, self,