From 00b0ae7ba439a5a420095175b3bedd52c569db51 Mon Sep 17 00:00:00 2001 From: Daniel Girtler Date: Wed, 19 Apr 2023 20:55:42 +1000 Subject: PyParted and a large rewrite of the underlying partitioning (#1604) * Invert mypy files * Add optional pre-commit hooks * New profile structure * Serialize profiles * Use profile instead of classmethod * Custom profile setup * Separator between back * Support profile import via url * Move profiles module * Refactor files * Remove symlink * Add user to docker group * Update schema description * Handle list services * mypy fixes * mypy fixes * Rename profilesv2 to profiles * flake8 * mypy again * Support selecting DM * Fix mypy * Cleanup * Update greeter setting * Update schema * Revert toml changes * Poc external dependencies * Dependency support * New encryption menu * flake8 * Mypy and flake8 * Unify lsblk command * Update bootloader configuration * Git hooks * Fix import * Pyparted * Remove custom font setting * flake8 * Remove default preview * Manual partitioning menu * Update structure * Disk configuration * Update filesystem * luks2 encryption * Everything works until installation * Btrfsutil * Btrfs handling * Update btrfs * Save encryption config * Fix pipewire issue * Update mypy version * Update all pre-commit * Update package versions * Revert audio/pipewire * Merge master PRs * Add master changes * Merge master changes * Small renaming * Pull master changes * Reset disk enc after disk config change * Generate locals * Update naming * Fix imports * Fix broken sync * Fix pre selection on table menu * Profile menu * Update profile * Fix post_install * Added python-pyparted to PKGBUILD, this requires [testing] to be enabled in order to run makepkg. Package still works via python -m build etc. * Swaped around some setuptools logic in pyproject Since we define `package-data` and `packages` there should be no need for: ``` [tool.setuptools.packages.find] where = ["archinstall", "archinstall.*"] ``` * Removed pyproject collisions. Duplicate definitions. * Made sure pyproject.toml includes languages * Add example and update README * Fix pyproject issues * Generate locale * Refactor imports * Simplify imports * Add profile description and package examples * Align code * Fix mypy * Simplify imports * Fix saving config * Fix wrong luks merge * Refactor installation * Fix cdrom device loading * Fix wrongly merged code * Fix imports and greeter * Don't terminate on partprobe error * Use specific path on partprobe from luks * Update archinstall/lib/disk/device_model.py Co-authored-by: codefiles <11915375+codefiles@users.noreply.github.com> * Update archinstall/lib/disk/device_model.py Co-authored-by: codefiles <11915375+codefiles@users.noreply.github.com> * Update github workflow to test archinstall installation * Update sway merge * Generate locales * Update workflow --------- Co-authored-by: Daniel Girtler Co-authored-by: Anton Hvornum Co-authored-by: Anton Hvornum Co-authored-by: codefiles <11915375+codefiles@users.noreply.github.com> --- profiles/52-54-00-12-34-56.py | 62 ---------------------- profiles/__init__.py | 0 profiles/applications/__init__.py | 0 profiles/applications/awesome.py | 34 ------------ profiles/applications/cockpit.py | 13 ----- profiles/applications/docker.py | 9 ---- profiles/applications/httpd.py | 9 ---- profiles/applications/lighttpd.py | 9 ---- profiles/applications/mariadb.py | 11 ---- profiles/applications/nginx.py | 9 ---- profiles/applications/pipewire.py | 14 ----- profiles/applications/postgresql.py | 11 ---- profiles/applications/sshd.py | 9 ---- profiles/applications/tomcat.py | 12 ----- profiles/awesome.py | 51 ------------------ profiles/bspwm.py | 43 ---------------- profiles/budgie.py | 45 ---------------- profiles/cinnamon.py | 46 ----------------- profiles/cutefish.py | 41 --------------- profiles/deepin.py | 44 ---------------- profiles/desktop.py | 97 ---------------------------------- profiles/enlightenment.py | 43 ---------------- profiles/gnome.py | 45 ---------------- profiles/i3.py | 59 --------------------- profiles/kde.py | 58 --------------------- profiles/lxqt.py | 50 ------------------ profiles/mate.py | 42 --------------- profiles/minimal.py | 24 --------- profiles/qtile.py | 42 --------------- profiles/server.py | 63 ----------------------- profiles/sway.py | 100 ------------------------------------ profiles/xfce4.py | 45 ---------------- profiles/xorg.py | 68 ------------------------ 33 files changed, 1208 deletions(-) delete mode 100644 profiles/52-54-00-12-34-56.py delete mode 100644 profiles/__init__.py delete mode 100644 profiles/applications/__init__.py delete mode 100644 profiles/applications/awesome.py delete mode 100644 profiles/applications/cockpit.py delete mode 100644 profiles/applications/docker.py delete mode 100644 profiles/applications/httpd.py delete mode 100644 profiles/applications/lighttpd.py delete mode 100644 profiles/applications/mariadb.py delete mode 100644 profiles/applications/nginx.py delete mode 100644 profiles/applications/pipewire.py delete mode 100644 profiles/applications/postgresql.py delete mode 100644 profiles/applications/sshd.py delete mode 100644 profiles/applications/tomcat.py delete mode 100644 profiles/awesome.py delete mode 100644 profiles/bspwm.py delete mode 100644 profiles/budgie.py delete mode 100644 profiles/cinnamon.py delete mode 100644 profiles/cutefish.py delete mode 100644 profiles/deepin.py delete mode 100644 profiles/desktop.py delete mode 100644 profiles/enlightenment.py delete mode 100644 profiles/gnome.py delete mode 100644 profiles/i3.py delete mode 100644 profiles/kde.py delete mode 100644 profiles/lxqt.py delete mode 100644 profiles/mate.py delete mode 100644 profiles/minimal.py delete mode 100644 profiles/qtile.py delete mode 100644 profiles/server.py delete mode 100644 profiles/sway.py delete mode 100644 profiles/xfce4.py delete mode 100644 profiles/xorg.py (limited to 'profiles') diff --git a/profiles/52-54-00-12-34-56.py b/profiles/52-54-00-12-34-56.py deleted file mode 100644 index 3b074629..00000000 --- a/profiles/52-54-00-12-34-56.py +++ /dev/null @@ -1,62 +0,0 @@ -import archinstall - -# import json -# import urllib.request - -__packages__ = ['nano', 'wget', 'git'] - -if __name__ == '52-54-00-12-34-56': - awesome = archinstall.Application(archinstall.storage['installation_session'], 'postgresql') - awesome.install() - -""" -# Unmount and close previous runs (Mainly only used for re-runs, but won't hurt.) -archinstall.sys_command(f'umount -R /mnt', suppress_errors=True) -archinstall.sys_command(f'cryptsetup close /dev/mapper/luksloop', suppress_errors=True) - -# Select a harddrive and a disk password -harddrive = archinstall.all_blockdevices()['/dev/sda'] -disk_password = '1234' - -with archinstall.Filesystem(harddrive) as fs: - # Use the entire disk instead of setting up partitions on your own - fs.use_entire_disk('luks2') - - if harddrive.partition[1].size == '512M': - raise OSError('Trying to encrypt the boot partition for Pete's sake..') - harddrive.partition[0].format('fat32') - - with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device: - unlocked_device.format('btrfs') - - with archinstall.Installer( - unlocked_device, - boot_partition=harddrive.partition[0], - hostname="testmachine" - ) as installation: - if installation.minimal_installation(): - installation.add_bootloader() - - installation.add_additional_packages(__packages__) - installation.install_profile('awesome') - - user = User('devel', 'devel', False) - installation.create_users(user) - installation.user_set_pw('root', 'toor') - - print(f'Submitting {archinstall.__version__}: success') - - conditions = { - "project": "archinstall", - "profile": "52-54-00-12-34-56", - "status": "success", - "version": archinstall.__version__ - } - req = urllib.request.Request("https://api.archlinux.life/build/success", - data=json.dumps(conditions).encode('utf8'), - headers={'content-type': 'application/json'}) - try: - urllib.request.urlopen(req, timeout=5) - except: - pass -""" diff --git a/profiles/__init__.py b/profiles/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/profiles/applications/__init__.py b/profiles/applications/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/profiles/applications/awesome.py b/profiles/applications/awesome.py deleted file mode 100644 index 33526fd7..00000000 --- a/profiles/applications/awesome.py +++ /dev/null @@ -1,34 +0,0 @@ -import archinstall - -__packages__ = [ - "awesome", - "xorg-xrandr", - "xterm", - "feh", - "slock", - "terminus-font", - "gnu-free-fonts", - "ttf-liberation", - "xsel", -] - -archinstall.storage['installation_session'].install_profile('xorg') - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -with open(f"{archinstall.storage['installation_session'].target}/etc/X11/xinit/xinitrc", 'r') as xinitrc: - xinitrc_data = xinitrc.read() - -for line in xinitrc_data.split('\n'): - if "twm &" in line: - xinitrc_data = xinitrc_data.replace(line, f"# {line}") - if "xclock" in line: - xinitrc_data = xinitrc_data.replace(line, f"# {line}") - if "xterm" in line: - xinitrc_data = xinitrc_data.replace(line, f"# {line}") - -xinitrc_data += '\n' -xinitrc_data += 'exec awesome\n' - -with open(f"{archinstall.storage['installation_session'].target}/etc/X11/xinit/xinitrc", 'w') as xinitrc: - xinitrc.write(xinitrc_data) diff --git a/profiles/applications/cockpit.py b/profiles/applications/cockpit.py deleted file mode 100644 index d8aa0fd1..00000000 --- a/profiles/applications/cockpit.py +++ /dev/null @@ -1,13 +0,0 @@ -import archinstall - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = [ - "cockpit", - "udisks2", - "packagekit", -] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].enable_service('cockpit.socket') diff --git a/profiles/applications/docker.py b/profiles/applications/docker.py deleted file mode 100644 index afbde1a5..00000000 --- a/profiles/applications/docker.py +++ /dev/null @@ -1,9 +0,0 @@ -import archinstall - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["docker"] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].enable_service('docker') diff --git a/profiles/applications/httpd.py b/profiles/applications/httpd.py deleted file mode 100644 index 23b3fefa..00000000 --- a/profiles/applications/httpd.py +++ /dev/null @@ -1,9 +0,0 @@ -import archinstall - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["apache"] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].enable_service('httpd') diff --git a/profiles/applications/lighttpd.py b/profiles/applications/lighttpd.py deleted file mode 100644 index 71158861..00000000 --- a/profiles/applications/lighttpd.py +++ /dev/null @@ -1,9 +0,0 @@ -import archinstall - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["lighttpd"] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].enable_service('lighttpd') diff --git a/profiles/applications/mariadb.py b/profiles/applications/mariadb.py deleted file mode 100644 index bdde18b5..00000000 --- a/profiles/applications/mariadb.py +++ /dev/null @@ -1,11 +0,0 @@ -import archinstall - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["mariadb"] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].arch_chroot("mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql") - -archinstall.storage['installation_session'].enable_service('mariadb') diff --git a/profiles/applications/nginx.py b/profiles/applications/nginx.py deleted file mode 100644 index 6f63b15c..00000000 --- a/profiles/applications/nginx.py +++ /dev/null @@ -1,9 +0,0 @@ -import archinstall - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["nginx"] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].enable_service('nginx') diff --git a/profiles/applications/pipewire.py b/profiles/applications/pipewire.py deleted file mode 100644 index b6e79347..00000000 --- a/profiles/applications/pipewire.py +++ /dev/null @@ -1,14 +0,0 @@ -import archinstall -import logging - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["pipewire", "pipewire-alsa", "pipewire-jack", "pipewire-pulse", "gst-plugin-pipewire", "libpulse", "wireplumber"] - -archinstall.log('Installing pipewire', level=logging.INFO) -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -@archinstall.plugin -def on_user_created(installation :archinstall.Installer, user :str): - archinstall.log(f"Enabling pipewire-pulse for {user}", level=logging.INFO) - installation.chroot('systemctl enable --user pipewire-pulse.service', run_as=user) diff --git a/profiles/applications/postgresql.py b/profiles/applications/postgresql.py deleted file mode 100644 index 80ad4b66..00000000 --- a/profiles/applications/postgresql.py +++ /dev/null @@ -1,11 +0,0 @@ -import archinstall - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["postgresql"] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].arch_chroot("initdb -D /var/lib/postgres/data", run_as='postgres') - -archinstall.storage['installation_session'].enable_service('postgresql') diff --git a/profiles/applications/sshd.py b/profiles/applications/sshd.py deleted file mode 100644 index 4199ecb0..00000000 --- a/profiles/applications/sshd.py +++ /dev/null @@ -1,9 +0,0 @@ -import archinstall - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["openssh"] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].enable_service('sshd') diff --git a/profiles/applications/tomcat.py b/profiles/applications/tomcat.py deleted file mode 100644 index ae6d1c2a..00000000 --- a/profiles/applications/tomcat.py +++ /dev/null @@ -1,12 +0,0 @@ -import archinstall - -# This is using Tomcat 10 as that is the latest release at the time of implementation. -# This should probably be updated to use newer releases as they come out. - -# Define the package list in order for lib to source -# which packages will be installed by this profile -__packages__ = ["tomcat10"] - -archinstall.storage['installation_session'].add_additional_packages(__packages__) - -archinstall.storage['installation_session'].enable_service('tomcat10') diff --git a/profiles/awesome.py b/profiles/awesome.py deleted file mode 100644 index 11c8de3b..00000000 --- a/profiles/awesome.py +++ /dev/null @@ -1,51 +0,0 @@ -# A desktop environment using "Awesome" window manager. - -import archinstall - -is_top_level_profile = False - -# New way of defining packages for a profile, which is iterable and can be used out side -# of the profile to get a list of "what packages will be installed". -__packages__ = [ - "alacritty", -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # Awesome WM requires that xorg is installed - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py") -# or through conventional import awesome -if __name__ == 'awesome': - # Install the application awesome from the template under /applications/ - awesome = archinstall.Application(archinstall.storage['installation_session'], 'awesome') - awesome.install() - - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - # TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead. - with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'r') as fh: - awesome_lua = fh.read() - - # Replace xterm with alacritty for a smoother experience. - awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"') - - with open(f"{archinstall.storage['installation_session'].target}/etc/xdg/awesome/rc.lua", 'w') as fh: - fh.write(awesome_lua) - - # TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config) \ No newline at end of file diff --git a/profiles/bspwm.py b/profiles/bspwm.py deleted file mode 100644 index 0fb67ad6..00000000 --- a/profiles/bspwm.py +++ /dev/null @@ -1,43 +0,0 @@ -# A desktop environment using the bspwm window manager. - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - 'bspwm', - 'sxhkd', - 'dmenu', - 'xdo', - 'rxvt-unicode', - 'lightdm', - 'lightdm-gtk-greeter', -] - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # bspwm requires a functioning Xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("bspwm", "/somewhere/bspwm.py") -# or through conventional import bspwm -if __name__ == 'bspwm': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - # Install bspwm packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - # Set up LightDM for login - archinstall.storage['installation_session'].enable_service('lightdm') diff --git a/profiles/budgie.py b/profiles/budgie.py deleted file mode 100644 index 33484680..00000000 --- a/profiles/budgie.py +++ /dev/null @@ -1,45 +0,0 @@ -# A desktop environment using "budgie" - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - "arc-gtk-theme", - "budgie", - "lightdm", - "lightdm-gtk-greeter", - "mate-terminal", - "nemo", - "papirus-icon-theme", -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # budgie requires a functioning Xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("budgie", "/somewhere/budgie.py") -# or through conventional import budgie -if __name__ == 'budgie': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the Budgie packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py deleted file mode 100644 index 0122677a..00000000 --- a/profiles/cinnamon.py +++ /dev/null @@ -1,46 +0,0 @@ -# A desktop environment using "Cinnamon" - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - "cinnamon", - "system-config-printer", - "gnome-keyring", - "gnome-terminal", - "blueberry", - "metacity", - "lightdm", - "lightdm-gtk-greeter", -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # Cinnamon requires a functioning Xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") -# or through conventional import cinnamon -if __name__ == 'cinnamon': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the Cinnamon packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/cutefish.py b/profiles/cutefish.py deleted file mode 100644 index 486fa389..00000000 --- a/profiles/cutefish.py +++ /dev/null @@ -1,41 +0,0 @@ -# A desktop environment using "Cutefish" - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - "cutefish", - "noto-fonts", - "sddm" -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # Cutefish requires a functional xorg installation. - profile = archinstall.Profile(None, "xorg") - with profile.load_instructions(namespace="xorg.py") as imported: - if hasattr(imported, "_prep_function"): - return imported._prep_function() - else: - print("Deprecated (??): xorg profile has no _prep_function() anymore") - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("cutefish", "/somewhere/cutefish.py") -# or through conventional import cutefish -if __name__ == "cutefish": - # Install dependency profiles - archinstall.storage["installation_session"].install_profile("xorg") - - # Install the Cutefish packages - archinstall.storage["installation_session"].add_additional_packages(__packages__) - - archinstall.storage["installation_session"].enable_service("sddm") diff --git a/profiles/deepin.py b/profiles/deepin.py deleted file mode 100644 index 8196bc4b..00000000 --- a/profiles/deepin.py +++ /dev/null @@ -1,44 +0,0 @@ -# A desktop environment using "Deepin". - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - "deepin", - "deepin-terminal", - "deepin-editor", - "lightdm", - "lightdm-deepin-greeter", -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # Deepin requires a functioning Xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("deepin", "/somewhere/deepin.py") -# or through conventional import deepin -if __name__ == 'deepin': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the Deepin packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - # Enable autostart of Deepin for all users - archinstall.storage['installation_session'].enable_service('lightdm') diff --git a/profiles/desktop.py b/profiles/desktop.py deleted file mode 100644 index e94d3505..00000000 --- a/profiles/desktop.py +++ /dev/null @@ -1,97 +0,0 @@ -# A desktop environment selector. -from typing import Any, TYPE_CHECKING - -import archinstall -from archinstall import log, Menu -from archinstall.lib.menu.menu import MenuSelectionType - -if TYPE_CHECKING: - _: Any - -is_top_level_profile = True - -__description__ = str(_('Provides a selection of desktop environments and tiling window managers, e.g. gnome, kde, sway')) - -# New way of defining packages for a profile, which is iterable and can be used out side -# of the profile to get a list of "what packages will be installed". -__packages__ = [ - 'nano', - 'vim', - 'openssh', - 'htop', - 'wget', - 'iwd', - 'wireless_tools', - 'wpa_supplicant', - 'smartmontools', - 'xdg-utils', -] - -__supported__ = [ - 'gnome', - 'kde', - 'awesome', - 'sway', - 'cinnamon', - 'xfce4', - 'lxqt', - 'i3', - 'bspwm', - 'budgie', - 'mate', - 'deepin', - 'enlightenment', - 'qtile' -] - - -def _prep_function(*args, **kwargs) -> bool: - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - choice = Menu(str(_('Select your desired desktop environment')), __supported__).run() - - if choice.type_ != MenuSelectionType.Selection: - return False - - if choice.value: - # Temporarily store the selected desktop profile - # in a session-safe location, since this module will get reloaded - # the next time it gets executed. - if not archinstall.storage.get('_desktop_profile', None): - archinstall.storage['_desktop_profile'] = choice.value - if not archinstall.arguments.get('desktop-environment', None): - archinstall.arguments['desktop-environment'] = choice.value - profile = archinstall.Profile(None, choice.value) - # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered. - with profile.load_instructions(namespace=f"{choice.value}.py") as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - log(f"Deprecated (??): {choice.value} profile has no _prep_function() anymore") - exit(1) - - return False - - -if __name__ == 'desktop': - """ - This "profile" is a meta-profile. - There are no desktop-specific steps, it simply routes - the installer to whichever desktop environment/window manager was chosen. - - Maybe in the future, a network manager or similar things *could* be added here. - We should honor that Arch Linux does not officially endorse a desktop-setup, nor is - it trying to be a turn-key desktop distribution. - - There are plenty of desktop-turn-key-solutions based on Arch Linux, - this is therefore just a helper to get started - """ - - # Install common packages for all desktop environments - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - archinstall.storage['installation_session'].install_profile(archinstall.storage['_desktop_profile']) diff --git a/profiles/enlightenment.py b/profiles/enlightenment.py deleted file mode 100644 index 3850fed0..00000000 --- a/profiles/enlightenment.py +++ /dev/null @@ -1,43 +0,0 @@ -# A desktop environment using "Enlightenment". - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - "enlightenment", - "terminology", - "lightdm", - "lightdm-gtk-greeter", -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # Enlightenment requires a functioning Xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("enlightenment", "/somewhere/enlightenment.py") -# or through conventional import enlightenment -if __name__ == 'enlightenment': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the enlightenment packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - # Enable autostart of enlightenment for all users - archinstall.storage['installation_session'].enable_service('lightdm') diff --git a/profiles/gnome.py b/profiles/gnome.py deleted file mode 100644 index 5e3a8da6..00000000 --- a/profiles/gnome.py +++ /dev/null @@ -1,45 +0,0 @@ -# A desktop environment using "Gnome" - -import archinstall - -is_top_level_profile = False - -# Note: GDM should be part of the gnome group, but adding it here for clarity -__packages__ = [ - "gnome", - "gnome-tweaks", - "gdm" -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # Gnome optionally supports xorg, we'll install it since it also - # includes graphic driver setups (this might change in the future) - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("gnome", "/somewhere/gnome.py") -# or through conventional import gnome -if __name__ == 'gnome': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the GNOME packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - archinstall.storage['installation_session'].enable_service('gdm') # Gnome Display Manager -# We could also start it via xinitrc since we do have Xorg, -# but for gnome that's deprecated and wayland is preferred. diff --git a/profiles/i3.py b/profiles/i3.py deleted file mode 100644 index d9b98b77..00000000 --- a/profiles/i3.py +++ /dev/null @@ -1,59 +0,0 @@ -# Common package for i3. - -import archinstall - -is_top_level_profile = False - -# New way of defining packages for a profile, which is iterable and can be used out side -# of the profile to get a list of "what packages will be installed". -__packages__ = [ - 'i3-wm', - 'i3lock', - 'i3status', - 'i3blocks', - 'xterm', - 'lightdm-gtk-greeter', - 'lightdm', - 'dmenu', -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # i3 requires a functioning Xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -if __name__ == 'i3': - """ - This "profile" is a meta-profile. - There are no desktop-specific steps, it simply routes - the installer to whichever desktop environment/window manager was chosen. - - Maybe in the future, a network manager or similar things *could* be added here. - We should honor that Arch Linux does not officially endorse a desktop-setup, nor is - it trying to be a turn-key desktop distribution. - - There are plenty of desktop-turn-key-solutions based on Arch Linux, - this is therefore just a helper to get started - """ - - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the i3 packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - # Enable autostart of lightdm for all users - archinstall.storage['installation_session'].enable_service('lightdm') diff --git a/profiles/kde.py b/profiles/kde.py deleted file mode 100644 index d32bf31b..00000000 --- a/profiles/kde.py +++ /dev/null @@ -1,58 +0,0 @@ -# A desktop environment using "KDE". - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - "plasma-meta", - "konsole", - "kwrite", - "dolphin", - "ark", - "sddm", - "plasma-wayland-session", - "egl-wayland" -] - - -# TODO: Remove hard dependency of bash (due to .bash_profile) - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # KDE requires a functioning Xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -""" -def _post_install(*args, **kwargs): - if "nvidia" in _gfx_driver_packages: - print("Plasma Wayland has known compatibility issues with the proprietary Nvidia driver") - print("After booting, you can choose between Wayland and Xorg using the drop-down menu") - return True -""" - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") -# or through conventional import kde -if __name__ == 'kde': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the KDE packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - # Enable autostart of KDE for all users - archinstall.storage['installation_session'].enable_service('sddm') diff --git a/profiles/lxqt.py b/profiles/lxqt.py deleted file mode 100644 index 2419b4fa..00000000 --- a/profiles/lxqt.py +++ /dev/null @@ -1,50 +0,0 @@ -# A desktop environment using "LXQt" - -import archinstall - -is_top_level_profile = False - -# NOTE: SDDM is the only officially supported greeter for LXQt, so unlike other DEs, lightdm is not used here. -# LXQt works with lightdm, but since this is not supported, we will not default to this. -# https://github.com/lxqt/lxqt/issues/795 -__packages__ = [ - "lxqt", - "breeze-icons", - "oxygen-icons", - "xdg-utils", - "ttf-freefont", - "leafpad", - "slock", - "sddm", -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # LXQt requires a functional xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("lxqt", "/somewhere/lxqt.py") -# or through conventional import lxqt -if __name__ == 'lxqt': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the LXQt packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - # Enable autostart of LXQt for all users - archinstall.storage['installation_session'].enable_service('sddm') diff --git a/profiles/mate.py b/profiles/mate.py deleted file mode 100644 index 94b91f81..00000000 --- a/profiles/mate.py +++ /dev/null @@ -1,42 +0,0 @@ -# A desktop environment using "MATE" - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - "mate", - "mate-extra", - "lightdm", - "lightdm-gtk-greeter", -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # MATE requires a functional xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("mate", "/somewhere/mate.py") -# or through conventional import mate -if __name__ == 'mate': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the MATE packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/minimal.py b/profiles/minimal.py deleted file mode 100644 index a412aa81..00000000 --- a/profiles/minimal.py +++ /dev/null @@ -1,24 +0,0 @@ -# Used to do a minimal install -import archinstall - -is_top_level_profile = True - -__description__ = str(_('A very basic installation that allows you to customize Arch Linux as you see fit.')) - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. For minimal install, - we don't need to do anything special here, but it - needs to exist and return True. - """ - archinstall.storage['profile_minimal'] = True - return True # Do nothing and just return True - - -if __name__ == 'minimal': - """ - This "profile" is a meta-profile. - It is used for a custom minimal installation, without any desktop-specific packages. - """ diff --git a/profiles/qtile.py b/profiles/qtile.py deleted file mode 100644 index ace13dcc..00000000 --- a/profiles/qtile.py +++ /dev/null @@ -1,42 +0,0 @@ -# A desktop environment using "qtile" window manager with common packages. - -import archinstall - -is_top_level_profile = False - -# New way of defining packages for a profile, which is iterable and can be used out side -# of the profile to get a list of "what packages will be installed". -__packages__ = [ - 'qtile', - 'alacritty', - 'lightdm-gtk-greeter', - 'lightdm', -] - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # qtile optionally supports xorg, we'll install it since it also - # includes graphic driver setups (this might change in the future) - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -if __name__ == 'qtile': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install packages for qtile - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - # Auto start lightdm for all users - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/server.py b/profiles/server.py deleted file mode 100644 index f3e32d26..00000000 --- a/profiles/server.py +++ /dev/null @@ -1,63 +0,0 @@ -# Used to select various server application profiles on top of a minimal installation. - -import logging -from typing import Any, TYPE_CHECKING - -import archinstall -from archinstall import Menu -from archinstall.lib.menu.menu import MenuSelectionType - -if TYPE_CHECKING: - _: Any - -is_top_level_profile = True - -__description__ = str(_('Provides a selection of various server packages to install and enable, e.g. httpd, nginx, mariadb')) - -available_servers = [ - "cockpit", - "docker", - "httpd", - "lighttpd", - "mariadb", - "nginx", - "postgresql", - "sshd", - "tomcat", -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. - """ - choice = Menu(str(_( - 'Choose which servers to install, if none then a minimal installation will be done')), - available_servers, - preset_values=kwargs['servers'], - multi=True - ).run() - - if choice.type_ != MenuSelectionType.Selection: - return False - - if choice.value: - archinstall.storage['_selected_servers'] = choice.value - return True - - return False - - -if __name__ == 'server': - """ - This "profile" is a meta-profile. - """ - archinstall.log('Now installing the selected servers.', level=logging.INFO) - archinstall.log(archinstall.storage['_selected_servers'], level=logging.DEBUG) - for server in archinstall.storage['_selected_servers']: - archinstall.log(f'Installing {server} ...', level=logging.INFO) - app = archinstall.Application(archinstall.storage['installation_session'], server) - app.install() - - archinstall.log('If your selections included multiple servers with the same port, you may have to reconfigure them.', fg="yellow", level=logging.INFO) diff --git a/profiles/sway.py b/profiles/sway.py deleted file mode 100644 index f69f73ce..00000000 --- a/profiles/sway.py +++ /dev/null @@ -1,100 +0,0 @@ -# A desktop environment using "Sway" -from typing import Any, TYPE_CHECKING - -import archinstall -from archinstall import Menu -from archinstall.lib.menu.menu import MenuSelectionType - -if TYPE_CHECKING: - _: Any - -is_top_level_profile = False - -__packages__ = [ - "sway", - "swaybg", - "swaylock", - "swayidle", - "waybar", - "dmenu", - "brightnessctl", - "grim", - "slurp", - "pavucontrol", - "foot", - "xorg-xwayland", -] - - -def _check_driver() -> bool: - packages = archinstall.storage.get("gfx_driver_packages", []) - - if packages and "nvidia" in packages: - prompt = _('The proprietary Nvidia driver is not supported by Sway. It is likely that you will run into issues, are you okay with that?') - choice = Menu(prompt, Menu.yes_no(), default_option=Menu.no(), skip=False).run() - - if choice.value == Menu.no(): - return False - - return True - -def _get_system_privelege_control_preference(): - # need to activate seat service and add to seat group - title = str(_('Sway needs access to your seat (collection of hardware devices i.e. keyboard, mouse, etc)')) - title += str(_('\n\nChoose an option to give Sway access to your hardware')) - choice = Menu(title, ["polkit", "seatd"]).run() - - if choice.type_ != MenuSelectionType.Selection: - return False - - archinstall.storage['sway_sys_priv_ctrl'] = [choice.value] - archinstall.arguments['sway_sys_priv_ctrl'] = [choice.value] - return True - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - if not _get_system_privelege_control_preference(): - return False - - driver = archinstall.select_driver() - - if driver: - archinstall.storage["gfx_driver_packages"] = driver - if not _check_driver(): - return _prep_function(args, kwargs) - return True - - return False - - -""" -def _post_install(*args, **kwargs): - if "seatd" in sway_sys_priv_ctrl: - print(_('After booting, add user(s) to the `seat` user group and re-login to use Sway')) - return True -""" - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("sway", "/somewhere/sway.py") -# or through conventional import sway -if __name__ == "sway": - if not _check_driver(): - raise archinstall.lib.exceptions.HardwareIncompatibilityError(_('Sway does not support the proprietary nvidia drivers.')) - - # Install the Sway packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - if "seatd" in archinstall.storage['sway_sys_priv_ctrl']: - archinstall.storage['installation_session'].add_additional_packages(['seatd']) - archinstall.storage['installation_session'].enable_service('seatd') - elif "polkit" in archinstall.storage['sway_sys_priv_ctrl']: - archinstall.storage['installation_session'].add_additional_packages(['polkit']) - else: - raise archinstall.lib.exceptions.ProfileError(_('Sway requires either seatd or polkit to run')) - - # Install the graphics driver packages - archinstall.storage['installation_session'].add_additional_packages(f"xorg-server xorg-xinit {' '.join(archinstall.storage.get('gfx_driver_packages', None))}") diff --git a/profiles/xfce4.py b/profiles/xfce4.py deleted file mode 100644 index fbc68c10..00000000 --- a/profiles/xfce4.py +++ /dev/null @@ -1,45 +0,0 @@ -# A desktop environment using "Xfce4" - -import archinstall - -is_top_level_profile = False - -__packages__ = [ - "xfce4", - "xfce4-goodies", - "pavucontrol", - "lightdm", - "lightdm-gtk-greeter", - "gvfs", - "xarchiver" -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - # XFCE requires a functional xorg installation. - profile = archinstall.Profile(None, 'xorg') - with profile.load_instructions(namespace='xorg.py') as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print('Deprecated (??): xorg profile has no _prep_function() anymore') - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") -# or through conventional import xfce4 -if __name__ == 'xfce4': - # Install dependency profiles - archinstall.storage['installation_session'].install_profile('xorg') - - # Install the XFCE4 packages - archinstall.storage['installation_session'].add_additional_packages(__packages__) - - archinstall.storage['installation_session'].enable_service('lightdm') # Light Display Manager diff --git a/profiles/xorg.py b/profiles/xorg.py deleted file mode 100644 index de45acd3..00000000 --- a/profiles/xorg.py +++ /dev/null @@ -1,68 +0,0 @@ -# A system with "xorg" installed - -import archinstall -import logging -from archinstall.lib.hardware import __packages__ as __hwd__packages__ - -is_top_level_profile = True - -__description__ = str(_('Installs a minimal system as well as xorg and graphics drivers.')) - -__packages__ = [ - 'dkms', - 'xorg-server', - 'xorg-xinit', - 'nvidia-dkms', - *__hwd__packages__, -] - - -def _prep_function(*args, **kwargs): - """ - Magic function called by the importing installer - before continuing any further. It also avoids executing any - other code in this stage. So it's a safe way to ask the user - for more input before any other installer steps start. - """ - - driver = archinstall.select_driver() - - if driver: - archinstall.storage["gfx_driver_packages"] = driver - return True - - # TODO: Add language section and/or merge it with the locale selected - # earlier in for instance guided.py installer. - - return False - - -# Ensures that this code only gets executed if executed -# through importlib.util.spec_from_file_location("xorg", "/somewhere/xorg.py") -# or through conventional import xorg -if __name__ == 'xorg': - try: - if "nvidia" in archinstall.storage.get("gfx_driver_packages", []): - if "linux-zen" in archinstall.storage['installation_session'].base_packages or "linux-lts" in archinstall.storage['installation_session'].base_packages: - for kernel in archinstall.storage['installation_session'].kernels: - archinstall.storage['installation_session'].add_additional_packages(f"{kernel}-headers") # Fixes https://github.com/archlinux/archinstall/issues/585 - archinstall.storage['installation_session'].add_additional_packages("dkms") # I've had kernel regen fail if it wasn't installed before nvidia-dkms - archinstall.storage['installation_session'].add_additional_packages("xorg-server", "xorg-xinit", "nvidia-dkms") - else: - archinstall.storage['installation_session'].add_additional_packages(f"xorg-server", "xorg-xinit", *archinstall.storage.get('gfx_driver_packages', [])) - elif 'amdgpu' in archinstall.storage.get("gfx_driver_packages", []): - # The order of these two are important if amdgpu is installed #808 - if 'amdgpu' in archinstall.storage['installation_session'].MODULES: - archinstall.storage['installation_session'].MODULES.remove('amdgpu') - archinstall.storage['installation_session'].MODULES.append('amdgpu') - - if 'radeon' in archinstall.storage['installation_session'].MODULES: - archinstall.storage['installation_session'].MODULES.remove('radeon') - archinstall.storage['installation_session'].MODULES.append('radeon') - - archinstall.storage['installation_session'].add_additional_packages(f"xorg-server", "xorg-xinit", *archinstall.storage.get('gfx_driver_packages', [])) - else: - archinstall.storage['installation_session'].add_additional_packages(f"xorg-server", "xorg-xinit", *archinstall.storage.get('gfx_driver_packages', [])) - except Exception as err: - archinstall.log(f"Could not handle nvidia and linuz-zen specific situations during xorg installation: {err}", level=logging.WARNING, fg="yellow") - archinstall.storage['installation_session'].add_additional_packages("xorg-server", "xorg-xinit") # Prep didn't run, so there's no driver to install -- cgit v1.2.3-54-g00ecf