From 0888ca592aab78e629ac5bdcdf60f3e059155ba7 Mon Sep 17 00:00:00 2001 From: Zach Osman Date: Mon, 5 Apr 2021 13:10:35 -0400 Subject: allow multiple services to be enabled at once --- archinstall/lib/exceptions.py | 2 ++ archinstall/lib/installer.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/archinstall/lib/exceptions.py b/archinstall/lib/exceptions.py index a320eef6..49913980 100644 --- a/archinstall/lib/exceptions.py +++ b/archinstall/lib/exceptions.py @@ -18,4 +18,6 @@ class HardwareIncompatibilityError(BaseException): class PermissionError(BaseException): pass class UserError(BaseException): + pass +class ServiceException(BaseException): pass \ No newline at end of file diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 0fc9f969..49716ac5 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -189,9 +189,11 @@ class Installer(): if self.enable_service('ntpd'): return True - def enable_service(self, service): - self.log(f'Enabling service {service}', level=LOG_LEVELS.Info) - return self.arch_chroot(f'systemctl enable {service}').exit_code == 0 + def enable_service(self, *services): + for service in services: + self.log(f'Enabling service {service}', level=LOG_LEVELS.Info) + if (output := self.arch_chroot(f'systemctl enable {service}')).exit_code != 0: + raise ServiceException(f"Unable to start service {service}: {output}") def run_command(self, cmd, *args, **kwargs): return sys_command(f'/usr/bin/arch-chroot {self.mountpoint} {cmd}') @@ -256,14 +258,12 @@ class Installer(): # If we haven't installed the base yet (function called pre-maturely) if self.helper_flags.get('base', False) is False: def post_install_enable_networkd_resolved(*args, **kwargs): - self.enable_service('systemd-networkd') - self.enable_service('systemd-resolved') - + self.enable_service('systemd-networkd', 'systemd-resolved') self.post_base_install.append(post_install_enable_networkd_resolved) # Otherwise, we can go ahead and enable the services else: - self.enable_service('systemd-networkd') - self.enable_service('systemd-resolved') + self.enable_service('systemd-networkd', 'systemd-resolved') + return True -- cgit v1.2.3-54-g00ecf From e70aa5244bd07cdaa299df528f8ebd099b00bf64 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 10:36:42 +0200 Subject: Corrected the new-line parameter --- archinstall/lib/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 1d277bc6..16d48183 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -147,11 +147,11 @@ class Installer(): self.log(f"Updating {self.mountpoint}/etc/fstab", level=LOG_LEVELS.Info) fstab = sys_command(f'/usr/bin/genfstab {flags} {self.mountpoint}').trace_log - with open(f"{self.mountpoint}/etc/fstab", 'ab',newline='\n') as fstab_fh: + with open(f"{self.mountpoint}/etc/fstab", 'ab') as fstab_fh: fstab_fh.write(fstab) if not os.path.isfile(f'{self.mountpoint}/etc/fstab'): - raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{b"".join(fstab)}') + raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{fstab}') return True -- cgit v1.2.3-54-g00ecf From b178dc7267ec6a6e425ea50f6847467f09bd5782 Mon Sep 17 00:00:00 2001 From: Ruslan Kiyanchuk Date: Sat, 3 Apr 2021 14:44:45 -0700 Subject: Fix undefined variables in installer --- archinstall/lib/installer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 0fc9f969..5293e009 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -98,8 +98,8 @@ class Installer(): self.log('Some required steps were not successfully installed/configured before leaving the installer:', bg='black', fg='red', level=LOG_LEVELS.Warning) for step in missing_steps: self.log(f' - {step}', bg='black', fg='red', level=LOG_LEVELS.Warning) - self.log(f"Detailed error logs can be found at: {log_path}", level=LOG_LEVELS.Warning) - self.log(f"Submit this zip file as an issue to https://github.com/archlinux/archinstall/issues", level=LOG_LEVELS.Warning) + self.log(f"Detailed error logs can be found at: {storage['LOG_PATH']}", level=LOG_LEVELS.Warning) + self.log(f"Submit this zip file as an issue to https://github.com/Torxed/archinstall/issues", level=LOG_LEVELS.Warning) self.sync_log_to_install_medium() return False @@ -149,7 +149,7 @@ class Installer(): fstab_fh.write(fstab) if not os.path.isfile(f'{self.mountpoint}/etc/fstab'): - raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{o}') + raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n') return True -- cgit v1.2.3-54-g00ecf From d771d35076a00737842debd313f9bdb506881905 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 18:30:20 +0200 Subject: Update installer.py --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 5293e009..a37d3ee8 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -149,7 +149,7 @@ class Installer(): fstab_fh.write(fstab) if not os.path.isfile(f'{self.mountpoint}/etc/fstab'): - raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n') + raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{b"".join(fstab)}') return True -- cgit v1.2.3-54-g00ecf From 3640ee8d25d05d674e329a152da03ef289d42d4c Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Sun, 4 Apr 2021 22:12:31 +0300 Subject: Add lowercase conversion for usernames --- archinstall/lib/user_interaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index e7243a25..5c66a08a 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -49,7 +49,7 @@ def print_large_list(options, padding=5, margin_bottom=0, separator=': '): def ask_for_superuser_account(prompt='Create a required super-user with sudo privileges: ', forced=False): while 1: - new_user = input(prompt).strip(' ') + new_user = input(prompt).strip(' ').lower() if not new_user and forced: # TODO: make this text more generic? @@ -67,7 +67,7 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan super_users = {} while 1: - new_user = input(prompt).strip(' ') + new_user = input(prompt).strip(' ').lower() if not new_user: break password = get_password(prompt=f'Password for user {new_user}: ') -- cgit v1.2.3-54-g00ecf From caeb1d433fad1da690c8e16d401070e0eb3c1d18 Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Mon, 5 Apr 2021 18:38:21 +0300 Subject: Replace lowercase conversion with correct checking --- archinstall/lib/user_interaction.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 5c66a08a..13b127f0 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -1,4 +1,4 @@ -import getpass, pathlib, os, shutil +import getpass, pathlib, os, shutil, re from .exceptions import * from .profiles import Profile from .locale_helpers import search_keyboard_layout @@ -49,8 +49,15 @@ def print_large_list(options, padding=5, margin_bottom=0, separator=': '): def ask_for_superuser_account(prompt='Create a required super-user with sudo privileges: ', forced=False): while 1: - new_user = input(prompt).strip(' ').lower() - + new_user = input(prompt).strip(' ') + + if not re.match('[a-z_][a-z0-9_-]*[$]?', new_user) or len(new_user) > 32: + log( + "The username you entered is invalid. Try again", + level=LOG_LEVELS.Warning, + fg='red' + ) + continue if not new_user and forced: # TODO: make this text more generic? # It's only used to create the first sudo user when root is disabled in guided.py @@ -67,9 +74,16 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan super_users = {} while 1: - new_user = input(prompt).strip(' ').lower() + new_user = input(prompt).strip(' ') if not new_user: break + if not re.match('[a-z_][a-z0-9_-]*[$]?', new_user) or len(new_user) > 32: + log( + "The username you entered is invalid. Try again", + level=LOG_LEVELS.Warning, + fg='red' + ) + continue password = get_password(prompt=f'Password for user {new_user}: ') if input("Should this user be a sudo (super) user (y/N): ").strip(' ').lower() in ('y', 'yes'): -- cgit v1.2.3-54-g00ecf From b3aa1ef695413ce8797a9179f50c763058a6d715 Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Mon, 5 Apr 2021 19:22:48 +0300 Subject: Update regex rule and move check to a function --- archinstall/lib/user_interaction.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 13b127f0..a58abcff 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -18,6 +18,16 @@ def get_terminal_width(): def get_longest_option(options): return max([len(x) for x in options]) +def check_for_correct_username(username): + if re.match(r'^[a-z_][a-z0-9_-]*\$?$', username) and len(username) <= 32: + return True + log( + "The username you entered is invalid. Try again", + level=LOG_LEVELS.Warning, + fg='red' + ) + return False + def get_password(prompt="Enter a password: "): while (passwd := getpass.getpass(prompt)): passwd_verification = getpass.getpass(prompt='And one more time for verification: ') @@ -51,12 +61,7 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri while 1: new_user = input(prompt).strip(' ') - if not re.match('[a-z_][a-z0-9_-]*[$]?', new_user) or len(new_user) > 32: - log( - "The username you entered is invalid. Try again", - level=LOG_LEVELS.Warning, - fg='red' - ) + if not check_for_correct_username(new_user): continue if not new_user and forced: # TODO: make this text more generic? @@ -77,12 +82,7 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan new_user = input(prompt).strip(' ') if not new_user: break - if not re.match('[a-z_][a-z0-9_-]*[$]?', new_user) or len(new_user) > 32: - log( - "The username you entered is invalid. Try again", - level=LOG_LEVELS.Warning, - fg='red' - ) + if not check_for_correct_username(new_user): continue password = get_password(prompt=f'Password for user {new_user}: ') -- cgit v1.2.3-54-g00ecf From 5a07bfbebd7d16898a2426627d609bd604c03063 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 14:09:22 +0200 Subject: Add .pyproject.toml file for PEP 517 compliance --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9787c3bd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" -- cgit v1.2.3-54-g00ecf From 5bc9ab3aacf86355801d44f3e99f478454dd1aa9 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 15:30:18 +0200 Subject: Switch to setup.cfg Configure setup.cfg to find all Python packages. Add more metadata to package. --- VERSION | 1 - __init__.py | 3 --- archinstall/__init__.py | 4 +++- setup.cfg | 35 +++++++++++++++++++++++++++++++++++ setup.py | 29 ++--------------------------- 5 files changed, 40 insertions(+), 32 deletions(-) delete mode 100644 VERSION delete mode 100644 __init__.py create mode 100644 setup.cfg diff --git a/VERSION b/VERSION deleted file mode 100644 index abae0d9a..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.1.3 \ No newline at end of file diff --git a/__init__.py b/__init__.py deleted file mode 100644 index bd22d3f4..00000000 --- a/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# This __init__ file is just here to support the -# use of archinstall as a git submodule. -from .archinstall import * diff --git a/archinstall/__init__.py b/archinstall/__init__.py index d4452d38..c2773b64 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -14,6 +14,8 @@ from .lib.output import * from .lib.storage import * from .lib.hardware import * +__version__ = "2.1.3" + ## Basic version of arg.parse() supporting: ## --key=value ## --boolean @@ -27,4 +29,4 @@ for arg in sys.argv[1:]: key, val = arg[2:], True arguments[key] = val else: - positionals.append(arg) \ No newline at end of file + positionals.append(arg) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..ccbddf8a --- /dev/null +++ b/setup.cfg @@ -0,0 +1,35 @@ +[metadata] +name = archinstall +version = attr: archinstall.__version__ +description = Arch Linux installer - guided, templates etc. +author = Anton Hvornum +author_email = anton@hvornum.se +long_description = file: README.md +long_description_content_type = text/markdown +license = GPL +license_files = + LICENSE +project_urls = + Source = https://github.com/archlinux/archinstall + Documentation = https://archinstall.readthedocs.io/ +classifers = + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + License :: OSI Approved :: GNU General Public License v3 (GPLv3) + Operating System :: POSIX :: Linux + +[options] +packages = find: +python_requires = >= 3.8 + +[options.packages.find] +include = + archinstall + archinstall.* + +[options.package_data] +archinstall = + examples/*.py + profiles/*.py + profiles/applications/*.py diff --git a/setup.py b/setup.py index 35d51025..a4f49f92 100644 --- a/setup.py +++ b/setup.py @@ -1,27 +1,2 @@ -import setuptools, glob, shutil - -with open("README.md", "r") as fh: - long_description = fh.read() - -with open('VERSION', 'r') as fh: - VERSION = fh.read() - -setuptools.setup( - name="archinstall", - version=VERSION, - author="Anton Hvornum", - author_email="anton@hvornum.se", - description="Arch Linux installer - guided, templates etc.", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/archlinux/archinstall", - packages=setuptools.find_packages(), - classifiers=[ - "Programming Language :: Python :: 3.8", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Operating System :: POSIX :: Linux", - ], - python_requires='>=3.8', - setup_requires=['wheel'], - package_data={'archinstall': glob.glob('examples/*.py') + glob.glob('profiles/*.py') + glob.glob('profiles/applications/*.py')}, -) +import setuptools +setuptools.setup() -- cgit v1.2.3-54-g00ecf From 01aa1da474919f94e790850e54f0f1a502903daa Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 16:21:12 +0200 Subject: Add console_scripts archinstall entry point archinstall should be callable from the command-line. Previously this was achieved with a shell script, however Python packages contain a built in way to to this via the entry points mechanism. --- archinstall/__init__.py | 29 +++++++++++++++++++++++++++++ archinstall/__main__.py | 30 +----------------------------- setup.cfg | 4 ++++ 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/archinstall/__init__.py b/archinstall/__init__.py index c2773b64..d98b6daa 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -30,3 +30,32 @@ for arg in sys.argv[1:]: arguments[key] = val else: positionals.append(arg) + + +# TODO: Learn the dark arts of argparse... +# (I summon thee dark spawn of cPython) + +def run_as_a_module(): + """ + Since we're running this as a 'python -m archinstall' module OR + a nuitka3 compiled version of the project. + This function and the file __main__ acts as a entry point. + """ + + # Add another path for finding profiles, so that list_profiles() in Script() can find guided.py, unattended.py etc. + storage['PROFILE_PATH'].append(os.path.abspath(f'{os.path.dirname(__file__)}/examples')) + + if len(sys.argv) == 1: + sys.argv.append('guided') + + try: + script = Script(sys.argv[1]) + except ProfileNotFound as err: + print(f"Couldn't find file: {err}") + sys.exit(1) + + os.chdir(os.path.abspath(os.path.dirname(__file__))) + + # Remove the example directory from the PROFILE_PATH, to avoid guided.py etc shows up in user input questions. + storage['PROFILE_PATH'].pop() + script.execute() diff --git a/archinstall/__main__.py b/archinstall/__main__.py index 63c2f715..86ed0108 100644 --- a/archinstall/__main__.py +++ b/archinstall/__main__.py @@ -2,33 +2,5 @@ import archinstall import sys import os -# TODO: Learn the dark arts of argparse... -# (I summon thee dark spawn of cPython) - -def run_as_a_module(): - """ - Since we're running this as a 'python -m archinstall' module OR - a nuitka3 compiled version of the project. - This function and the file __main__ acts as a entry point. - """ - - # Add another path for finding profiles, so that list_profiles() in Script() can find guided.py, unattended.py etc. - archinstall.storage['PROFILE_PATH'].append(os.path.abspath(f'{os.path.dirname(__file__)}/examples')) - - if len(sys.argv) == 1: - sys.argv.append('guided') - - try: - script = archinstall.Script(sys.argv[1]) - except archinstall.ProfileNotFound as err: - print(f"Couldn't find file: {err}") - sys.exit(1) - - os.chdir(os.path.abspath(os.path.dirname(__file__))) - - # Remove the example directory from the PROFILE_PATH, to avoid guided.py etc shows up in user input questions. - archinstall.storage['PROFILE_PATH'].pop() - script.execute() - if __name__ == '__main__': - run_as_a_module() + archinstall.run_as_a_module() diff --git a/setup.cfg b/setup.cfg index ccbddf8a..3190791e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,3 +33,7 @@ archinstall = examples/*.py profiles/*.py profiles/applications/*.py + +[options.entry_points] +console_scripts = + archinstall = archinstall:run_as_a_module -- cgit v1.2.3-54-g00ecf From 16e6188f1decfa824ec4b886884c27cfe4914429 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 16:49:38 +0200 Subject: Remove outdated PKGBUILD files setup.cfg whitespace changes. --- PKGBUILD | 44 ----------------------------------- PKGBUILDs/archinstall-bin/PKGBUILD | 39 ------------------------------- PKGBUILDs/archinstall/PKGBUILD | 30 ------------------------ PKGBUILDs/python-archinstall/PKGBUILD | 40 ------------------------------- setup.cfg | 6 ++--- 5 files changed, 3 insertions(+), 156 deletions(-) delete mode 100644 PKGBUILD delete mode 100644 PKGBUILDs/archinstall-bin/PKGBUILD delete mode 100644 PKGBUILDs/archinstall/PKGBUILD delete mode 100644 PKGBUILDs/python-archinstall/PKGBUILD diff --git a/PKGBUILD b/PKGBUILD deleted file mode 100644 index 77e6b512..00000000 --- a/PKGBUILD +++ /dev/null @@ -1,44 +0,0 @@ -# Maintainer: Anton Hvornum -# Contributor: Giancarlo Razzolini -# Contributor: demostanis worlds - -pkgbase=archinstall-git -pkgname=('archinstall-git' 'python-archinstall-git') -pkgver=$(git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g') -pkgrel=1 -pkgdesc="Just another guided/automated Arch Linux installer with a twist" -arch=('any') -url="https://github.com/archlinux/archinstall" -license=('GPL') -depends=('python') -makedepends=('python-setuptools') - -build() { - cd "$startdir" - - python setup.py build -} - - -package_archinstall-git() { - depends=('python-archinstall-git') - conflicts=('archinstall') - cd "$startdir" - - mkdir -p "${pkgdir}/usr/bin" - - # Install a guided profile - cat - > "${pkgdir}/usr/bin/archinstall" <=3.8') -makedepends=('python>=3.8' 'nuitka') -optdepends=('pyttsx3: Adds text-to-speach support for log/screen output.') -sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea') - -build() { - cd "${pkgname}-${pkgver}" - - nuitka3 --standalone --show-progress archinstall - cp -r examples/ archinstall.dist/ -} - -package() { - echo "${srcdir}" - cd "${pkgname}-${pkgver}" - - mkdir -p "${pkgdir}/var/lib/archinstall/" - mkdir -p "${pkgdir}/usr/bin" - - mv archinstall.dist/* "${pkgdir}/var/lib/archinstall/" - - echo '#!/bin/bash' > "${pkgdir}/usr/bin/archinstall-bin" - echo '(cd /var/lib/archinstall && exec ./archinstall)' >> "${pkgdir}/usr/bin/archinstall-bin" - - chmod +x "${pkgdir}/var/lib/archinstall/archinstall" - chmod +x "${pkgdir}/usr/bin/archinstall-bin" -} diff --git a/PKGBUILDs/archinstall/PKGBUILD b/PKGBUILDs/archinstall/PKGBUILD deleted file mode 100644 index 7b1c4947..00000000 --- a/PKGBUILDs/archinstall/PKGBUILD +++ /dev/null @@ -1,30 +0,0 @@ -# Maintainer: Anton Hvornum -# Contributor: demostanis worlds - -pkgname="archinstall" -pkgver="2.1.3" -pkgdesc="Installs launcher scripts for archinstall" -pkgrel=1 -url="https://github.com/archlinux/archinstall" -license=('GPLv3') -provides=("${pkgname}") -arch=('x86_64') -source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/archlinux/archinstall/archive/v$pkgver.tar.gz") -depends=('python-archinstall') -sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea') - -package() { - mkdir -p "${pkgdir}/usr/bin" - - # Install a guided profile - cat - > "${pkgdir}/usr/bin/archinstall" < -# Contributor: demostanis worlds - -pkgname="python-archinstall" -pkgver="2.1.3" -pkgdesc="Installs ${pkgname} as a python library." -pkgrel=1 -url="https://github.com/archlinux/archinstall" -source=("${pkgname}-v${pkgver}-x86_64.tar.gz::https://github.com/archlinux/archinstall/archive/v$pkgver.tar.gz") -license=('GPLv3') -provides=("${pkgname}") -arch=('x86_64') -depends=('python>=3.8') -makedepends=('python-setuptools') -optdepends=('pyttsx3: Adds text-to-speech support for log/screen output.') -sha256sums=('53c00f7e7ad245cd2cbbf041b5a735df2fc29454c24b1d369f678cc0610b7cea') - -build() { - cd "archinstall-${pkgver}" - - python setup.py build - - # Build man pages - cd docs - make man -} - -package() { - cd "archinstall-${pkgver}" - - python setup.py install \ - --prefix=/usr \ - --root="${pkgdir}" \ - --optimize=1 - - install -Dm644 docs/_build/man/archinstall.1 "${pkgdir}"/usr/share/man/man1/archinstall.1 -} - -# vim:ft=sh - diff --git a/setup.cfg b/setup.cfg index 3190791e..e5d79ef3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,10 +14,10 @@ project_urls = Documentation = https://archinstall.readthedocs.io/ classifers = Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 - License :: OSI Approved :: GNU General Public License v3 (GPLv3) - Operating System :: POSIX :: Linux + License :: OSI Approved :: GNU General Public License v3 (GPLv3) + Operating System :: POSIX :: Linux [options] packages = find: -- cgit v1.2.3-54-g00ecf From d1be941336e37275a2df2dc9ff988bdf04b4f0b5 Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 17:58:58 +0200 Subject: Add primary PKGBUILD for testing the package --- PKGBUILD | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 PKGBUILD diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 00000000..42946c6a --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,24 @@ +# Maintainer: Anton Hvornum +# Contributor: Giancarlo Razzolini +# Contributor: demostanis worlds + +pkgname=archinstall-git +pkgver=$(git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g') +pkgrel=1 +pkgdesc="Just another guided/automated Arch Linux installer with a twist" +arch=('any') +url="https://github.com/archlinux/archinstall" +license=('GPL') +depends=('python') +makedepends=('python-setuptools') +conflicts=('archinstall' 'archinstall-python' 'python-archinstall-git') + +build() { + cd "$startdir" + python setup.py build +} + +package() { + cd "$startdir" + python setup.py install --root="${pkgdir}" --optimize=1 --skip-build +} -- cgit v1.2.3-54-g00ecf From e9af6a0b35ba246f4f07c81041a79e4b163381fa Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 18:02:30 +0200 Subject: Indent using 8 spaces in PKGBUILD --- PKGBUILD | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 42946c6a..c951e70a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -14,11 +14,11 @@ makedepends=('python-setuptools') conflicts=('archinstall' 'archinstall-python' 'python-archinstall-git') build() { - cd "$startdir" - python setup.py build + cd "$startdir" + python setup.py build } package() { - cd "$startdir" - python setup.py install --root="${pkgdir}" --optimize=1 --skip-build + cd "$startdir" + python setup.py install --root="${pkgdir}" --optimize=1 --skip-build } -- cgit v1.2.3-54-g00ecf From 81aa1df82a80c1f7bf0b71c50b2a571d12280730 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 5 Apr 2021 13:40:40 -0400 Subject: Fix #183 gnome-extras installs far too much bloat This keeps some of the most useful packages from the defaults. --- profiles/applications/gnome.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/applications/gnome.py b/profiles/applications/gnome.py index 1f2a20a1..132b4591 100644 --- a/profiles/applications/gnome.py +++ b/profiles/applications/gnome.py @@ -1,4 +1,4 @@ import archinstall -installation.add_additional_packages("gnome gnome-extra gdm") # We'll create a gnome-minimal later, but for now, we'll avoid issues by giving more than we need. -# Note: gdm should be part of the gnome group, but adding it here for clarity \ No newline at end of file +installation.add_additional_packages("gnome gnome-tweaks gnome-todo evolution gdm") # We'll create a gnome-minimal later, but for now, we'll avoid issues by giving more than we need. +# Note: gdm should be part of the gnome group, but adding it here for clarity -- cgit v1.2.3-54-g00ecf From 9c82bde2fcd9b442828f8b75740368b72d22c0e0 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 5 Apr 2021 13:42:03 -0400 Subject: gnome-sound-recorder is probably also desirable --- profiles/applications/gnome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/gnome.py b/profiles/applications/gnome.py index 132b4591..06d5feca 100644 --- a/profiles/applications/gnome.py +++ b/profiles/applications/gnome.py @@ -1,4 +1,4 @@ import archinstall -installation.add_additional_packages("gnome gnome-tweaks gnome-todo evolution gdm") # We'll create a gnome-minimal later, but for now, we'll avoid issues by giving more than we need. +installation.add_additional_packages("gnome gnome-tweaks gnome-todo gnome-sound-recorder evolution gdm") # We'll create a gnome-minimal later, but for now, we'll avoid issues by giving more than we need. # Note: gdm should be part of the gnome group, but adding it here for clarity -- cgit v1.2.3-54-g00ecf From a3ace5e36e01cb84761d967a32dea49c97af4406 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 5 Apr 2021 13:44:16 -0400 Subject: This comment should no longer apply. This is a fairly sane default for GNOME. --- profiles/applications/gnome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/gnome.py b/profiles/applications/gnome.py index 06d5feca..e9fd1d50 100644 --- a/profiles/applications/gnome.py +++ b/profiles/applications/gnome.py @@ -1,4 +1,4 @@ import archinstall -installation.add_additional_packages("gnome gnome-tweaks gnome-todo gnome-sound-recorder evolution gdm") # We'll create a gnome-minimal later, but for now, we'll avoid issues by giving more than we need. +installation.add_additional_packages("gnome gnome-tweaks gnome-todo gnome-sound-recorder evolution gdm") # Note: gdm should be part of the gnome group, but adding it here for clarity -- cgit v1.2.3-54-g00ecf From 5134fb75c6b06ee85c94dc3c3858687a2b937dca Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Mon, 5 Apr 2021 22:06:25 +0200 Subject: Corrected for keymap before encrypt hook Also think that we should patch mkinitcpio, not replace it. Especially in the btrfs case where we simply just want to add `btrfs` to the `MODULES` section. --- archinstall/lib/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a37d3ee8..7094adc0 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -306,14 +306,14 @@ class Installer(): mkinit.write('MODULES=(btrfs)\n') mkinit.write('BINARIES=(/usr/bin/btrfs)\n') mkinit.write('FILES=()\n') - mkinit.write('HOOKS=(base udev autodetect modconf block encrypt filesystems keymap keyboard fsck)\n') + mkinit.write('HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)\n') sys_command(f'/usr/bin/arch-chroot {self.mountpoint} mkinitcpio -p linux') elif self.partition.encrypted: with open(f'{self.mountpoint}/etc/mkinitcpio.conf', 'w') as mkinit: mkinit.write('MODULES=()\n') mkinit.write('BINARIES=()\n') mkinit.write('FILES=()\n') - mkinit.write('HOOKS=(base udev autodetect modconf block encrypt filesystems keymap keyboard fsck)\n') + mkinit.write('HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)\n') sys_command(f'/usr/bin/arch-chroot {self.mountpoint} mkinitcpio -p linux') self.helper_flags['base'] = True -- cgit v1.2.3-54-g00ecf From b6e9f11669cb8264767230823ad15361c65ab56d Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Mon, 5 Apr 2021 22:25:40 +0200 Subject: Fix PKGBUILD conflicts and add provides line --- PKGBUILD | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index c951e70a..7a5da658 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -11,7 +11,8 @@ url="https://github.com/archlinux/archinstall" license=('GPL') depends=('python') makedepends=('python-setuptools') -conflicts=('archinstall' 'archinstall-python' 'python-archinstall-git') +provides=('python-archinstall') +conflicts=('archinstall' 'python-archinstall' 'python-archinstall-git') build() { cd "$startdir" -- cgit v1.2.3-54-g00ecf From 23fc3ab2f2d11d49e1eab3b36d3c2758d682e5cd Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Mon, 5 Apr 2021 23:13:27 +0300 Subject: Fix incorrect behavior for empty sudo username --- archinstall/lib/user_interaction.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index a58abcff..3830962c 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -61,8 +61,6 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri while 1: new_user = input(prompt).strip(' ') - if not check_for_correct_username(new_user): - continue if not new_user and forced: # TODO: make this text more generic? # It's only used to create the first sudo user when root is disabled in guided.py @@ -70,6 +68,8 @@ def ask_for_superuser_account(prompt='Create a required super-user with sudo pri continue elif not new_user and not forced: raise UserError("No superuser was created.") + elif not check_for_correct_username(new_user): + continue password = get_password(prompt=f'Password for user {new_user}: ') return {new_user: {"!password" : password}} -- cgit v1.2.3-54-g00ecf From 8bc1f0d4205403cc6e2fed0a46648ab9531ab5e4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 11:33:50 -0400 Subject: Remove evolution from default installation as suggested It was pointed out that users can install an email client if they want one. --- profiles/applications/gnome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/gnome.py b/profiles/applications/gnome.py index e9fd1d50..66656134 100644 --- a/profiles/applications/gnome.py +++ b/profiles/applications/gnome.py @@ -1,4 +1,4 @@ import archinstall -installation.add_additional_packages("gnome gnome-tweaks gnome-todo gnome-sound-recorder evolution gdm") +installation.add_additional_packages("gnome gnome-tweaks gnome-todo gnome-sound-recorder gdm") # Note: gdm should be part of the gnome group, but adding it here for clarity -- cgit v1.2.3-54-g00ecf From 186f12c5f1782d47dae88a4066bcc94163c7d696 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 12:55:15 -0400 Subject: Remove chromium from default awesome install Promotes a consistent installation experience across DEs. --- profiles/awesome.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/profiles/awesome.py b/profiles/awesome.py index b914b175..a565ccb3 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -31,11 +31,10 @@ if __name__ == 'awesome': # Then setup and configure the desktop environment: awesome editor = "nano" filebrowser = "nemo gpicview-gtk3" - webbrowser = "chromium" # TODO: Ask the user to select one instead utils = "openssh sshfs htop scrot wget" - installation.add_additional_packages(f"{webbrowser} {utils} {filebrowser} {editor}") + installation.add_additional_packages(f"{utils} {filebrowser} {editor}") alacritty = archinstall.Application(installation, 'alacritty') alacritty.install() -- cgit v1.2.3-54-g00ecf From b483c718dae6506fb526f4f096c8335d403c0a59 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 13:03:42 -0400 Subject: Add a message about specifying a web browser --- examples/guided.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/guided.py b/examples/guided.py index a92343f7..9df8a518 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -181,6 +181,7 @@ def ask_user_questions(): exit(1) # Additional packages (with some light weight error handling for invalid package names) + print("Packages not part of the desktop environment are not installed by default. If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") if not archinstall.arguments.get('packages', None): archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] -- cgit v1.2.3-54-g00ecf From e9a3e8661ea15df1440d88dc97e4d2e353be11ba Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 19:05:52 +0200 Subject: Moved the print logic for browser warning --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 9df8a518..4205518d 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -181,8 +181,8 @@ def ask_user_questions(): exit(1) # Additional packages (with some light weight error handling for invalid package names) - print("Packages not part of the desktop environment are not installed by default. If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") if not archinstall.arguments.get('packages', None): + print("Packages not part of the desktop environment are not installed by default. If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] # Verify packages that were given -- cgit v1.2.3-54-g00ecf From 9d076fad8957415bdb5715c8b731ec3cf0f244b2 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 14:53:01 -0400 Subject: DOCS: How to test a commit from a live image --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index c60e714a..50cf66c4 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,12 @@ When doing so, attach any `install-session_*.log` to the issue ticket which can # Testing +## Using a Live ISO Image + +If you are testing a commit from the repository using the vanilla Arch Live ISO image, you can replace the version of archinstall with a new version and run that. To do this, you will first need to establish a network connection and run `pacman -Sy; pacman -S git python-pip`. Once you have pip installed, run `pip uninstall archinstall`. Then, clone the repo using `git clone https://github.com/archlinux/archinstall`, and cd into the archinstall directory. Alternatively, you can checkout a different branch or fork of the project. Build the project and install it using `python setup.py build; python setup.py install`. Then, run archinstall with `python -m archinstall`. + +## Without a Live ISO Image + To test this without a live ISO, the simplest approach is to use a local image and create a loop device.
This can be done by installing `pacman -S arch-install-scripts util-linux` locally and doing the following: -- cgit v1.2.3-54-g00ecf From 4afcde09f304abea0b56153fdbe6fddc8e7ab2c3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 16:19:34 -0400 Subject: This is probably more technically correct --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50cf66c4..3f651c9b 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ When doing so, attach any `install-session_*.log` to the issue ticket which can ## Using a Live ISO Image -If you are testing a commit from the repository using the vanilla Arch Live ISO image, you can replace the version of archinstall with a new version and run that. To do this, you will first need to establish a network connection and run `pacman -Sy; pacman -S git python-pip`. Once you have pip installed, run `pip uninstall archinstall`. Then, clone the repo using `git clone https://github.com/archlinux/archinstall`, and cd into the archinstall directory. Alternatively, you can checkout a different branch or fork of the project. Build the project and install it using `python setup.py build; python setup.py install`. Then, run archinstall with `python -m archinstall`. +If you are testing a commit from the repository using the vanilla Arch Live ISO image, you can replace the version of archinstall with a new version and run that. To do this, you will first need to establish a network connection and run `pacman -Sy; pacman -S git python-pip`. Once you have pip installed, run `pacman -R archinstall`. Then, clone the repo using `git clone https://github.com/archlinux/archinstall`, and cd into the archinstall directory. Alternatively, you can checkout a different branch or fork of the project. Build the project and install it using `python setup.py build; python setup.py install`. Then, run archinstall with `python -m archinstall`. ## Without a Live ISO Image -- cgit v1.2.3-54-g00ecf From 837469bf76a55b324c17dcb258435d1e6bde2b52 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 22:21:45 +0200 Subject: Made it into more of a "step by step" structure --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3f651c9b..5b911a49 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,18 @@ When doing so, attach any `install-session_*.log` to the issue ticket which can ## Using a Live ISO Image -If you are testing a commit from the repository using the vanilla Arch Live ISO image, you can replace the version of archinstall with a new version and run that. To do this, you will first need to establish a network connection and run `pacman -Sy; pacman -S git python-pip`. Once you have pip installed, run `pacman -R archinstall`. Then, clone the repo using `git clone https://github.com/archlinux/archinstall`, and cd into the archinstall directory. Alternatively, you can checkout a different branch or fork of the project. Build the project and install it using `python setup.py build; python setup.py install`. Then, run archinstall with `python -m archinstall`. +If you want to test a commit, branch or bleeding edge release from the repository using the vanilla Arch Live ISO image, you can replace the version of archinstall with a new version and run that with the steps described below. + + 1. You need a working network connection + 2. Install the build requirements with `pacman -Sy; pacman -S git python-pip` + *(note that this may or may not work depending on your RAM and current state of the squashfs maximum filesystem free space)* + 3. Uninstall the previous version of archinstall with `pip uninstall archinstall` + 4. Now clone the latest repository with `git clone https://github.com/archlinux/archinstall` + 5. Enter the repository with `cd archinstall` + *At this stage, you can choose to check out a feature branch for instance with `git checkout torxed-v2.2.0`* + 6. Build the project and install it using `python setup.py build` and `python setup.py install` + +After this, running archinstall with `python -m archinstall` will run against whatever branch you chose in step 5. ## Without a Live ISO Image -- cgit v1.2.3-54-g00ecf From 0957ce4f00d232c773476bbc4946bfc27a52519a Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 22:23:15 +0200 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b911a49..ce5cd47d 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ If you want to test a commit, branch or bleeding edge release from the repositor 1. You need a working network connection 2. Install the build requirements with `pacman -Sy; pacman -S git python-pip` *(note that this may or may not work depending on your RAM and current state of the squashfs maximum filesystem free space)* - 3. Uninstall the previous version of archinstall with `pip uninstall archinstall` + 3. Uninstall the previous version of archinstall with `pacman -R archinstall` 4. Now clone the latest repository with `git clone https://github.com/archlinux/archinstall` 5. Enter the repository with `cd archinstall` *At this stage, you can choose to check out a feature branch for instance with `git checkout torxed-v2.2.0`* -- cgit v1.2.3-54-g00ecf From 8bfa24d6c6a9563e898c15a8f1868d379716ca3f Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 16:25:57 -0400 Subject: After testing pacman -R, I noticed it didn't work right --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce5cd47d..5b911a49 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ If you want to test a commit, branch or bleeding edge release from the repositor 1. You need a working network connection 2. Install the build requirements with `pacman -Sy; pacman -S git python-pip` *(note that this may or may not work depending on your RAM and current state of the squashfs maximum filesystem free space)* - 3. Uninstall the previous version of archinstall with `pacman -R archinstall` + 3. Uninstall the previous version of archinstall with `pip uninstall archinstall` 4. Now clone the latest repository with `git clone https://github.com/archlinux/archinstall` 5. Enter the repository with `cd archinstall` *At this stage, you can choose to check out a feature branch for instance with `git checkout torxed-v2.2.0`* -- cgit v1.2.3-54-g00ecf From 89c0105d4c748512a9e131cf506cf7a9d53d6301 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 16:32:09 -0400 Subject: python setup.py build is not needed if you call install --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b911a49..2f3881e1 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ If you want to test a commit, branch or bleeding edge release from the repositor 4. Now clone the latest repository with `git clone https://github.com/archlinux/archinstall` 5. Enter the repository with `cd archinstall` *At this stage, you can choose to check out a feature branch for instance with `git checkout torxed-v2.2.0`* - 6. Build the project and install it using `python setup.py build` and `python setup.py install` + 6. Build the project and install it using `python setup.py install` After this, running archinstall with `python -m archinstall` will run against whatever branch you chose in step 5. -- cgit v1.2.3-54-g00ecf From e4ca6d83283697cfeae1da37d8eb22089e3e2664 Mon Sep 17 00:00:00 2001 From: Jatin <40650341+jatin-cbs@users.noreply.github.com> Date: Wed, 7 Apr 2021 19:18:34 +0530 Subject: Remove gnome-todo and gnome-sound-recorder from default installation gnome todo and gnome sound recorder should not be in default installation, honoring the Arch Linux philosophy. These packages are not even pre installed on other major linux distributions. --- profiles/applications/gnome.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/gnome.py b/profiles/applications/gnome.py index 66656134..e26290dc 100644 --- a/profiles/applications/gnome.py +++ b/profiles/applications/gnome.py @@ -1,4 +1,4 @@ import archinstall -installation.add_additional_packages("gnome gnome-tweaks gnome-todo gnome-sound-recorder gdm") +installation.add_additional_packages("gnome gnome-tweaks gdm") # Note: gdm should be part of the gnome group, but adding it here for clarity -- cgit v1.2.3-54-g00ecf From 7ce2051a2665dea06b384fd0de2d63bba0246840 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 21:55:00 +0200 Subject: Update pull_request_template.md --- docs/pull_request_template.md | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md index 6da175ae..d2f97314 100644 --- a/docs/pull_request_template.md +++ b/docs/pull_request_template.md @@ -1,31 +1,24 @@ -# Pull Request Template +🚨 PR Guidelines: -Make sure you've checked out the [contribution guideline](https://github.com/archlinux/archinstall/blob/master/CONTRIBUTING.md).
-Most of the guidelines are not enforced, but is heavily encouraged. +# New features -## Description +Merge new features in to `torxed-v2.2.0`. +This branch is designated for potential breaking changes, added complexity and new functionality. -Please include a summary of the change and which issue is fixed.
-It is also helpful to add links to online documentation or to the implementation of the code you are changing. +# Bug fixes -## Bugs and Issues +Merge against `master` for bug fixes and anything that improves stability and quality of life.
+This excludes: + * New functionality + * Added complexity + * Breaking changes -If this pull-request fixes an issue or a bug, please mention the issues with the approriate issue referece *(Example: #8)*. +# Describe your PR -## How Has This Been Tested? +If the changes has been discussed in an Issue, please tag it so we can backtrace from the Issue later on.
+If the PR is larger than ~20 lines, please describe it here unless described in an issue. -If possible, mention any tests you have made with the current code base included in the pull-requests.
-Any core-developer will also run tests, but this helps speed things up. Below is a template that can be used: +# Testing -As an example: - -**Test Configuration**: -* Hardware: VirtualBox 6.1 -* Specific steps: Ran installer with additional packages `nano` and `wget` - -## Checklist: - -- [ ] My code follows the style guidelines of this project -- [ ] I have performed a self-review of my own code to the best of my abilities -- [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have made corresponding changes to the documentation where possible/if applicable +Any new feature or stability improvement should be tested if possible. +Please follow the test instructions at the bottom of the README. -- cgit v1.2.3-54-g00ecf From 67d05d24ebefec3c51bae73b23a91db5c1880a03 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 21:55:23 +0200 Subject: Update pull_request_template.md --- docs/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md index d2f97314..a2b6ff88 100644 --- a/docs/pull_request_template.md +++ b/docs/pull_request_template.md @@ -2,7 +2,7 @@ # New features -Merge new features in to `torxed-v2.2.0`. +Merge new features in to `torxed-v2.2.0`.
This branch is designated for potential breaking changes, added complexity and new functionality. # Bug fixes -- cgit v1.2.3-54-g00ecf From 8a7e261c3fc3bfffeecac7ec8f1a8cc1738ff393 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 21:57:04 +0200 Subject: Update pull_request_template.md --- docs/pull_request_template.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md index a2b6ff88..ced6fdf1 100644 --- a/docs/pull_request_template.md +++ b/docs/pull_request_template.md @@ -1,11 +1,11 @@ 🚨 PR Guidelines: -# New features +# New features *(v2.2.0)* Merge new features in to `torxed-v2.2.0`.
This branch is designated for potential breaking changes, added complexity and new functionality. -# Bug fixes +# Bug fixes *(v2.1.4)* Merge against `master` for bug fixes and anything that improves stability and quality of life.
This excludes: @@ -13,6 +13,8 @@ This excludes: * Added complexity * Breaking changes +Any changes to `master` automatically gets pulled in to `torxed-v2.2.0` to avoid merge hell. + # Describe your PR If the changes has been discussed in an Issue, please tag it so we can backtrace from the Issue later on.
@@ -22,3 +24,5 @@ If the PR is larger than ~20 lines, please describe it here unless described in Any new feature or stability improvement should be tested if possible. Please follow the test instructions at the bottom of the README. + +*These PR guidelines will change after 2021-05-01, which is when `v2.1.4` gets released* -- cgit v1.2.3-54-g00ecf From 8728ec8e664b8e8d569c4b2816401f72ceb3e5b3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 21:57:25 +0200 Subject: Update pull_request_template.md --- docs/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md index ced6fdf1..c2f694ce 100644 --- a/docs/pull_request_template.md +++ b/docs/pull_request_template.md @@ -25,4 +25,4 @@ If the PR is larger than ~20 lines, please describe it here unless described in Any new feature or stability improvement should be tested if possible. Please follow the test instructions at the bottom of the README. -*These PR guidelines will change after 2021-05-01, which is when `v2.1.4` gets released* +*These PR guidelines will change after 2021-05-01, which is when `v2.1.4` gets onto the new ISO* -- cgit v1.2.3-54-g00ecf From ef2e1fd2394c31f9af509fcefbc3ac4c191827ca Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 7 Apr 2021 19:41:25 -0400 Subject: Make the minimal installation example use the minimal profile instead of awesome wm --- examples/minimal.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/minimal.py b/examples/minimal.py index 664bad0d..9124f5bd 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -24,7 +24,7 @@ with archinstall.Filesystem(harddrive, archinstall.GPT) as fs: installation.add_bootloader() installation.add_additional_packages(['nano', 'wget', 'git']) - installation.install_profile('awesome') + installation.install_profile('minimal') - installation.user_create('anton', 'test') - installation.user_set_pw('root', 'toor') \ No newline at end of file + installation.user_create('devel', 'devel') + installation.user_set_pw('root', 'toor') -- cgit v1.2.3-54-g00ecf From b96ba6e23726dc74536be0cf576ac53b067a097c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 7 Apr 2021 20:28:30 -0400 Subject: Break web browser suggestion into second line to avoid wrapping --- examples/guided.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 4205518d..ed838a29 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -182,7 +182,8 @@ def ask_user_questions(): # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): - print("Packages not part of the desktop environment are not installed by default. If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") + print("Packages not part of the desktop environment are not installed by default.") + print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] # Verify packages that were given -- cgit v1.2.3-54-g00ecf From c6e7bb4595423cb99b4357ca497d9639c3347fc7 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 10:36:42 +0200 Subject: Corrected the new-line parameter --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 7094adc0..76950099 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -149,7 +149,7 @@ class Installer(): fstab_fh.write(fstab) if not os.path.isfile(f'{self.mountpoint}/etc/fstab'): - raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{b"".join(fstab)}') + raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{fstab}') return True -- cgit v1.2.3-54-g00ecf From 57a458e4eeaf569fa1820f2f0c142d2c2a43e480 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 25 Mar 2021 14:39:29 +0100 Subject: Updating documentation. --- docs/archinstall/general.rst | 3 +++ docs/index.rst | 2 +- docs/installing/guided.rst | 2 -- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/archinstall/general.rst b/docs/archinstall/general.rst index 0403ae30..312c03af 100644 --- a/docs/archinstall/general.rst +++ b/docs/archinstall/general.rst @@ -24,6 +24,9 @@ Locale related .. autofunction:: archinstall.set_keyboard_language +.. + autofunction:: archinstall.Installer.set_keyboard_layout + Services ======== diff --git a/docs/index.rst b/docs/index.rst index deb2734e..a5d07901 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -2,7 +2,7 @@ python-archinstall Documentation ================================ | **python-archinstall** *(or, archinstall for short)* is a helper library to install Arch Linux and manage services, packages and other things. -| It comes packaged with different pre-configured installers, such as the :ref:`guided ` installer. +| It comes packaged with different pre-configured installers, such as the `Guided installation`_ installer. | | A demo can be viewed here: `https://www.youtube.com/watch?v=9Xt7X_Iqg6E `_ which uses the default guided installer. diff --git a/docs/installing/guided.rst b/docs/installing/guided.rst index 2e1cda09..8699ae62 100644 --- a/docs/installing/guided.rst +++ b/docs/installing/guided.rst @@ -1,5 +1,3 @@ -.. _installing.guided: - Guided installation =================== -- cgit v1.2.3-54-g00ecf From 44574d19215492e2d4983e2881474f2a17dcf586 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 2 Apr 2021 11:38:42 +0200 Subject: Fixing glitch in variable use after moving to __packages__ definition. --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 76950099..92daee2b 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -52,7 +52,7 @@ class Installer(): 'user' : False # Root counts as a user, if additional users are skipped. } - self.base_packages = base_packages.split(' ') + self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages self.post_base_install = [] storage['session'] = self -- cgit v1.2.3-54-g00ecf From a16723abdec6442eeb70999c3cb92ab3a2b465e3 Mon Sep 17 00:00:00 2001 From: advaithm Date: Mon, 5 Apr 2021 21:05:15 +0530 Subject: Update guided.py --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index ed838a29..7b4faf35 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,4 +1,4 @@ -import getpass, time, json, sys, signal, os +import getpass, time, json, sys, signal, os, subprocess import archinstall """ -- cgit v1.2.3-54-g00ecf From 44df0f6046ac0d010641801a413e7839ca234e97 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 07:21:11 +0530 Subject: added _post_install hook. --- archinstall/lib/profiles.py | 15 +++++++++++++++ examples/guided.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 4ef6c533..b56304c5 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -177,6 +177,21 @@ class Profile(Script): if hasattr(imported, '_prep_function'): return True return False + def has_post_install(self): + with open(self.path, 'r') as source: + source_data = source.read() + + # Some crude safety checks, make sure the imported profile has + # a __name__ check and if so, check if it's got a _prep_function() + # we can call to ask for more user input. + # + # If the requirements are met, import with .py in the namespace to not + # trigger a traditional: + # if __name__ == 'moduleName' + if '__name__' in source_data and '_post_install' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '_post_install'): + return True class Application(Profile): def __repr__(self, *args, **kwargs): diff --git a/examples/guided.py b/examples/guided.py index 7b4faf35..ed838a29 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,4 +1,4 @@ -import getpass, time, json, sys, signal, os, subprocess +import getpass, time, json, sys, signal, os import archinstall """ -- cgit v1.2.3-54-g00ecf From 926906d94613ef67aca10754f4e7eb93c8eaf100 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 08:34:34 +0530 Subject: merge kde and kde-wayland --- profiles/applications/kde-wayland.py | 7 ------- profiles/kde-wayland.py | 34 ---------------------------------- profiles/kde.py | 13 ++++++++++++- 3 files changed, 12 insertions(+), 42 deletions(-) delete mode 100644 profiles/applications/kde-wayland.py delete mode 100644 profiles/kde-wayland.py diff --git a/profiles/applications/kde-wayland.py b/profiles/applications/kde-wayland.py deleted file mode 100644 index 6a9be294..00000000 --- a/profiles/applications/kde-wayland.py +++ /dev/null @@ -1,7 +0,0 @@ -import archinstall -packages = "plasma-meta kde-applications-meta plasma-wayland-session sddm" -# if the package selection can be reduced go for it -if "nvidia" in _gfx_driver_packages: - packages = packages + " egl-wayland" -installation.add_additional_packages(packages) -# We'll support plasma-desktop-wayland (minimal) later diff --git a/profiles/kde-wayland.py b/profiles/kde-wayland.py deleted file mode 100644 index e21f62c8..00000000 --- a/profiles/kde-wayland.py +++ /dev/null @@ -1,34 +0,0 @@ -# A desktop environment using "KDE". -import archinstall, os - -# 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') - -# 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-wayland': - # Install dependency profiles - installation.install_profile('xorg') - - # Install the application kde from the template under /applications/ - kde = archinstall.Application(installation, 'kde-wayland') - kde.install() - print("when you login, select Plasma (Wayland) for the wayland session") - # Enable autostart of KDE for all users - installation.enable_service('sddm') diff --git a/profiles/kde.py b/profiles/kde.py index 32819bd5..5fb1ca4c 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -1,6 +1,6 @@ # A desktop environment using "KDE". -import archinstall, os +import archinstall, os # TODO: Remove hard dependency of bash (due to .bash_profile) @@ -20,6 +20,17 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') +def _post_install(*args, **kwargs): + if "nvidia" in _gfx_driver_packages: + print("Plasma wayland is currently in a buggy state on Nvidia cards") + choice = input("Kde plasma has a wayland support would you like to install the required binaries [Y/n] ").lower() + if choice == "y": + packages = "plasma-meta kde-applications-meta plasma-wayland-session sddm" + # if the package selection can be reduced go for it + if "nvidia" in _gfx_driver_packages: + packages = packages + " egl-wayland" + installation.add_additional_packages(packages) + # 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 -- cgit v1.2.3-54-g00ecf From 210e53ca3e19920ce7350743dc92f0f648f764c7 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 17:36:20 +0530 Subject: Update kde.py --- profiles/kde.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/kde.py b/profiles/kde.py index 5fb1ca4c..d1174923 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -25,7 +25,7 @@ def _post_install(*args, **kwargs): print("Plasma wayland is currently in a buggy state on Nvidia cards") choice = input("Kde plasma has a wayland support would you like to install the required binaries [Y/n] ").lower() if choice == "y": - packages = "plasma-meta kde-applications-meta plasma-wayland-session sddm" + packages = "plasma-wayland-session" # if the package selection can be reduced go for it if "nvidia" in _gfx_driver_packages: packages = packages + " egl-wayland" -- cgit v1.2.3-54-g00ecf From 130f5729a0939281e8bd2ccc22bfd6c1d3b35c43 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 18:28:18 +0530 Subject: ask user for default session over asking if they want wayland --- profiles/applications/kde.py | 2 +- profiles/kde.py | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index 87a266b0..c0972d50 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,2 +1,2 @@ import archinstall -installation.add_additional_packages("plasma-meta kde-applications-meta sddm") # We'll support plasma-desktop (minimal) later iirc sddm should be part of plasma-meta +installation.add_additional_packages("plasma-meta kde-applications-meta plasma-wayland-session sddm") # We'll support plasma-desktop (minimal) later iirc sddm should be part of plasma-meta diff --git a/profiles/kde.py b/profiles/kde.py index d1174923..89ff236f 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -1,6 +1,6 @@ # A desktop environment using "KDE". -import archinstall, os +import archinstall, os, shutil # TODO: Remove hard dependency of bash (due to .bash_profile) @@ -22,15 +22,11 @@ def _prep_function(*args, **kwargs): def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: - print("Plasma wayland is currently in a buggy state on Nvidia cards") - choice = input("Kde plasma has a wayland support would you like to install the required binaries [Y/n] ").lower() + print("Plasma wayland is currently in an unusable state on Nvidia cards") + choice = input("Would you like plasma-wayland to be the default session [Y/n] ").lower() if choice == "y": - packages = "plasma-wayland-session" - # if the package selection can be reduced go for it - if "nvidia" in _gfx_driver_packages: - packages = packages + " egl-wayland" - installation.add_additional_packages(packages) - + shutil.move("/usr/share/xsessions/plasma.desktop","/usr/share/xsessions/plasmax11.desktop") + shutil.move("/usr/share/wayland-sessions/plasmawayland.desktop","/usr/share/wayland-sessions/plasma.desktop") # 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 -- cgit v1.2.3-54-g00ecf From 56df79d647b8058bd7160238a418ef8606aef0b7 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 18:59:05 +0530 Subject: added egl-wayland and changed prompt --- profiles/applications/kde.py | 5 ++++- profiles/kde.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index c0972d50..fc42223b 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,2 +1,5 @@ import archinstall -installation.add_additional_packages("plasma-meta kde-applications-meta plasma-wayland-session sddm") # We'll support plasma-desktop (minimal) later iirc sddm should be part of plasma-meta +packages = "plasma-meta kde-applications-meta sddm plasma-wayland-session" +if "nvidia" in _gfx_driver_packages: + packages = packages + " egl-wayland" +installation.add_additional_packages(packages) \ No newline at end of file diff --git a/profiles/kde.py b/profiles/kde.py index 89ff236f..7276f095 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -1,6 +1,6 @@ # A desktop environment using "KDE". -import archinstall, os, shutil +import archinstall, os # TODO: Remove hard dependency of bash (due to .bash_profile) @@ -22,11 +22,11 @@ def _prep_function(*args, **kwargs): def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: - print("Plasma wayland is currently in an unusable state on Nvidia cards") + print("Plasma Wayland has known compatibility issues with the proprietary Nvidia driver") choice = input("Would you like plasma-wayland to be the default session [Y/n] ").lower() if choice == "y": - shutil.move("/usr/share/xsessions/plasma.desktop","/usr/share/xsessions/plasmax11.desktop") - shutil.move("/usr/share/wayland-sessions/plasmawayland.desktop","/usr/share/wayland-sessions/plasma.desktop") + installation.arch_chroot("mv /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasmax11.desktop") + installation.arch_chroot("mv /usr/share/wayland-sessions/plasmawayland.desktop /usr/share/wayland-sessions/plasma.desktop") # 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 -- cgit v1.2.3-54-g00ecf From b8774236dd5b819eeeddbb7f39a7a87ec45a9bc9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 18:27:30 +0200 Subject: Added a forgotten return value of _post_install --- profiles/kde.py | 1 + 1 file changed, 1 insertion(+) diff --git a/profiles/kde.py b/profiles/kde.py index 7276f095..e1449d81 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -27,6 +27,7 @@ def _post_install(*args, **kwargs): if choice == "y": installation.arch_chroot("mv /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasmax11.desktop") installation.arch_chroot("mv /usr/share/wayland-sessions/plasmawayland.desktop /usr/share/wayland-sessions/plasma.desktop") + 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 -- cgit v1.2.3-54-g00ecf From 858585e7d7f21b918bbf636bb98fc89e133c8050 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 12:33:13 -0400 Subject: Switch from metapackage to a more minimal install --- profiles/applications/kde.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index fc42223b..77343d9a 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,5 +1,5 @@ import archinstall -packages = "plasma-meta kde-applications-meta sddm plasma-wayland-session" +packages = "plasma-meta konsole kate dolphin khelpcenter sddm plasma-wayland-session" if "nvidia" in _gfx_driver_packages: packages = packages + " egl-wayland" -installation.add_additional_packages(packages) \ No newline at end of file +installation.add_additional_packages(packages) -- cgit v1.2.3-54-g00ecf From c07d63296b004b1256e244468cf0478b1998821e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 13:45:08 -0400 Subject: It was pointed out that khelpcenter isn't strictly necessary --- profiles/applications/kde.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/kde.py b/profiles/applications/kde.py index 77343d9a..af1e6597 100644 --- a/profiles/applications/kde.py +++ b/profiles/applications/kde.py @@ -1,5 +1,5 @@ import archinstall -packages = "plasma-meta konsole kate dolphin khelpcenter sddm plasma-wayland-session" +packages = "plasma-meta konsole kate dolphin sddm plasma-wayland-session" if "nvidia" in _gfx_driver_packages: packages = packages + " egl-wayland" installation.add_additional_packages(packages) -- cgit v1.2.3-54-g00ecf From ea81759e40bf0a54c30dbf90453e2d4c036f01aa Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 08:37:39 -0400 Subject: Add minimal profile and implement idea of 'top-level' profiles --- profiles/awesome.py | 5 +++++ profiles/desktop.py | 2 ++ profiles/gnome.py | 2 ++ profiles/kde.py | 2 ++ profiles/minimal.py | 23 +++++++++++++++++++++++ profiles/xorg.py | 2 ++ 6 files changed, 36 insertions(+) create mode 100644 profiles/minimal.py diff --git a/profiles/awesome.py b/profiles/awesome.py index a565ccb3..c54aa827 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -2,6 +2,11 @@ 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__ = ['nano', 'nemo', 'gpicview-gtk3', 'openssh', 'sshfs', 'htop', 'scrot', 'wget'] def _prep_function(*args, **kwargs): """ diff --git a/profiles/desktop.py b/profiles/desktop.py index 41a2ad8b..e7536629 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -2,6 +2,8 @@ import archinstall, os +is_top_level_profile = True + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/gnome.py b/profiles/gnome.py index b37679de..c75cafee 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -2,6 +2,8 @@ import archinstall +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/kde.py b/profiles/kde.py index e1449d81..10ef3766 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -2,6 +2,8 @@ import archinstall, os +is_top_level_profile = False + # TODO: Remove hard dependency of bash (due to .bash_profile) def _prep_function(*args, **kwargs): diff --git a/profiles/minimal.py b/profiles/minimal.py new file mode 100644 index 00000000..0e27bdab --- /dev/null +++ b/profiles/minimal.py @@ -0,0 +1,23 @@ +# Used to do a minimal install + +import archinstall, os + +is_top_level_profile = 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. + """ + + # Do nothing here for now + +if __name__ == 'minimal': + """ + This "profile" is a meta-profile. + It is used for a custom minimal installation, without any desktop-specific packages. + """ + + # Do nothing here for now diff --git a/profiles/xorg.py b/profiles/xorg.py index 1282b8a5..e905d533 100644 --- a/profiles/xorg.py +++ b/profiles/xorg.py @@ -2,6 +2,8 @@ import archinstall, os +is_top_level_profile = True + AVAILABLE_DRIVERS = { # Sub-dicts are layer-2 options to be selected # and lists are a list of packages to be installed -- cgit v1.2.3-54-g00ecf From 4059d62e55042583860d78a91d2f83aec71f5cfb Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 09:12:33 -0400 Subject: Add filtration on top level profile --- archinstall/lib/profiles.py | 30 ++++++++++++++++++++++++++++++ examples/guided.py | 4 +++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index b56304c5..1948a819 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -177,6 +177,7 @@ class Profile(Script): if hasattr(imported, '_prep_function'): return True return False + def has_post_install(self): with open(self.path, 'r') as source: source_data = source.read() @@ -193,6 +194,35 @@ class Profile(Script): if hasattr(imported, '_post_install'): return True + def is_top_level_profile(self): + with open(self.path, 'r') as source: + source_data = source.read() + + # TODO: I imagine that there is probably a better way to write this. + return 'top_level_profile = True' in source_data + + @property + def packages(self) -> list: + """ + Returns a list of packages baked into the profile definition. + If no package definition has been done, .packages() will return None. + """ + with open(self.path, 'r') as source: + source_data = source.read() + + # Some crude safety checks, make sure the imported profile has + # a __name__ check before importing. + # + # If the requirements are met, import with .py in the namespace to not + # trigger a traditional: + # if __name__ == 'moduleName' + if '__name__' in source_data and '__packages__' in source_data: + with self.load_instructions(namespace=f"{self.namespace}.py") as imported: + if hasattr(imported, '__packages__'): + return imported.__packages__ + return None + + class Application(Profile): def __repr__(self, *args, **kwargs): return f'Application({os.path.basename(self.profile)})' diff --git a/examples/guided.py b/examples/guided.py index ed838a29..a28aa50e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,5 +1,7 @@ import getpass, time, json, sys, signal, os import archinstall +from archinstall.lib.hardware import hasUEFI +from archinstall.lib.profiles import Profile """ This signal-handler chain (and global variable) @@ -166,7 +168,7 @@ def ask_user_questions(): # Ask for archinstall-specific profiles (such as desktop environments etc) if not archinstall.arguments.get('profile', None): - archinstall.arguments['profile'] = archinstall.select_profile(archinstall.list_profiles()) + archinstall.arguments['profile'] = archinstall.select_profile(filter(lambda profile: (Profile(None, profile).is_top_level_profile()), archinstall.list_profiles())) else: archinstall.arguments['profile'] = archinstall.list_profiles()[archinstall.arguments['profile']] -- cgit v1.2.3-54-g00ecf From 8fc91c4f18647ea2734b87b81cb5835ff6ad0c87 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 11:33:01 -0400 Subject: Fix issue with prep function --- profiles/minimal.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/profiles/minimal.py b/profiles/minimal.py index 0e27bdab..26a3c75c 100644 --- a/profiles/minimal.py +++ b/profiles/minimal.py @@ -11,13 +11,11 @@ def _prep_function(*args, **kwargs): other code in this stage. So it's a safe way to ask the user for more input before any other installer steps start. """ - - # Do nothing here for now + return True # Do nothing here for now if __name__ == 'minimal': """ This "profile" is a meta-profile. It is used for a custom minimal installation, without any desktop-specific packages. """ - # Do nothing here for now -- cgit v1.2.3-54-g00ecf From 608bada172ca0504b8aa7667e876f87d10449deb Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 7 Apr 2021 11:54:10 -0400 Subject: Clean up comments a bit --- profiles/minimal.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/profiles/minimal.py b/profiles/minimal.py index 26a3c75c..79821a89 100644 --- a/profiles/minimal.py +++ b/profiles/minimal.py @@ -7,15 +7,14 @@ is_top_level_profile = 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. + before continuing any further. For minimal install, + we don't need to do anything special here, but it + needs to exist and return True. """ - return True # Do nothing here for now + 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. """ - # Do nothing here for now -- cgit v1.2.3-54-g00ecf From 57200d3d93d08af5ceaed726ac9d83afe923990f Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 8 Apr 2021 07:23:37 +0530 Subject: removed post_install hook --- profiles/kde.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/profiles/kde.py b/profiles/kde.py index 10ef3766..1710ef44 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -22,7 +22,7 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') -def _post_install(*args, **kwargs): +""" def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: print("Plasma Wayland has known compatibility issues with the proprietary Nvidia driver") choice = input("Would you like plasma-wayland to be the default session [Y/n] ").lower() @@ -30,6 +30,8 @@ def _post_install(*args, **kwargs): installation.arch_chroot("mv /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasmax11.desktop") installation.arch_chroot("mv /usr/share/wayland-sessions/plasmawayland.desktop /usr/share/wayland-sessions/plasma.desktop") return True +As Dylan pointed out this could break things in a update lets just stick to defaults for now +""" # 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 -- cgit v1.2.3-54-g00ecf From db068dfe06e967308ee55cf7783bd1edc78d505c Mon Sep 17 00:00:00 2001 From: advaithm Date: Thu, 8 Apr 2021 08:26:57 +0530 Subject: Update kde.py --- profiles/kde.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/profiles/kde.py b/profiles/kde.py index 1710ef44..d6abe029 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -22,16 +22,12 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') -""" def _post_install(*args, **kwargs): +def _post_install(*args, **kwargs): if "nvidia" in _gfx_driver_packages: print("Plasma Wayland has known compatibility issues with the proprietary Nvidia driver") - choice = input("Would you like plasma-wayland to be the default session [Y/n] ").lower() - if choice == "y": - installation.arch_chroot("mv /usr/share/xsessions/plasma.desktop /usr/share/xsessions/plasmax11.desktop") - installation.arch_chroot("mv /usr/share/wayland-sessions/plasmawayland.desktop /usr/share/wayland-sessions/plasma.desktop") + print("After booting, you can choose between Wayland and Xorg using the drop-down menu") return True -As Dylan pointed out this could break things in a update lets just stick to defaults for now -""" + # 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 -- cgit v1.2.3-54-g00ecf From 25309dcfb884927eb3a68ee8abe178b23fdb588c Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 09:55:35 -0400 Subject: Disable post-install hooks for now --- archinstall/lib/profiles.py | 3 ++- profiles/kde.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index 1948a819..abf10f8e 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -177,7 +177,7 @@ class Profile(Script): if hasattr(imported, '_prep_function'): return True return False - +""" def has_post_install(self): with open(self.path, 'r') as source: source_data = source.read() @@ -193,6 +193,7 @@ class Profile(Script): with self.load_instructions(namespace=f"{self.namespace}.py") as imported: if hasattr(imported, '_post_install'): return True +""" def is_top_level_profile(self): with open(self.path, 'r') as source: diff --git a/profiles/kde.py b/profiles/kde.py index d6abe029..6654dfa7 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -22,11 +22,13 @@ def _prep_function(*args, **kwargs): 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") -- cgit v1.2.3-54-g00ecf From c5d099c3fa95cc32e49ffab30a722e071e874362 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 19:03:04 +0200 Subject: Wrong indentation on comment. --- archinstall/lib/profiles.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/profiles.py b/archinstall/lib/profiles.py index abf10f8e..21ec5f6f 100644 --- a/archinstall/lib/profiles.py +++ b/archinstall/lib/profiles.py @@ -177,7 +177,7 @@ class Profile(Script): if hasattr(imported, '_prep_function'): return True return False -""" + """ def has_post_install(self): with open(self.path, 'r') as source: source_data = source.read() @@ -193,7 +193,7 @@ class Profile(Script): with self.load_instructions(namespace=f"{self.namespace}.py") as imported: if hasattr(imported, '_post_install'): return True -""" + """ def is_top_level_profile(self): with open(self.path, 'r') as source: -- cgit v1.2.3-54-g00ecf From d8a243777872b86349adfc7068829f59c2bd305b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 8 Apr 2021 13:08:26 -0400 Subject: Move from awesome to desktop and add wireless config utilities and smartmontools --- profiles/awesome.py | 10 ++-------- profiles/desktop.py | 10 +++++++++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/profiles/awesome.py b/profiles/awesome.py index c54aa827..0b00a424 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -6,7 +6,7 @@ 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__ = ['nano', 'nemo', 'gpicview-gtk3', 'openssh', 'sshfs', 'htop', 'scrot', 'wget'] +__packages__ = ['nemo', 'gpicview-gtk3', 'scrot'] def _prep_function(*args, **kwargs): """ @@ -33,13 +33,7 @@ if __name__ == 'awesome': awesome = archinstall.Application(installation, 'awesome') awesome.install() - # Then setup and configure the desktop environment: awesome - editor = "nano" - filebrowser = "nemo gpicview-gtk3" - utils = "openssh sshfs htop scrot wget" - - - installation.add_additional_packages(f"{utils} {filebrowser} {editor}") + installation.add_additional_packages(__packages__) alacritty = archinstall.Application(installation, 'alacritty') alacritty.install() diff --git a/profiles/desktop.py b/profiles/desktop.py index e7536629..012d66aa 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -4,6 +4,10 @@ import archinstall, os is_top_level_profile = True +# 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', 'openssh', 'htop', 'wget', 'iwd', 'wireless_tools', 'wpa_supplicant', 'smartmontools'] + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer @@ -14,7 +18,7 @@ def _prep_function(*args, **kwargs): supported_desktops = ['gnome', 'kde', 'awesome'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') - + # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded # the next time it gets executed. @@ -41,7 +45,11 @@ if __name__ == 'desktop': 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 + installation.add_additional_packages(__packages__) # TODO: Remove magic variable 'installation' and place it # in archinstall.storage or archinstall.session/archinstall.installation installation.install_profile(archinstall.storage['_desktop_profile']) + -- cgit v1.2.3-54-g00ecf From ae2da06075763d388c303e8cd7914694454aa8fb Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 19:56:29 +0200 Subject: Added a safety check to verify that the encrypted partition exists at least before trying to open it. --- archinstall/lib/luks.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index a1d42196..b076ac9b 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -1,5 +1,7 @@ import os import shlex +import time +import pathlib from .exceptions import * from .general import * from .disk import Partition @@ -123,6 +125,11 @@ class luks2(): from .disk import get_filesystem_type if '/' in mountpoint: os.path.basename(mountpoint) # TODO: Raise exception instead? + + wait_timer = time.time() + while pathlib.Paht(partition.path).exists() is False and time.time() - wait_timer < 10: + time.sleep(0.025) + sys_command(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --key-file {os.path.abspath(key_file)} --type luks2') if os.path.islink(f'/dev/mapper/{mountpoint}'): self.mapdev = f'/dev/mapper/{mountpoint}' -- cgit v1.2.3-54-g00ecf From be208990da6920fb78f5bd1c45dfd93b30912787 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 8 Apr 2021 14:00:57 -0400 Subject: Remove nano from base packages --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 66cac12c..b7fe5e9d 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -34,7 +34,7 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, partition, boot_partition, *, base_packages='base base-devel linux linux-firmware efibootmgr nano', profile=None, mountpoint='/mnt', hostname='ArchInstalled', logdir=None, logfile=None): + def __init__(self, partition, boot_partition, *, base_packages='base base-devel linux linux-firmware efibootmgr', profile=None, mountpoint='/mnt', hostname='ArchInstalled', logdir=None, logfile=None): self.profile = profile self.hostname = hostname self.mountpoint = mountpoint -- cgit v1.2.3-54-g00ecf From b5245b31fec9c19a16a8b00233afb1cfee1499fa Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 21:14:19 +0200 Subject: I simplified the countdown, by moving it into it's own function instead of wrapped inside guided.. This can now be used by others for a simple countdown. I also re-worked the minimal.py example to work with the new internal partitioning logic API as well as support some flags from archinstall.arguments to minimize user input requirements to just one single question. This one question will most likely go away too, but stays for simplicity right now. --- archinstall/lib/user_interaction.py | 44 +++++++++++++++++++-- examples/guided.py | 50 +----------------------- examples/minimal.py | 78 ++++++++++++++++++++++++++----------- 3 files changed, 98 insertions(+), 74 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 3830962c..33abbefb 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -1,4 +1,5 @@ import getpass, pathlib, os, shutil, re +import sys, time, signal from .exceptions import * from .profiles import Profile from .locale_helpers import search_keyboard_layout @@ -19,14 +20,49 @@ def get_longest_option(options): return max([len(x) for x in options]) def check_for_correct_username(username): - if re.match(r'^[a-z_][a-z0-9_-]*\$?$', username) and len(username) <= 32: - return True - log( + if re.match(r'^[a-z_][a-z0-9_-]*\$?$', username) and len(username) <= 32: + return True + log( "The username you entered is invalid. Try again", level=LOG_LEVELS.Warning, fg='red' ) - return False + return False + +def do_countdown(): + SIG_TRIGGER = False + def kill_handler(sig, frame): + print() + exit(0) + + def sig_handler(sig, frame): + global SIG_TRIGGER + SIG_TRIGGER = True + signal.signal(signal.SIGINT, kill_handler) + + original_sigint_handler = signal.getsignal(signal.SIGINT) + signal.signal(signal.SIGINT, sig_handler) + + for i in range(5, 0, -1): + print(f"{i}", end='') + + for x in range(4): + sys.stdout.flush() + time.sleep(0.25) + print(".", end='') + + if SIG_TRIGGER: + abort = input('\nDo you really want to abort (y/n)? ') + if abort.strip() != 'n': + exit(0) + + if SIG_TRIGGER is False: + sys.stdin.read() + SIG_TRIGGER = False + signal.signal(signal.SIGINT, sig_handler) + print() + signal.signal(signal.SIGINT, original_sigint_handler) + return True def get_password(prompt="Enter a password: "): while (passwd := getpass.getpass(prompt)): diff --git a/examples/guided.py b/examples/guided.py index a28aa50e..6feebd00 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -1,30 +1,8 @@ -import getpass, time, json, sys, signal, os +import getpass, time, json, os import archinstall from archinstall.lib.hardware import hasUEFI from archinstall.lib.profiles import Profile -""" -This signal-handler chain (and global variable) -is used to trigger the "Are you sure you want to abort?" question further down. -It might look a bit odd, but have a look at the line: "if SIG_TRIGGER:" -""" -SIG_TRIGGER = False -def kill_handler(sig, frame): - print() - exit(0) - -def sig_handler(sig, frame): - global SIG_TRIGGER - SIG_TRIGGER = True - signal.signal(signal.SIGINT, kill_handler) - -original_sigint_handler = signal.getsignal(signal.SIGINT) -signal.signal(signal.SIGINT, sig_handler) - -if archinstall.arguments.get('help'): - print("See `man archinstall` for help.") - exit(0) - def ask_user_questions(): """ First, we'll ask the user for a bunch of user input. @@ -206,8 +184,6 @@ def ask_user_questions(): def perform_installation_steps(): - global SIG_TRIGGER - print() print('This is your chosen configuration:') archinstall.log("-- Guided template chosen (with below config) --", level=archinstall.LOG_LEVELS.Debug) @@ -222,29 +198,7 @@ def perform_installation_steps(): """ print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') - - for i in range(5, 0, -1): - print(f"{i}", end='') - - for x in range(4): - sys.stdout.flush() - time.sleep(0.25) - print(".", end='') - - if SIG_TRIGGER: - abort = input('\nDo you really want to abort (y/n)? ') - if abort.strip() != 'n': - exit(0) - - if SIG_TRIGGER is False: - sys.stdin.read() - SIG_TRIGGER = False - signal.signal(signal.SIGINT, sig_handler) - - # Put back the default/original signal handler now that we're done catching - # and interrupting SIGINT with "Do you really want to abort". - print() - signal.signal(signal.SIGINT, original_sigint_handler) + archinstall.do_countdown() """ Setup the blockdevice, filesystem (and optionally encryption). diff --git a/examples/minimal.py b/examples/minimal.py index 9124f5bd..b9472ac9 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -1,30 +1,64 @@ import archinstall, getpass -# Unmount and close previous runs -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.select_disk(archinstall.all_disks()) -disk_password = getpass.getpass(prompt='Disk password (won\'t echo): ') +archinstall.log(f"Minimal only supports:") +archinstall.log(f" * Being installed to a single disk") + +if archinstall.arguments.get('help', None): + archinstall.log(f" - Optional disk encryption via --!encryption-password=") + archinstall.log(f" - Optional filesystem type via --filesystem=") + archinstall.log(f" - Optional systemd network via --network") + +archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks()) +archinstall.arguments['harddrive'].keep_partitions = False + +def install_on(root, boot): + # We kick off the installer by telling it where the root and boot lives + with archinstall.Installer(root, boot_partition=boot, hostname='minimal-arch') as installation: + # Strap in the base system, add a boot loader and configure + # some other minor details as specified by this profile and user. + if installation.minimal_installation(): + installation.add_bootloader() + + # Optionally enable networking: + if archinstall.arguments.get('network', None): + installation.copy_ISO_network_config(enable_services=True) + + installation.add_additional_packages(['nano', 'wget', 'git']) + installation.install_profile('minimal') + + installation.user_create('devel', 'devel') + installation.user_set_pw('root', 'airoot') + + # Once this is done, we output some useful information to the user + # And the installation is complete. + archinstall.log(f"There are two new accounts in your installation after reboot:") + archinstall.log(f" * root (password: airoot)") + archinstall.log(f" * devel (password: devel)") + +print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') +archinstall.do_countdown() + +# First, we configure the basic filesystem layout +with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: + # We use the entire disk instead of setting up partitions on your own + if archinstall.arguments['harddrive'].keep_partitions is False: + fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) -with archinstall.Filesystem(harddrive, archinstall.GPT) as fs: - # Use the entire disk instead of setting up partitions on your own - fs.use_entire_disk('luks2') + boot = fs.find_partition('/boot') + root = fs.find_partition('/') - if harddrive.partition[1].size == '512M': - raise OSError('Trying to encrypt the boot partition for petes sake..') - harddrive.partition[0].format('fat32') + boot.format('vfat') - 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() + # We encrypt the root partition if we got a password to do so with, + # Otherwise we just skip straight to formatting and installation + if archinstall.arguments.get('!encryption-password', None): + root.encrypt() - installation.add_additional_packages(['nano', 'wget', 'git']) - installation.install_profile('minimal') + with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: + unlocked_root.format(root.filesystem) - installation.user_create('devel', 'devel') - installation.user_set_pw('root', 'toor') + install_on(unlocked_root) + else: + root.format(root.filesystem) + install_on(root) \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 8c9b16204964977c60944a324b80c58ed56119b7 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 15:14:16 -0400 Subject: Implement Sway Try switching from gdm to sddm as gdm pulls in a lot of GNOME packages Fix comment Update sway.py --- profiles/applications/sway.py | 3 +++ profiles/sway.py | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 profiles/applications/sway.py create mode 100644 profiles/sway.py diff --git a/profiles/applications/sway.py b/profiles/applications/sway.py new file mode 100644 index 00000000..5f66233c --- /dev/null +++ b/profiles/applications/sway.py @@ -0,0 +1,3 @@ +import archinstall + +installation.add_additional_packages("sway sddm") diff --git a/profiles/sway.py b/profiles/sway.py new file mode 100644 index 00000000..fd8407df --- /dev/null +++ b/profiles/sway.py @@ -0,0 +1,24 @@ +# A desktop environment using "Sway" + +import archinstall + +is_top_level_profile = False + +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. + """ + 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': + # Install the application sway from the template under /applications/ + sway = archinstall.Application(installation, 'sway') + sway.install() + + installation.enable_service('sddm') # SDDM, which supports Sway -- cgit v1.2.3-54-g00ecf From e49f9830364f0beded7af88a142fa89e457da822 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 15:15:44 -0400 Subject: Add sway profile to desktop file --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/desktop.py b/profiles/desktop.py index 012d66aa..1e914546 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile -- cgit v1.2.3-54-g00ecf From 0934f4c3e74340c50b3d56bd3b2c1c2ace553e68 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sun, 4 Apr 2021 12:57:24 -0400 Subject: Create cinnamon.py --- profiles/cinnamon.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 profiles/cinnamon.py diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py new file mode 100644 index 00000000..e9c5d085 --- /dev/null +++ b/profiles/cinnamon.py @@ -0,0 +1,33 @@ +# A desktop environment using "Cinnamon" + +import archinstall + +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 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("cinnamon", "/somewhere/cinnamon.py") +# or through conventional import cinnamon +if __name__ == 'cinnamon': + # Install dependency profiles + installation.install_profile('xorg') + + # Install the application cinnamon from the template under /applications/ + cinnamon = archinstall.Application(installation, 'cinnamon') + cinnamon.install() + + installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-54-g00ecf From ab2a43e19faefa11809e603aa5ee9add6f6b96c0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 21:33:49 +0200 Subject: Forgot a variable. --- examples/minimal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/minimal.py b/examples/minimal.py index b9472ac9..367574b5 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -61,4 +61,4 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) install_on(unlocked_root) else: root.format(root.filesystem) - install_on(root) \ No newline at end of file + install_on(root, boot) \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 5ec1e1d4f5bd7844aa3d42c093a2e59e7cebb859 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 16:53:20 -0400 Subject: Fix incorrect comment. Cinnamon doesn't have any Wayland support yet. --- profiles/cinnamon.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index e9c5d085..dac38bd3 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -10,8 +10,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - # Cinnamon optionally supports xorg, we'll install it since it also - # includes graphic driver setups (this might change in the future) + # 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'): -- cgit v1.2.3-54-g00ecf From dfec4b77fd948317108a8306347b1bf74f82042c Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 15:35:33 -0400 Subject: Integrate cinnamon with changes on master. --- profiles/cinnamon.py | 2 ++ profiles/desktop.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index dac38bd3..91a59811 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -2,6 +2,8 @@ import archinstall +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/desktop.py b/profiles/desktop.py index 1e914546..4a31399a 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile -- cgit v1.2.3-54-g00ecf From c2c112625414e23bc15da083c06c97750bfa154d Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sat, 3 Apr 2021 16:17:51 -0400 Subject: xfce4 --- profiles/xfce4.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 profiles/xfce4.py diff --git a/profiles/xfce4.py b/profiles/xfce4.py new file mode 100644 index 00000000..040f29bd --- /dev/null +++ b/profiles/xfce4.py @@ -0,0 +1,34 @@ + +# A desktop environment using "Xfce4" + +import archinstall + +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("xfce4", "/somewhere/xfce4.py") +# or through conventional import gnome +if __name__ == 'xfce4': + # Install dependency profiles + installation.install_profile('xorg') + + # Install the application xfce4 from the template under /applications/ + xfce = archinstall.Application(installation, 'xfce4') + xfce.install() + + installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-54-g00ecf From eb7497f2aada18ba5d992fa890503782aefea726 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sat, 3 Apr 2021 17:58:25 -0400 Subject: Update xfce4.py --- profiles/xfce4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 040f29bd..1cc4a62d 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -22,7 +22,7 @@ def _prep_function(*args, **kwargs): # Ensures that this code only gets executed if executed # through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") -# or through conventional import gnome +# or through conventional import xfce4 if __name__ == 'xfce4': # Install dependency profiles installation.install_profile('xorg') -- cgit v1.2.3-54-g00ecf From 84e6db27bb0454625873db85e0e58e35b5333901 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 16:55:04 -0400 Subject: Fix another incorrect comment on XFCE4 profile --- profiles/xfce4.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 1cc4a62d..36c9958a 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -11,8 +11,7 @@ def _prep_function(*args, **kwargs): 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) + # 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'): -- cgit v1.2.3-54-g00ecf From 72f3423798586430b1849083e3a4ae65013ad613 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 15:41:08 -0400 Subject: Integrate XFCE4 with master --- profiles/desktop.py | 2 +- profiles/xfce4.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/profiles/desktop.py b/profiles/desktop.py index 4a31399a..d552a17f 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile diff --git a/profiles/xfce4.py b/profiles/xfce4.py index 36c9958a..fee8c37a 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -3,6 +3,8 @@ import archinstall +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer -- cgit v1.2.3-54-g00ecf From 0d194e2606809fb88eb25e2a1711fbad8a862d27 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 15:54:54 -0400 Subject: Initial implementation of LXQt --- profiles/applications/lxqt.py | 3 +++ profiles/desktop.py | 2 +- profiles/lxqt.py | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 profiles/applications/lxqt.py create mode 100644 profiles/lxqt.py diff --git a/profiles/applications/lxqt.py b/profiles/applications/lxqt.py new file mode 100644 index 00000000..f2a75e0e --- /dev/null +++ b/profiles/applications/lxqt.py @@ -0,0 +1,3 @@ +import archinstall + +installation.add_additional_packages("lxqt breeze-icons sddm") diff --git a/profiles/desktop.py b/profiles/desktop.py index d552a17f..4c6255e7 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile diff --git a/profiles/lxqt.py b/profiles/lxqt.py new file mode 100644 index 00000000..871488ee --- /dev/null +++ b/profiles/lxqt.py @@ -0,0 +1,35 @@ + +# A desktop environment using "LXQt" + +import archinstall + +is_top_level_profile = False + +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 + installation.install_profile('xorg') + + # Install the application xfce4 from the template under /applications/ + xfce = archinstall.Application(installation, 'lxqt') + xfce.install() + + installation.enable_service('sddm') # SDDM Display Manager -- cgit v1.2.3-54-g00ecf From adb73f5ba6cfb3f13b821d16784f2f8d60ee29c0 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 8 Apr 2021 16:10:33 -0400 Subject: It was far too minimal to be usable before. --- profiles/applications/lxqt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/lxqt.py b/profiles/applications/lxqt.py index f2a75e0e..42cf80de 100644 --- a/profiles/applications/lxqt.py +++ b/profiles/applications/lxqt.py @@ -1,3 +1,3 @@ import archinstall -installation.add_additional_packages("lxqt breeze-icons sddm") +installation.add_additional_packages("lxqt breeze-icons xdg-utils ttf-freefont leafpad xscreensaver archlinux-wallpaper sddm") -- cgit v1.2.3-54-g00ecf From 9545680459528c63e9dececb0804d9b498130ef6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 8 Apr 2021 16:21:46 -0400 Subject: breeze-icons and oxygen-icons are both needed to not have missing icons --- profiles/applications/lxqt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/lxqt.py b/profiles/applications/lxqt.py index 42cf80de..87586931 100644 --- a/profiles/applications/lxqt.py +++ b/profiles/applications/lxqt.py @@ -1,3 +1,3 @@ import archinstall -installation.add_additional_packages("lxqt breeze-icons xdg-utils ttf-freefont leafpad xscreensaver archlinux-wallpaper sddm") +installation.add_additional_packages("lxqt breeze-icons oxygen-icons xdg-utils ttf-freefont leafpad xscreensaver archlinux-wallpaper sddm") -- cgit v1.2.3-54-g00ecf From 51f533539dfe499f37e957b87c0c78caf307b747 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 8 Apr 2021 16:34:17 -0400 Subject: Change xscreensaver to slock --- profiles/applications/lxqt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/lxqt.py b/profiles/applications/lxqt.py index 87586931..5ce875cc 100644 --- a/profiles/applications/lxqt.py +++ b/profiles/applications/lxqt.py @@ -1,3 +1,3 @@ import archinstall -installation.add_additional_packages("lxqt breeze-icons oxygen-icons xdg-utils ttf-freefont leafpad xscreensaver archlinux-wallpaper sddm") +installation.add_additional_packages("lxqt breeze-icons oxygen-icons xdg-utils ttf-freefont leafpad slock archlinux-wallpaper sddm") -- cgit v1.2.3-54-g00ecf From e717a72a10907a02bc485b763f195cddcc68bbe0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 22:47:13 +0200 Subject: Starting implementing #124. The installer will be detatched from block devices and partitions. Instead it will rely on a given destination to pacstrap to. From there, it should be able to do reverse-lookups on the target and base it's information and choises from there. This removes any form of partitioning logic, hardware logic and other things from the initialization of the installer. These things should be explicitly called from the installers functions instead. Such as .set_hostname() instead of passing it as a initiation variable. --- archinstall/lib/installer.py | 6 ++---- examples/minimal.py | 15 +++++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index b7fe5e9d..c6734a1a 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -34,10 +34,8 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, partition, boot_partition, *, base_packages='base base-devel linux linux-firmware efibootmgr', profile=None, mountpoint='/mnt', hostname='ArchInstalled', logdir=None, logfile=None): - self.profile = profile - self.hostname = hostname - self.mountpoint = mountpoint + def __init__(self, target, *, base_packages='base base-devel linux linux-firmware efibootmgr', logdir=None, logfile=None): + self.target = target self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) diff --git a/examples/minimal.py b/examples/minimal.py index 367574b5..afd64a2e 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -12,12 +12,13 @@ if archinstall.arguments.get('help', None): archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks()) archinstall.arguments['harddrive'].keep_partitions = False -def install_on(root, boot): - # We kick off the installer by telling it where the root and boot lives - with archinstall.Installer(root, boot_partition=boot, hostname='minimal-arch') as installation: +def install_on(mountpoint): + # We kick off the installer by telling it where the + with archinstall.Installer(mountpoint) as installation: # Strap in the base system, add a boot loader and configure # some other minor details as specified by this profile and user. if installation.minimal_installation(): + installation.set_hostname('minimal-arch') installation.add_bootloader() # Optionally enable networking: @@ -57,8 +58,10 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: unlocked_root.format(root.filesystem) - - install_on(unlocked_root) + unlocked_root.mount('/mnt') else: root.format(root.filesystem) - install_on(root, boot) \ No newline at end of file + root.mount('/mnt') + + boot.mount('/mnt/boot') + install_on('/mnt') \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 08cf788eaad2ec9ecdfd2c1da1da70bfd4180984 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 22:58:45 +0200 Subject: Reworked the mkinitcpio configuration to be more robust according to the logic behind #91 and in prep for #145. Also in prep for #124 the lookup of partitions have been prepared here. We now need a reverse-lookup function. --- archinstall/lib/installer.py | 67 ++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c6734a1a..11f75f99 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -34,28 +34,21 @@ class Installer(): :type hostname: str, optional """ - def __init__(self, target, *, base_packages='base base-devel linux linux-firmware efibootmgr', logdir=None, logfile=None): + def __init__(self, target, *, base_packages='base base-devel linux linux-firmware efibootmgr'): self.target = target self.init_time = time.strftime('%Y-%m-%d_%H-%M-%S') self.milliseconds = int(str(time.time()).split('.')[1]) - if logdir: - storage['LOG_PATH'] = logdir - if logfile: - storage['LOG_FILE'] = logfile - self.helper_flags = { - 'bootloader' : False, 'base' : False, - 'user' : False # Root counts as a user, if additional users are skipped. + 'bootloader' : False } self.base_packages = base_packages.split(' ') if type(base_packages) is str else base_packages self.post_base_install = [] - storage['session'] = self - self.partition = partition - self.boot_partition = boot_partition + storage['session'] = self + self.partitions = get_partitions_in_use(self.target) def log(self, *args, level=LOG_LEVELS.Debug, **kwargs): """ @@ -65,9 +58,6 @@ class Installer(): log(*args, level=level, **kwargs) def __enter__(self, *args, **kwargs): - self.partition.mount(self.mountpoint) - os.makedirs(f'{self.mountpoint}/boot', exist_ok=True) - self.boot_partition.mount(f'{self.mountpoint}/boot') return self def __exit__(self, *args, **kwargs): @@ -272,18 +262,25 @@ class Installer(): ## (encrypted partitions default to btrfs for now, so we need btrfs-progs) ## TODO: Perhaps this should be living in the function which dictates ## the partitioning. Leaving here for now. - if self.partition.filesystem == 'btrfs': - #if self.partition.encrypted: - self.base_packages.append('btrfs-progs') - if self.partition.filesystem == 'xfs': - self.base_packages.append('xfsprogs') - if self.partition.filesystem == 'f2fs': - self.base_packages.append('f2fs-tools') + MODULES = [] + BINARIES = [] + FILES = [] + HOOKS = ["base", "udev", "autodetect", "keyboard", "keymap", "modconf", "block", "filesystems", "fsck"] + + for partition in self.partitions: + if partition.filesystem == 'btrfs': + #if partition.encrypted: + self.base_packages.append('btrfs-progs') + if partition.filesystem == 'xfs': + self.base_packages.append('xfsprogs') + if partition.filesystem == 'f2fs': + self.base_packages.append('f2fs-tools') + self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True #self.genfstab() - with open(f"{self.mountpoint}/etc/fstab", "a") as fstab: + with open(f"{self.target}/etc/fstab", "a") as fstab: fstab.write( "\ntmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0\n" ) # Redundant \n at the start? who knows? @@ -296,25 +293,21 @@ class Installer(): self.set_locale('en_US') # TODO: Use python functions for this - sys_command(f'/usr/bin/arch-chroot {self.mountpoint} chmod 700 /root') + sys_command(f'/usr/bin/arch-chroot {self.target} chmod 700 /root') # Configure mkinitcpio to handle some specific use cases. - # TODO: Yes, we should not overwrite the entire thing, but for now this should be fine - # since we just installed the base system. if self.partition.filesystem == 'btrfs': - with open(f'{self.mountpoint}/etc/mkinitcpio.conf', 'w') as mkinit: - mkinit.write('MODULES=(btrfs)\n') - mkinit.write('BINARIES=(/usr/bin/btrfs)\n') - mkinit.write('FILES=()\n') - mkinit.write('HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)\n') - sys_command(f'/usr/bin/arch-chroot {self.mountpoint} mkinitcpio -p linux') + MODULES.append('btrfs') + BINARIES.append('/usr/bin/btrfs') elif self.partition.encrypted: - with open(f'{self.mountpoint}/etc/mkinitcpio.conf', 'w') as mkinit: - mkinit.write('MODULES=()\n') - mkinit.write('BINARIES=()\n') - mkinit.write('FILES=()\n') - mkinit.write('HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)\n') - sys_command(f'/usr/bin/arch-chroot {self.mountpoint} mkinitcpio -p linux') + HOOKS.patch('encrypt', before='filesystems') + + with open(f'{self.target}/etc/mkinitcpio.conf', 'w') as mkinit: + mkinit.write(f"MODULES=({' '.join(MODULES)})\n") + mkinit.write(f"BINARIES=({' '.join(BINARIES)})\n") + mkinit.write(f"FILES=({' '.join(FILES)})\n") + mkinit.write(f"HOOKS=({' '.join(HOOKS)})\n") + sys_command(f'/usr/bin/arch-chroot {self.target} mkinitcpio -p linux') self.helper_flags['base'] = True -- cgit v1.2.3-54-g00ecf From 8ec18d94bbd55a99f5aea9c1c37cbdd9ea9c9697 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 8 Apr 2021 18:28:13 -0400 Subject: Add vim to desktop packages as not everyone likes nano --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/desktop.py b/profiles/desktop.py index 4c6255e7..3ba9a885 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -6,7 +6,7 @@ is_top_level_profile = True # 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', 'openssh', 'htop', 'wget', 'iwd', 'wireless_tools', 'wpa_supplicant', 'smartmontools'] +__packages__ = ['nano', 'vim', 'openssh', 'htop', 'wget', 'iwd', 'wireless_tools', 'wpa_supplicant', 'smartmontools'] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-54-g00ecf From 32c902a4d8a46f6d0202d9ae46dee9620bbcaa30 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 8 Apr 2021 20:52:47 -0400 Subject: draft: Make i3 package to select i3 configuration --- profiles/i3.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 profiles/i3.py diff --git a/profiles/i3.py b/profiles/i3.py new file mode 100644 index 00000000..3867dfb5 --- /dev/null +++ b/profiles/i3.py @@ -0,0 +1,55 @@ +# Common package for i3, lets user select which i3 configuration they want. + +import archinstall, os + +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__ = [] + +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. + """ + + supported_configurations = ['i3-wm', 'i3-gaps'] + desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ') + + # Temporarily store the selected desktop profile + # in a session-safe location, since this module will get reloaded + # the next time it gets executed. + archinstall.storage['_desktop_profile'] = desktop + + profile = archinstall.Profile(None, desktop) + # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered. + with profile.load_instructions(namespace=f"{desktop}.py") as imported: + if hasattr(imported, '_prep_function'): + return imported._prep_function() + else: + print(f"Deprecated (??): {desktop} 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 common packages for all i3 configurations + installation.add_additional_packages(__packages__) + + # TODO: Remove magic variable 'installation' and place it + # in archinstall.storage or archinstall.session/archinstall.installation + installation.install_profile(archinstall.storage['_desktop_profile']) + -- cgit v1.2.3-54-g00ecf From 6f4b35c4e8e0c00b51fb05fd53768620b4097c47 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 8 Apr 2021 20:54:34 -0400 Subject: Add i3 profile to desktop.py --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/desktop.py b/profiles/desktop.py index 4c6255e7..1bf21482 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile -- cgit v1.2.3-54-g00ecf From 6b5b3180f31b4591c7359859cf692d538b47db20 Mon Sep 17 00:00:00 2001 From: advaithm Date: Mon, 5 Apr 2021 20:46:09 +0530 Subject: add i3-wm and i3-gaps support --- profiles/applications/i3-gaps.py | 2 ++ profiles/applications/i3-wm.py | 2 ++ profiles/i3-gaps.py | 28 ++++++++++++++++++++++++++++ profiles/i3-wm.py | 28 ++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 profiles/applications/i3-gaps.py create mode 100644 profiles/applications/i3-wm.py create mode 100644 profiles/i3-gaps.py create mode 100644 profiles/i3-wm.py diff --git a/profiles/applications/i3-gaps.py b/profiles/applications/i3-gaps.py new file mode 100644 index 00000000..4dd95989 --- /dev/null +++ b/profiles/applications/i3-gaps.py @@ -0,0 +1,2 @@ +import archinstall +installation.add_additional_packages("i3lock i3status i3blocks i3-gaps") \ No newline at end of file diff --git a/profiles/applications/i3-wm.py b/profiles/applications/i3-wm.py new file mode 100644 index 00000000..8662497d --- /dev/null +++ b/profiles/applications/i3-wm.py @@ -0,0 +1,2 @@ +import archinstall +installation.add_additional_packages("i3lock i3status i3blocks i3-wm") \ No newline at end of file diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py new file mode 100644 index 00000000..bf8227ba --- /dev/null +++ b/profiles/i3-gaps.py @@ -0,0 +1,28 @@ +import archinstall + +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') + +if __name__ == 'i3-wm': + # Install dependency profiles + installation.install_profile('xorg') + # gaps is installed by deafult so we are overriding it here + installation.add_additional_packages("lightdm-gtk-greeter lightdm") + # install the i3 group now + i3 = archinstall.Application(installation, 'i3-gaps') + i3.install() + # Auto start lightdm for all users + installation.enable_service('lightdm') diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py new file mode 100644 index 00000000..168abb72 --- /dev/null +++ b/profiles/i3-wm.py @@ -0,0 +1,28 @@ +import archinstall + +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') + +if __name__ == 'i3-wm': + # Install dependency profiles + installation.install_profile('xorg') + # we are installing lightdm to auto start i3 + installation.add_additional_packages("lightdm-gtk-greeter lightdm") + # install the i3 group now + i3 = archinstall.Application(installation, 'i3-wm') + i3.install() + # Auto start lightdm for all users + installation.enable_service('lightdm') \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 230c5709cc56f4896c7220d768d1da0302bf2cc0 Mon Sep 17 00:00:00 2001 From: advaithm Date: Tue, 6 Apr 2021 07:21:11 +0530 Subject: added _post_install hook. --- profiles/i3-gaps.py | 10 +++++++++- profiles/i3-wm.py | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index bf8227ba..d9469dcd 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -1,4 +1,4 @@ -import archinstall +import archinstall, subprocess def _prep_function(*args, **kwargs): """ @@ -16,6 +16,14 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') +def _post_install(*args, **kwargs): + """ + Another magic function called after the system + has been installed. + """ + print("the installation of i3 does not conatain any configuerations for the wm. in this shell you take your time should add your configuerations") + subprocess.check_call("arch-chroot /mnt",shell=True) + if __name__ == 'i3-wm': # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index 168abb72..8b541bbf 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -1,4 +1,4 @@ -import archinstall +import archinstall, subprocess def _prep_function(*args, **kwargs): """ @@ -15,6 +15,13 @@ def _prep_function(*args, **kwargs): return imported._prep_function() else: print('Deprecated (??): xorg profile has no _prep_function() anymore') +def _post_install(*args, **kwargs): + """ + Another magic function called after the system + has been installed. + """ + print("the installation of i3-gaps does not conatain any configuerations for the wm. in this shell you should take your time to add your configuerations") + subprocess.check_call("arch-chroot /mnt",shell=True) if __name__ == 'i3-wm': # Install dependency profiles -- cgit v1.2.3-54-g00ecf From 8c5af80c93270c463944fd891002d781f2949702 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 09:53:28 +0200 Subject: Some language correction and function handling I more or less copied the language from i3-wm as it was more correct. Also converted `print()` into `installation.log()` so that we can get some color control and end up in the debug log. Finally, I added a try/except to handle potential crashes and return return values, since otherwise this would happen every run: * https://github.com/archlinux/archinstall/pull/190/files#diff-98d75a109b5337cd7d7c948d2cfc2379bcc51be22dfa3ca6491765f0e0bcaaabR349-R355 --- profiles/i3-gaps.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index d9469dcd..96d972e3 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -21,8 +21,13 @@ def _post_install(*args, **kwargs): Another magic function called after the system has been installed. """ - print("the installation of i3 does not conatain any configuerations for the wm. in this shell you take your time should add your configuerations") - subprocess.check_call("arch-chroot /mnt",shell=True) + installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow") + try: + subprocess.check_call("arch-chroot /mnt",shell=True) + except subprocess.CallProcessError: + return False + + return True if __name__ == 'i3-wm': # Install dependency profiles -- cgit v1.2.3-54-g00ecf From e3ea46ce5c0fc58f142b749aec86ab97a66c0da3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 13:27:00 -0400 Subject: Noticed that some KDE instances weren't changed to i3 when copying Another one --- profiles/i3-gaps.py | 2 +- profiles/i3-wm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index 96d972e3..50511dce 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -8,7 +8,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - # KDE requires a functioning Xorg installation. + # 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'): diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index 8b541bbf..e700997f 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -8,7 +8,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - # KDE requires a functioning Xorg installation. + # 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'): -- cgit v1.2.3-54-g00ecf From 8f7d8df89f14a48132f4d5e7a3dfb556492879ff Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 6 Apr 2021 09:54:24 +0200 Subject: Swapped print for log and added return values --- profiles/i3-wm.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index e700997f..cd6cbc81 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -20,8 +20,13 @@ def _post_install(*args, **kwargs): Another magic function called after the system has been installed. """ - print("the installation of i3-gaps does not conatain any configuerations for the wm. in this shell you should take your time to add your configuerations") - subprocess.check_call("arch-chroot /mnt",shell=True) + installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow") + try: + subprocess.check_call("arch-chroot /mnt",shell=True) + except subprocess.CallProcessError: + return False + + return True if __name__ == 'i3-wm': # Install dependency profiles @@ -32,4 +37,4 @@ if __name__ == 'i3-wm': i3 = archinstall.Application(installation, 'i3-wm') i3.install() # Auto start lightdm for all users - installation.enable_service('lightdm') \ No newline at end of file + installation.enable_service('lightdm') -- cgit v1.2.3-54-g00ecf From 37db6b8973ef6fbb06ae72505ba836d16bd87d3d Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 20:58:52 -0400 Subject: Add is_top_level_profile = False to i3 profiles --- profiles/i3-gaps.py | 2 ++ profiles/i3-wm.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index 50511dce..e900117a 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -1,5 +1,7 @@ import archinstall, subprocess +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index cd6cbc81..a2449e39 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -1,5 +1,7 @@ import archinstall, subprocess +is_top_level_profile = False + def _prep_function(*args, **kwargs): """ Magic function called by the importing installer -- cgit v1.2.3-54-g00ecf From a5eb815b3e9447062aff613ff0100e2c62db851d Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 21:00:55 -0400 Subject: Move common packages to common i3 profile --- profiles/applications/i3-gaps.py | 2 +- profiles/applications/i3-wm.py | 2 +- profiles/i3.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/profiles/applications/i3-gaps.py b/profiles/applications/i3-gaps.py index 4dd95989..4daed7ad 100644 --- a/profiles/applications/i3-gaps.py +++ b/profiles/applications/i3-gaps.py @@ -1,2 +1,2 @@ import archinstall -installation.add_additional_packages("i3lock i3status i3blocks i3-gaps") \ No newline at end of file +installation.add_additional_packages("i3-gaps") \ No newline at end of file diff --git a/profiles/applications/i3-wm.py b/profiles/applications/i3-wm.py index 8662497d..e7838a64 100644 --- a/profiles/applications/i3-wm.py +++ b/profiles/applications/i3-wm.py @@ -1,2 +1,2 @@ import archinstall -installation.add_additional_packages("i3lock i3status i3blocks i3-wm") \ No newline at end of file +installation.add_additional_packages("i3-wm") \ No newline at end of file diff --git a/profiles/i3.py b/profiles/i3.py index 3867dfb5..b9d7495e 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -6,7 +6,7 @@ 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__ = [] +__packages__ = ['i3lock', 'i3status', 'i3blocks'] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-54-g00ecf From 6a6439daa929e534fec580a39cbd69087f5f43f2 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 21:08:17 -0400 Subject: Move more logic into common profile --- profiles/i3-gaps.py | 8 +------- profiles/i3-wm.py | 7 +------ profiles/i3.py | 9 +++++++++ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index e900117a..d6308ad5 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -31,13 +31,7 @@ def _post_install(*args, **kwargs): return True -if __name__ == 'i3-wm': - # Install dependency profiles - installation.install_profile('xorg') - # gaps is installed by deafult so we are overriding it here - installation.add_additional_packages("lightdm-gtk-greeter lightdm") +if __name__ == 'i3-gaps': # install the i3 group now i3 = archinstall.Application(installation, 'i3-gaps') i3.install() - # Auto start lightdm for all users - installation.enable_service('lightdm') diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index a2449e39..c4c05ec9 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -17,6 +17,7 @@ def _prep_function(*args, **kwargs): return imported._prep_function() else: print('Deprecated (??): xorg profile has no _prep_function() anymore') + def _post_install(*args, **kwargs): """ Another magic function called after the system @@ -31,12 +32,6 @@ def _post_install(*args, **kwargs): return True if __name__ == 'i3-wm': - # Install dependency profiles - installation.install_profile('xorg') - # we are installing lightdm to auto start i3 - installation.add_additional_packages("lightdm-gtk-greeter lightdm") # install the i3 group now i3 = archinstall.Application(installation, 'i3-wm') i3.install() - # Auto start lightdm for all users - installation.enable_service('lightdm') diff --git a/profiles/i3.py b/profiles/i3.py index b9d7495e..c08f4d89 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -49,6 +49,15 @@ if __name__ == 'i3': # Install common packages for all i3 configurations installation.add_additional_packages(__packages__) + # Install dependency profiles + installation.install_profile('xorg') + + # gaps is installed by deafult so we are overriding it here + installation.add_additional_packages("lightdm-gtk-greeter lightdm") + + # Auto start lightdm for all users + installation.enable_service('lightdm') + # TODO: Remove magic variable 'installation' and place it # in archinstall.storage or archinstall.session/archinstall.installation installation.install_profile(archinstall.storage['_desktop_profile']) -- cgit v1.2.3-54-g00ecf From 7e161d187ced4275365cb958d8f066b697bcc141 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 21:20:00 -0400 Subject: Remove post-install hooks from i3 profiles --- profiles/i3-gaps.py | 13 ------------- profiles/i3-wm.py | 13 ------------- 2 files changed, 26 deletions(-) diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index d6308ad5..395e69f6 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -18,19 +18,6 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') -def _post_install(*args, **kwargs): - """ - Another magic function called after the system - has been installed. - """ - installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow") - try: - subprocess.check_call("arch-chroot /mnt",shell=True) - except subprocess.CallProcessError: - return False - - return True - if __name__ == 'i3-gaps': # install the i3 group now i3 = archinstall.Application(installation, 'i3-gaps') diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index c4c05ec9..4c3135e5 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -18,19 +18,6 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') -def _post_install(*args, **kwargs): - """ - Another magic function called after the system - has been installed. - """ - installation.log("the installation of i3 does not conatain any configuerations for the wm. In this shell you should take your time to add your desiired configueration. Exit the shell once you are done to continue the installation.", fg="yellow") - try: - subprocess.check_call("arch-chroot /mnt",shell=True) - except subprocess.CallProcessError: - return False - - return True - if __name__ == 'i3-wm': # install the i3 group now i3 = archinstall.Application(installation, 'i3-wm') -- cgit v1.2.3-54-g00ecf From 82c5241946ec96223aebe6453c58845182290fbb Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Thu, 8 Apr 2021 21:23:29 -0400 Subject: This might work to make the i3 profiles as small as possible --- profiles/i3-gaps.py | 9 +-------- profiles/i3-wm.py | 9 +-------- profiles/i3.py | 10 +++++++++- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py index 395e69f6..ddca34b7 100644 --- a/profiles/i3-gaps.py +++ b/profiles/i3-gaps.py @@ -9,14 +9,7 @@ def _prep_function(*args, **kwargs): 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') + return True if __name__ == 'i3-gaps': # install the i3 group now diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py index 4c3135e5..4a0415fc 100644 --- a/profiles/i3-wm.py +++ b/profiles/i3-wm.py @@ -9,14 +9,7 @@ def _prep_function(*args, **kwargs): 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') + return True if __name__ == 'i3-wm': # install the i3 group now diff --git a/profiles/i3.py b/profiles/i3.py index c08f4d89..9f58e7eb 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -18,12 +18,20 @@ def _prep_function(*args, **kwargs): supported_configurations = ['i3-wm', 'i3-gaps'] desktop = archinstall.generic_select(supported_configurations, 'Select your desired configuration: ') - + # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded # the next time it gets executed. archinstall.storage['_desktop_profile'] = desktop + # 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') + profile = archinstall.Profile(None, desktop) # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered. with profile.load_instructions(namespace=f"{desktop}.py") as imported: -- cgit v1.2.3-54-g00ecf From 437315669f5fe38f90abb8d6f4da9ea60b9f6c12 Mon Sep 17 00:00:00 2001 From: Alexander Seiler Date: Fri, 9 Apr 2021 05:00:43 +0200 Subject: Fix typo that causes crash when creating encrypted LUKS partition (closes #248) --- archinstall/lib/luks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index b076ac9b..561d4d6e 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -127,7 +127,7 @@ class luks2(): os.path.basename(mountpoint) # TODO: Raise exception instead? wait_timer = time.time() - while pathlib.Paht(partition.path).exists() is False and time.time() - wait_timer < 10: + while pathlib.Path(partition.path).exists() is False and time.time() - wait_timer < 10: time.sleep(0.025) sys_command(f'/usr/bin/cryptsetup open {partition.path} {mountpoint} --key-file {os.path.abspath(key_file)} --type luks2') -- cgit v1.2.3-54-g00ecf From acc2dac6527b5f7553a7066f80cc0680d328d31e Mon Sep 17 00:00:00 2001 From: Insanemal Date: Fri, 9 Apr 2021 13:44:51 +1000 Subject: Off by one in generic_selection out of bounds check Out of bounds check in generic_selection is using >= on list. Lists are zero based. If you put in a value that equals the number of items in the list you get an out of bounds error. Removed the equals part of the test as last item in list/dictionary items is len(list)-1 not len(list) --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 3830962c..f8585595 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -184,7 +184,7 @@ def generic_select(options, input_text="Select one of the above by index or abso return None elif selected_option.isdigit(): selected_option = int(selected_option) - if selected_option >= len(options): + if selected_option > len(options): raise RequirementError(f'Selected option "{selected_option}" is out of range') selected_option = options[selected_option] elif selected_option in options: -- cgit v1.2.3-54-g00ecf From 05e848ce626c768bc6bfbcdbfa65083abb035b87 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 11:45:06 +0200 Subject: Made sure the mount target path exists before mounting. --- archinstall/lib/disk.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index dbb69662..7e02c539 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -366,14 +366,16 @@ class Partition(): if not fs: if not self.filesystem: raise DiskError(f'Need to format (or define) the filesystem on {self} before mounting.') fs = self.filesystem - ## libc has some issues with loop devices, defaulting back to sys calls - # ret = libc.mount(self.path.encode(), target.encode(), fs.encode(), 0, options.encode()) - # if ret < 0: - # errno = ctypes.get_errno() - # raise OSError(errno, f"Error mounting {self.path} ({fs}) on {target} with options '{options}': {os.strerror(errno)}") - if sys_command(f'/usr/bin/mount {self.path} {target}').exit_code == 0: - self.mountpoint = target - return True + + pathlib.Path(self.path).mkdir(parents=True, exist_ok=True) + + try: + sys_command(f'/usr/bin/mount {self.path} {target}') + except SysCallError as err: + raise err + + self.mountpoint = target + return True def unmount(self): try: -- cgit v1.2.3-54-g00ecf From 1395f0888c52f01a231aec6c437d570895a03210 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 11:45:45 +0200 Subject: Wrong variable. --- archinstall/lib/disk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 7e02c539..f0fe7181 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -367,7 +367,7 @@ class Partition(): if not self.filesystem: raise DiskError(f'Need to format (or define) the filesystem on {self} before mounting.') fs = self.filesystem - pathlib.Path(self.path).mkdir(parents=True, exist_ok=True) + pathlib.Path(target).mkdir(parents=True, exist_ok=True) try: sys_command(f'/usr/bin/mount {self.path} {target}') -- cgit v1.2.3-54-g00ecf From eb0ae8b1c35e421f88b7eabcc445d1069969ba76 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 11:53:54 +0200 Subject: Added disk helper function get_partitions_in_use(). Which returns which partions are being used at a given mount location, including children. --- archinstall/lib/disk.py | 18 ++++++++++++++++++ archinstall/lib/installer.py | 1 + 2 files changed, 19 insertions(+) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index f0fe7181..af40e36f 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -574,6 +574,24 @@ def get_mount_info(path): return output['filesystems'][0] +def get_partitions_in_use(mountpoint): + try: + output = b''.join(sys_command(f'/usr/bin/findmnt --json -R {path}')) + except SysCallError: + return {} + + mounts = [] + + output = output.decode('UTF-8') + output = json.loads(output) + for target in output.get('filesystems', []): + mounts.append(Partition(target['source'], filesystem=target.get('fstype', None), mountpoint=target['target'])) + + for child in target.get('children', []): + mounts.append(Partition(child['source'], filesystem=child.get('fstype', None), mountpoint=child['target'])) + + return mounts + def get_filesystem_type(path): try: handle = sys_command(f"blkid -o value -s TYPE {path}") diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 11f75f99..d17ee77c 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -49,6 +49,7 @@ class Installer(): storage['session'] = self self.partitions = get_partitions_in_use(self.target) + print(self.partitions) def log(self, *args, level=LOG_LEVELS.Debug, **kwargs): """ -- cgit v1.2.3-54-g00ecf From eb7ed1126bcfece5ec2fba40b24227e02082bea0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 11:54:48 +0200 Subject: Wrong variable name --- archinstall/lib/disk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index af40e36f..f8bdc040 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -576,7 +576,7 @@ def get_mount_info(path): def get_partitions_in_use(mountpoint): try: - output = b''.join(sys_command(f'/usr/bin/findmnt --json -R {path}')) + output = b''.join(sys_command(f'/usr/bin/findmnt --json -R {mountpoint}')) except SysCallError: return {} -- cgit v1.2.3-54-g00ecf From db7b3c8cca10068f3c2186b3c1d6eb316741f3a0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 11:56:35 +0200 Subject: Attempting default value None for block device to partition. --- archinstall/lib/disk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index f8bdc040..f6dc16eb 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -585,10 +585,10 @@ def get_partitions_in_use(mountpoint): output = output.decode('UTF-8') output = json.loads(output) for target in output.get('filesystems', []): - mounts.append(Partition(target['source'], filesystem=target.get('fstype', None), mountpoint=target['target'])) + mounts.append(Partition(target['source'], None, filesystem=target.get('fstype', None), mountpoint=target['target'])) for child in target.get('children', []): - mounts.append(Partition(child['source'], filesystem=child.get('fstype', None), mountpoint=child['target'])) + mounts.append(Partition(child['source'], None, filesystem=child.get('fstype', None), mountpoint=child['target'])) return mounts -- cgit v1.2.3-54-g00ecf From 7f6220528175a15606c329638ffcd961ad771df6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 11:58:12 +0200 Subject: Reworked Installation() to have self.target instead of self.mountpoint, to be more consistent and remove the hits that it has anything to do with partitions/hardware. --- archinstall/lib/installer.py | 66 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index d17ee77c..173f4666 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -122,7 +122,7 @@ class Installer(): self.log(f'Installing packages: {packages}', level=LOG_LEVELS.Info) if (sync_mirrors := sys_command('/usr/bin/pacman -Syy')).exit_code == 0: - if (pacstrap := sys_command(f'/usr/bin/pacstrap {self.mountpoint} {" ".join(packages)}', **kwargs)).exit_code == 0: + if (pacstrap := sys_command(f'/usr/bin/pacstrap {self.target} {" ".join(packages)}', **kwargs)).exit_code == 0: return True else: self.log(f'Could not strap in packages: {pacstrap.exit_code}', level=LOG_LEVELS.Info) @@ -130,42 +130,42 @@ class Installer(): self.log(f'Could not sync mirrors: {sync_mirrors.exit_code}', level=LOG_LEVELS.Info) def set_mirrors(self, mirrors): - return use_mirrors(mirrors, destination=f'{self.mountpoint}/etc/pacman.d/mirrorlist') + return use_mirrors(mirrors, destination=f'{self.target}/etc/pacman.d/mirrorlist') def genfstab(self, flags='-pU'): - self.log(f"Updating {self.mountpoint}/etc/fstab", level=LOG_LEVELS.Info) + self.log(f"Updating {self.target}/etc/fstab", level=LOG_LEVELS.Info) - fstab = sys_command(f'/usr/bin/genfstab {flags} {self.mountpoint}').trace_log - with open(f"{self.mountpoint}/etc/fstab", 'ab') as fstab_fh: + fstab = sys_command(f'/usr/bin/genfstab {flags} {self.target}').trace_log + with open(f"{self.target}/etc/fstab", 'ab') as fstab_fh: fstab_fh.write(fstab) - if not os.path.isfile(f'{self.mountpoint}/etc/fstab'): + if not os.path.isfile(f'{self.target}/etc/fstab'): raise RequirementError(f'Could not generate fstab, strapping in packages most likely failed (disk out of space?)\n{fstab}') return True def set_hostname(self, hostname=None, *args, **kwargs): if not hostname: hostname = self.hostname - with open(f'{self.mountpoint}/etc/hostname', 'w') as fh: + with open(f'{self.target}/etc/hostname', 'w') as fh: fh.write(self.hostname + '\n') def set_locale(self, locale, encoding='UTF-8', *args, **kwargs): if not len(locale): return True - with open(f'{self.mountpoint}/etc/locale.gen', 'a') as fh: + with open(f'{self.target}/etc/locale.gen', 'a') as fh: fh.write(f'{locale}.{encoding} {encoding}\n') - with open(f'{self.mountpoint}/etc/locale.conf', 'w') as fh: + with open(f'{self.target}/etc/locale.conf', 'w') as fh: fh.write(f'LANG={locale}.{encoding}\n') - return True if sys_command(f'/usr/bin/arch-chroot {self.mountpoint} locale-gen').exit_code == 0 else False + return True if sys_command(f'/usr/bin/arch-chroot {self.target} locale-gen').exit_code == 0 else False def set_timezone(self, zone, *args, **kwargs): if not zone: return True if not len(zone): return True # Redundant if (pathlib.Path("/usr")/"share"/"zoneinfo"/zone).exists(): - (pathlib.Path(self.mountpoint)/"etc"/"localtime").unlink(missing_ok=True) - sys_command(f'/usr/bin/arch-chroot {self.mountpoint} ln -s /usr/share/zoneinfo/{zone} /etc/localtime') + (pathlib.Path(self.target)/"etc"/"localtime").unlink(missing_ok=True) + sys_command(f'/usr/bin/arch-chroot {self.target} ln -s /usr/share/zoneinfo/{zone} /etc/localtime') return True else: self.log( @@ -185,7 +185,7 @@ class Installer(): return self.arch_chroot(f'systemctl enable {service}').exit_code == 0 def run_command(self, cmd, *args, **kwargs): - return sys_command(f'/usr/bin/arch-chroot {self.mountpoint} {cmd}') + return sys_command(f'/usr/bin/arch-chroot {self.target} {cmd}') def arch_chroot(self, cmd, *args, **kwargs): return self.run_command(cmd) @@ -205,15 +205,15 @@ class Installer(): conf = Networkd(Match={"Name": nic}, Network=network) - with open(f"{self.mountpoint}/etc/systemd/network/10-{nic}.network", "a") as netconf: + with open(f"{self.target}/etc/systemd/network/10-{nic}.network", "a") as netconf: netconf.write(str(conf)) def copy_ISO_network_config(self, enable_services=False): # Copy (if any) iwd password and config files if os.path.isdir('/var/lib/iwd/'): if (psk_files := glob.glob('/var/lib/iwd/*.psk')): - if not os.path.isdir(f"{self.mountpoint}/var/lib/iwd"): - os.makedirs(f"{self.mountpoint}/var/lib/iwd") + if not os.path.isdir(f"{self.target}/var/lib/iwd"): + os.makedirs(f"{self.target}/var/lib/iwd") if enable_services: # If we haven't installed the base yet (function called pre-maturely) @@ -233,15 +233,15 @@ class Installer(): self.enable_service('iwd') for psk in psk_files: - shutil.copy2(psk, f"{self.mountpoint}/var/lib/iwd/{os.path.basename(psk)}") + shutil.copy2(psk, f"{self.target}/var/lib/iwd/{os.path.basename(psk)}") # Copy (if any) systemd-networkd config files if (netconfigurations := glob.glob('/etc/systemd/network/*')): - if not os.path.isdir(f"{self.mountpoint}/etc/systemd/network/"): - os.makedirs(f"{self.mountpoint}/etc/systemd/network/") + if not os.path.isdir(f"{self.target}/etc/systemd/network/"): + os.makedirs(f"{self.target}/etc/systemd/network/") for netconf_file in netconfigurations: - shutil.copy2(netconf_file, f"{self.mountpoint}/etc/systemd/network/{os.path.basename(netconf_file)}") + shutil.copy2(netconf_file, f"{self.target}/etc/systemd/network/{os.path.basename(netconf_file)}") if enable_services: # If we haven't installed the base yet (function called pre-maturely) @@ -287,8 +287,8 @@ class Installer(): ) # Redundant \n at the start? who knows? ## TODO: Support locale and timezone - #os.remove(f'{self.mountpoint}/etc/localtime') - #sys_command(f'/usr/bin/arch-chroot {self.mountpoint} ln -s /usr/share/zoneinfo/{localtime} /etc/localtime') + #os.remove(f'{self.target}/etc/localtime') + #sys_command(f'/usr/bin/arch-chroot {self.target} ln -s /usr/share/zoneinfo/{localtime} /etc/localtime') #sys_command('/usr/bin/arch-chroot /mnt hwclock --hctosys --localtime') self.set_hostname() self.set_locale('en_US') @@ -328,11 +328,11 @@ class Installer(): # And in which case we should do some clean up. # Install the boot loader - sys_command(f'/usr/bin/arch-chroot {self.mountpoint} bootctl --no-variables --path=/boot install') + sys_command(f'/usr/bin/arch-chroot {self.target} bootctl --no-variables --path=/boot install') # Modify or create a loader.conf - if os.path.isfile(f'{self.mountpoint}/boot/loader/loader.conf'): - with open(f'{self.mountpoint}/boot/loader/loader.conf', 'r') as loader: + if os.path.isfile(f'{self.target}/boot/loader/loader.conf'): + with open(f'{self.target}/boot/loader/loader.conf', 'r') as loader: loader_data = loader.read().split('\n') else: loader_data = [ @@ -340,7 +340,7 @@ class Installer(): f"timeout 5" ] - with open(f'{self.mountpoint}/boot/loader/loader.conf', 'w') as loader: + with open(f'{self.target}/boot/loader/loader.conf', 'w') as loader: for line in loader_data: if line[:8] == 'default ': loader.write(f'default {self.init_time}\n') @@ -352,7 +352,7 @@ class Installer(): #UUID = sys_command('blkid -s PARTUUID -o value {drive}{partition_2}'.format(**args)).decode('UTF-8').strip() # Setup the loader entry - with open(f'{self.mountpoint}/boot/loader/entries/{self.init_time}.conf', 'w') as entry: + with open(f'{self.target}/boot/loader/entries/{self.init_time}.conf', 'w') as entry: entry.write(f'# Created by: archinstall\n') entry.write(f'# Created on: {self.init_time}\n') entry.write(f'title Arch Linux\n') @@ -383,7 +383,7 @@ class Installer(): self.helper_flags['bootloader'] = bootloader return True - raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.mountpoint}/boot/loader/entries/arch.conf will be broken until fixed.") + raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.target}/boot/loader/entries/arch.conf will be broken until fixed.") else: raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") @@ -408,19 +408,19 @@ class Installer(): def enable_sudo(self, entity :str, group=False): self.log(f'Enabling sudo permissions for {entity}.', level=LOG_LEVELS.Info) - with open(f'{self.mountpoint}/etc/sudoers', 'a') as sudoers: + with open(f'{self.target}/etc/sudoers', 'a') as sudoers: sudoers.write(f'{"%" if group else ""}{entity} ALL=(ALL) ALL\n') return True def user_create(self, user :str, password=None, groups=[], sudo=False): self.log(f'Creating user {user}', level=LOG_LEVELS.Info) - o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} useradd -m -G wheel {user}')) + o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} useradd -m -G wheel {user}')) if password: self.user_set_pw(user, password) if groups: for group in groups: - o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.mountpoint} gpasswd -a {user} {group}')) + o = b''.join(sys_command(f'/usr/bin/arch-chroot {self.target} gpasswd -a {user} {group}')) if sudo and self.enable_sudo(user): self.helper_flags['user'] = True @@ -432,12 +432,12 @@ class Installer(): # This means the root account isn't locked/disabled with * in /etc/passwd self.helper_flags['user'] = True - o = b''.join(sys_command(f"/usr/bin/arch-chroot {self.mountpoint} sh -c \"echo '{user}:{password}' | chpasswd\"")) + o = b''.join(sys_command(f"/usr/bin/arch-chroot {self.target} sh -c \"echo '{user}:{password}' | chpasswd\"")) pass def set_keyboard_language(self, language): if len(language.strip()): - with open(f'{self.mountpoint}/etc/vconsole.conf', 'w') as vconsole: + with open(f'{self.target}/etc/vconsole.conf', 'w') as vconsole: vconsole.write(f'KEYMAP={language}\n') vconsole.write(f'FONT=lat9w-16\n') return True -- cgit v1.2.3-54-g00ecf From 276414079bff0249d1d788eb64534bbbe66ad8a4 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 12:00:51 +0200 Subject: Reworked Installation() to have self.target instead of self.mountpoint, to be more consistent and remove the hits that it has anything to do with partitions/hardware. --- archinstall/lib/installer.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 173f4666..593a812d 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -101,18 +101,18 @@ class Installer(): if (filename := storage.get('LOG_FILE', None)): absolute_logfile = os.path.join(storage.get('LOG_PATH', './'), filename) - if not os.path.isdir(f"{self.mountpoint}/{os.path.dirname(absolute_logfile)}"): - os.makedirs(f"{self.mountpoint}/{os.path.dirname(absolute_logfile)}") + if not os.path.isdir(f"{self.target}/{os.path.dirname(absolute_logfile)}"): + os.makedirs(f"{self.target}/{os.path.dirname(absolute_logfile)}") - shutil.copy2(absolute_logfile, f"{self.mountpoint}/{absolute_logfile}") + shutil.copy2(absolute_logfile, f"{self.target}/{absolute_logfile}") return True def mount(self, partition, mountpoint, create_mountpoint=True): - if create_mountpoint and not os.path.isdir(f'{self.mountpoint}{mountpoint}'): - os.makedirs(f'{self.mountpoint}{mountpoint}') + if create_mountpoint and not os.path.isdir(f'{self.target}{mountpoint}'): + os.makedirs(f'{self.target}{mountpoint}') - partition.mount(f'{self.mountpoint}{mountpoint}') + partition.mount(f'{self.target}{mountpoint}') def post_install_check(self, *args, **kwargs): return [step for step, flag in self.helper_flags.items() if flag is False] -- cgit v1.2.3-54-g00ecf From 59e3408de838206bad24fa0d8ca34b47f71e17aa Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 12:28:52 +0200 Subject: Fixed set_hostname() default. --- archinstall/lib/installer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 593a812d..d242f1ee 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -144,8 +144,7 @@ class Installer(): return True - def set_hostname(self, hostname=None, *args, **kwargs): - if not hostname: hostname = self.hostname + def set_hostname(self, hostname :str, *args, **kwargs): with open(f'{self.target}/etc/hostname', 'w') as fh: fh.write(self.hostname + '\n') @@ -290,7 +289,7 @@ class Installer(): #os.remove(f'{self.target}/etc/localtime') #sys_command(f'/usr/bin/arch-chroot {self.target} ln -s /usr/share/zoneinfo/{localtime} /etc/localtime') #sys_command('/usr/bin/arch-chroot /mnt hwclock --hctosys --localtime') - self.set_hostname() + self.set_hostname('archinstall') self.set_locale('en_US') # TODO: Use python functions for this -- cgit v1.2.3-54-g00ecf From 5c8d210f5f2024723b69af6f260f055a98ce9903 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 12:43:14 +0200 Subject: Wrong use of hostname in the set_hostname() function. --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index d242f1ee..5af3c226 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -146,7 +146,7 @@ class Installer(): def set_hostname(self, hostname :str, *args, **kwargs): with open(f'{self.target}/etc/hostname', 'w') as fh: - fh.write(self.hostname + '\n') + fh.write(hostname + '\n') def set_locale(self, locale, encoding='UTF-8', *args, **kwargs): if not len(locale): return True -- cgit v1.2.3-54-g00ecf From d50b26498e46327d71e57d133c323a4f58ba1180 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 06:48:23 -0400 Subject: Add the sway packages from advaithm's 2.2.0 sway work Remove sddm --- profiles/applications/sway.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles/applications/sway.py b/profiles/applications/sway.py index 5f66233c..c99f378a 100644 --- a/profiles/applications/sway.py +++ b/profiles/applications/sway.py @@ -1,3 +1,3 @@ import archinstall - -installation.add_additional_packages("sway sddm") +packages = "sway swaylock swayidle dmenu alacritty" +installation.add_additional_packages(packages) -- cgit v1.2.3-54-g00ecf From 02f4392c2250ba23174f4b53538994ae59803fa3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 06:38:49 -0400 Subject: As pointed out to me, sway doesn't officially support display managers --- profiles/sway.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/profiles/sway.py b/profiles/sway.py index fd8407df..5633cce2 100644 --- a/profiles/sway.py +++ b/profiles/sway.py @@ -20,5 +20,3 @@ if __name__ == 'sway': # Install the application sway from the template under /applications/ sway = archinstall.Application(installation, 'sway') sway.install() - - installation.enable_service('sddm') # SDDM, which supports Sway -- cgit v1.2.3-54-g00ecf From ee89c55466ec5181b938a03282c0cececd813d58 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:01:01 +0200 Subject: Started patching HOOKS and MODULES based on partition iteration. Also fixed some pseudo code. --- archinstall/lib/installer.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 5af3c226..d8021e05 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -276,6 +276,16 @@ class Installer(): if partition.filesystem == 'f2fs': self.base_packages.append('f2fs-tools') + # Configure mkinitcpio to handle some specific use cases. + if partition.filesystem == 'btrfs' + if 'btrfs' not in MODULES: + MODULES.append('btrfs') + if '/usr/bin/btrfs-progs' not in BINARIES: + BINARIES.append('/usr/bin/btrfs') + + elif partition.encrypted and 'encrypt' not in HOOKS: + HOOKS.insert(HOOKS.find('filesystems'), 'encrypt') + self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True #self.genfstab() @@ -295,13 +305,6 @@ class Installer(): # TODO: Use python functions for this sys_command(f'/usr/bin/arch-chroot {self.target} chmod 700 /root') - # Configure mkinitcpio to handle some specific use cases. - if self.partition.filesystem == 'btrfs': - MODULES.append('btrfs') - BINARIES.append('/usr/bin/btrfs') - elif self.partition.encrypted: - HOOKS.patch('encrypt', before='filesystems') - with open(f'{self.target}/etc/mkinitcpio.conf', 'w') as mkinit: mkinit.write(f"MODULES=({' '.join(MODULES)})\n") mkinit.write(f"BINARIES=({' '.join(BINARIES)})\n") -- cgit v1.2.3-54-g00ecf From fdcaeae6f2243ff401409cc869a4c02430aa89c3 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:01:22 +0200 Subject: Syntax error --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index d8021e05..02c63a11 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -277,7 +277,7 @@ class Installer(): self.base_packages.append('f2fs-tools') # Configure mkinitcpio to handle some specific use cases. - if partition.filesystem == 'btrfs' + if partition.filesystem == 'btrfs': if 'btrfs' not in MODULES: MODULES.append('btrfs') if '/usr/bin/btrfs-progs' not in BINARIES: -- cgit v1.2.3-54-g00ecf From 56239d89b58a6ee7bc3d0c299833a8aa6635ae79 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:06:47 +0200 Subject: Fixed some log output logic for the boot partition. --- archinstall/lib/installer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 02c63a11..4c617582 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -322,7 +322,15 @@ class Installer(): return True def add_bootloader(self, bootloader='systemd-bootctl'): - self.log(f'Adding bootloader {bootloader} to {self.boot_partition}', level=LOG_LEVELS.Info) + # This logic is only for debug/log purposes: + # (it could be completely ommitted if we just print /mnt instead) + boot_partition = None + for partition in self.partitions: + if partition.mountpoint == self.target+'/boot' + boot_partition = partition + break + + self.log(f'Adding bootloader {bootloader} to {boot_partition}', level=LOG_LEVELS.Info) if bootloader == 'systemd-bootctl': # TODO: Ideally we would want to check if another config -- cgit v1.2.3-54-g00ecf From 72ad1ad5e0765f12fef5ea27a5c8dcb290c5b682 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:07:08 +0200 Subject: Fixed some log output logic for the boot partition. --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 4c617582..3fd6cfe3 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -326,7 +326,7 @@ class Installer(): # (it could be completely ommitted if we just print /mnt instead) boot_partition = None for partition in self.partitions: - if partition.mountpoint == self.target+'/boot' + if partition.mountpoint == self.target+'/boot': boot_partition = partition break -- cgit v1.2.3-54-g00ecf From 9ebd8b8719d9f2643a4b503b9e9aca02edeee0bd Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:13:14 +0200 Subject: Change of variables to support new partition lookup. --- archinstall/lib/installer.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 3fd6cfe3..48ef7259 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -322,13 +322,13 @@ class Installer(): return True def add_bootloader(self, bootloader='systemd-bootctl'): - # This logic is only for debug/log purposes: - # (it could be completely ommitted if we just print /mnt instead) boot_partition = None + root_partition = None for partition in self.partitions: if partition.mountpoint == self.target+'/boot': boot_partition = partition - break + elif partition.mountpoint == self.target: + root_partition = partition self.log(f'Adding bootloader {bootloader} to {boot_partition}', level=LOG_LEVELS.Info) @@ -372,14 +372,14 @@ class Installer(): ## so we'll use the old manual method until we get that sorted out. - if self.partition.encrypted: - log(f"Identifying root partition by DISK-UUID on {self.partition}, looking for '{os.path.basename(self.partition.real_device)}'.", level=LOG_LEVELS.Debug) + if root_partition.encrypted: + log(f"Identifying root partition by DISK-UUID on {root_partition}, looking for '{os.path.basename(root_partition.real_device)}'.", level=LOG_LEVELS.Debug) for root, folders, uids in os.walk('/dev/disk/by-uuid'): for uid in uids: real_path = os.path.realpath(os.path.join(root, uid)) - log(f"Checking root partition match {os.path.basename(real_path)} against {os.path.basename(self.partition.real_device)}: {os.path.basename(real_path) == os.path.basename(self.partition.real_device)}", level=LOG_LEVELS.Debug) - if not os.path.basename(real_path) == os.path.basename(self.partition.real_device): continue + log(f"Checking root partition match {os.path.basename(real_path)} against {os.path.basename(root_partition.real_device)}: {os.path.basename(real_path) == os.path.basename(root_partition.real_device)}", level=LOG_LEVELS.Debug) + if not os.path.basename(real_path) == os.path.basename(root_partition.real_device): continue entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') @@ -387,13 +387,13 @@ class Installer(): return True break else: - log(f"Identifying root partition by PART-UUID on {self.partition}, looking for '{os.path.basename(self.partition.path)}'.", level=LOG_LEVELS.Debug) - entry.write(f'options root=PARTUUID={self.partition.uuid} rw intel_pstate=no_hwp\n') + log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{os.path.basename(root_partition.path)}'.", level=LOG_LEVELS.Debug) + entry.write(f'options root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp\n') self.helper_flags['bootloader'] = bootloader return True - raise RequirementError(f"Could not identify the UUID of {self.partition}, there for {self.target}/boot/loader/entries/arch.conf will be broken until fixed.") + raise RequirementError(f"Could not identify the UUID of {root_partition}, there for {self.target}/boot/loader/entries/arch.conf will be broken until fixed.") else: raise RequirementError(f"Unknown (or not yet implemented) bootloader added to add_bootloader(): {bootloader}") -- cgit v1.2.3-54-g00ecf From cea8892c7c7a46548d4d946b3e5ed5142757ea13 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:44:03 +0200 Subject: Setting .encrypted flag in minimal. --- examples/minimal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/minimal.py b/examples/minimal.py index afd64a2e..adb033b6 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -54,6 +54,7 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) # We encrypt the root partition if we got a password to do so with, # Otherwise we just skip straight to formatting and installation if archinstall.arguments.get('!encryption-password', None): + root.encrypted = True root.encrypt() with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: -- cgit v1.2.3-54-g00ecf From da12f3630575976d43a6c717235bc273c63da7bd Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 13:59:55 +0200 Subject: Forgot to give a password during encryption. --- examples/minimal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/minimal.py b/examples/minimal.py index adb033b6..d40ce2f8 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -55,7 +55,7 @@ with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) # Otherwise we just skip straight to formatting and installation if archinstall.arguments.get('!encryption-password', None): root.encrypted = True - root.encrypt() + root.encrypt(password=archinstall.arguments.get('!encryption-password', None)) with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: unlocked_root.format(root.filesystem) -- cgit v1.2.3-54-g00ecf From 5499bcc8b9a2f43c096cf9f25a27e0db9b69393e Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sun, 4 Apr 2021 13:38:10 -0400 Subject: applications/cinnamon --- profiles/applications/cinnamon.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 profiles/applications/cinnamon.py diff --git a/profiles/applications/cinnamon.py b/profiles/applications/cinnamon.py new file mode 100644 index 00000000..af1cbee2 --- /dev/null +++ b/profiles/applications/cinnamon.py @@ -0,0 +1,4 @@ +import archinstall + +installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") +# We'll create a cinnamon-minimal later, but for now, we'll avoid issues by giving more than we need. -- cgit v1.2.3-54-g00ecf From 738e60c05960a90aa7ab83165f9993ca6ba556f6 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sat, 3 Apr 2021 16:19:23 -0400 Subject: applications/xfce4 --- profiles/applications/xfce4.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 profiles/applications/xfce4.py diff --git a/profiles/applications/xfce4.py b/profiles/applications/xfce4.py new file mode 100644 index 00000000..74bf5990 --- /dev/null +++ b/profiles/applications/xfce4.py @@ -0,0 +1,3 @@ +import archinstall + +installation.add_additional_packages("xfce4 xfce4-goodies lightdm") # We'll create a xfce4-minimal later, but for now, we'll avoid issues by giving more than we need. -- cgit v1.2.3-54-g00ecf From b86233d7bae14366621b090cfddfb467bd5fa135 Mon Sep 17 00:00:00 2001 From: m1ten <57693631+m1ten@users.noreply.github.com> Date: Sun, 4 Apr 2021 13:49:37 -0400 Subject: add lightdm-gtk-greeter --- profiles/applications/xfce4.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/profiles/applications/xfce4.py b/profiles/applications/xfce4.py index 74bf5990..6d6f8f7c 100644 --- a/profiles/applications/xfce4.py +++ b/profiles/applications/xfce4.py @@ -1,3 +1,4 @@ import archinstall -installation.add_additional_packages("xfce4 xfce4-goodies lightdm") # We'll create a xfce4-minimal later, but for now, we'll avoid issues by giving more than we need. +installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") +# We'll create a xfce4-minimal later, but for now, we'll avoid issues by giving more than we need. -- cgit v1.2.3-54-g00ecf From 326b96d80869bc9c67eec89eb05bea2fac131939 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Fri, 9 Apr 2021 08:29:58 -0400 Subject: Add budgie implementation --- profiles/applications/budgie.py | 4 ++++ profiles/applications/cinnamon.py | 3 +-- profiles/applications/xfce4.py | 3 +-- profiles/budgie.py | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 profiles/applications/budgie.py create mode 100644 profiles/budgie.py diff --git a/profiles/applications/budgie.py b/profiles/applications/budgie.py new file mode 100644 index 00000000..8c5ea223 --- /dev/null +++ b/profiles/applications/budgie.py @@ -0,0 +1,4 @@ +import archinstall + +# "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki +installation.add_additional_packages("budgie-desktop lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings gnome") \ No newline at end of file diff --git a/profiles/applications/cinnamon.py b/profiles/applications/cinnamon.py index af1cbee2..5e2ac02e 100644 --- a/profiles/applications/cinnamon.py +++ b/profiles/applications/cinnamon.py @@ -1,4 +1,3 @@ import archinstall -installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") -# We'll create a cinnamon-minimal later, but for now, we'll avoid issues by giving more than we need. +installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") \ No newline at end of file diff --git a/profiles/applications/xfce4.py b/profiles/applications/xfce4.py index 6d6f8f7c..809d10d0 100644 --- a/profiles/applications/xfce4.py +++ b/profiles/applications/xfce4.py @@ -1,4 +1,3 @@ import archinstall -installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") -# We'll create a xfce4-minimal later, but for now, we'll avoid issues by giving more than we need. +installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") \ No newline at end of file diff --git a/profiles/budgie.py b/profiles/budgie.py new file mode 100644 index 00000000..6c5475ae --- /dev/null +++ b/profiles/budgie.py @@ -0,0 +1,34 @@ +# A desktop environment using "budgie" + +import archinstall + +is_top_level_profile = False + +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 + installation.install_profile('xorg') + + # Install the application budgie from the template under /applications/ + budgie = archinstall.Application(installation, 'budgie') + budgie.install() + + installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-54-g00ecf From 740eccb213c69fb706d10003a1305a93442afb62 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 15:06:34 +0200 Subject: Removed 'getpass' from imports. --- examples/minimal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/minimal.py b/examples/minimal.py index d40ce2f8..90bd9227 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -1,4 +1,4 @@ -import archinstall, getpass +import archinstall # Select a harddrive and a disk password archinstall.log(f"Minimal only supports:") -- cgit v1.2.3-54-g00ecf From f298b9e39387cae7a77a0677b1d1e4478bfdc8d0 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 15:27:22 +0200 Subject: Added a 'use /mnt' option to the formatted #124. This has not yet been tested, but the logic should work according to the new API layout for Installation(). --- archinstall/lib/user_interaction.py | 1 + examples/guided.py | 109 +++++++++++++++++++----------------- 2 files changed, 58 insertions(+), 52 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 1f5924e4..949689c7 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -179,6 +179,7 @@ def ask_to_configure_network(): def ask_for_disk_layout(): options = { 'keep-existing' : 'Keep existing partition layout and select which ones to use where.', + 'use-mnt' : 'Use whatever is mounted under /mnt and don\'t format anything', 'format-all' : 'Format entire drive and setup a basic partition scheme.', 'abort' : 'Abort the installation.' } diff --git a/examples/guided.py b/examples/guided.py index 6feebd00..0d8030c7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -53,6 +53,9 @@ def ask_user_questions(): if (option := archinstall.ask_for_disk_layout()) == 'abort': archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.") exit(1) + elif option == 'use-mnt': + archinstall.arguments['harddrive'] = None + archinstall.arguments['target-mount'] = '/mnt' elif option == 'keep-existing': archinstall.arguments['harddrive'].keep_partitions = True @@ -197,62 +200,63 @@ def perform_installation_steps(): We mention the drive one last time, and count from 5 to 0. """ - print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') - archinstall.do_countdown() - - """ - Setup the blockdevice, filesystem (and optionally encryption). - Once that's done, we'll hand over to perform_installation() - """ - with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: - # Wipe the entire drive if the disk flag `keep_partitions`is False. - if archinstall.arguments['harddrive'].keep_partitions is False: - fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) - - # Check if encryption is desired and mark the root partition as encrypted. - if archinstall.arguments.get('!encryption-password', None): - root_partition = fs.find_partition('/') - root_partition.encrypted = True - - # After the disk is ready, iterate the partitions and check - # which ones are safe to format, and format those. - for partition in archinstall.arguments['harddrive']: - if partition.safe_to_format(): - # Partition might be marked as encrypted due to the filesystem type crypt_LUKS - # But we might have omitted the encryption password question to skip encryption. - # In which case partition.encrypted will be true, but passwd will be false. - if partition.encrypted and (passwd := archinstall.arguments.get('!encryption-password', None)): - partition.encrypt(password=passwd) + if archinstall.arguments.get('harddrive', None): + print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') + archinstall.do_countdown() + + """ + Setup the blockdevice, filesystem (and optionally encryption). + Once that's done, we'll hand over to perform_installation() + """ + with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: + # Wipe the entire drive if the disk flag `keep_partitions`is False. + if archinstall.arguments['harddrive'].keep_partitions is False: + fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) + + # Check if encryption is desired and mark the root partition as encrypted. + if archinstall.arguments.get('!encryption-password', None): + root_partition = fs.find_partition('/') + root_partition.encrypted = True + + # After the disk is ready, iterate the partitions and check + # which ones are safe to format, and format those. + for partition in archinstall.arguments['harddrive']: + if partition.safe_to_format(): + # Partition might be marked as encrypted due to the filesystem type crypt_LUKS + # But we might have omitted the encryption password question to skip encryption. + # In which case partition.encrypted will be true, but passwd will be false. + if partition.encrypted and (passwd := archinstall.arguments.get('!encryption-password', None)): + partition.encrypt(password=passwd) + else: + partition.format() else: - partition.format() + archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug) + + fs.find_partition('/boot').format('vfat') + + if archinstall.arguments.get('!encryption-password', None): + # First encrypt and unlock, then format the desired partition inside the encrypted part. + # archinstall.luks2() encrypts the partition when entering the with context manager, and + # unlocks the drive so that it can be used as a normal block-device within archinstall. + with archinstall.luks2(fs.find_partition('/'), 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device: + unlocked_device.format(fs.find_partition('/').filesystem) + unlocked_device.mount('/mnt') else: - archinstall.log(f"Did not format {partition} because .safe_to_format() returned False or .allow_formatting was False.", level=archinstall.LOG_LEVELS.Debug) - - if archinstall.arguments.get('!encryption-password', None): - # First encrypt and unlock, then format the desired partition inside the encrypted part. - # archinstall.luks2() encrypts the partition when entering the with context manager, and - # unlocks the drive so that it can be used as a normal block-device within archinstall. - with archinstall.luks2(fs.find_partition('/'), 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_device: - unlocked_device.format(fs.find_partition('/').filesystem) - - perform_installation(device=unlocked_device, - boot_partition=fs.find_partition('/boot'), - language=archinstall.arguments['keyboard-language'], - mirrors=archinstall.arguments['mirror-region']) - else: - perform_installation(device=fs.find_partition('/'), - boot_partition=fs.find_partition('/boot'), - language=archinstall.arguments['keyboard-language'], - mirrors=archinstall.arguments['mirror-region']) - - -def perform_installation(device, boot_partition, language, mirrors): + fs.find_partition('/').format(fs.find_partition('/').filesystem) + fs.find_partition('/').mount('/mnt') + + fs.find_partition('/boot').mount('/mnt/boot') + + perform_installation('/mnt') + + +def perform_installation(mountpoint): """ Performs the installation steps on a block device. Only requirement is that the block devices are formatted and setup prior to entering this function. """ - with archinstall.Installer(device, boot_partition=boot_partition, hostname=archinstall.arguments.get('hostname', 'Archinstall')) as installation: + with archinstall.Installer(mountpoint) as installation: ## if len(mirrors): # Certain services might be running that affects the system during installation. # Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist @@ -261,10 +265,11 @@ def perform_installation(device, boot_partition, language, mirrors): while 'dead' not in (status := archinstall.service_state('reflector')): time.sleep(1) - archinstall.use_mirrors(mirrors) # Set the mirrors for the live medium + archinstall.use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium if installation.minimal_installation(): - installation.set_mirrors(mirrors) # Set the mirrors in the installation medium - installation.set_keyboard_language(language) + installation.set_hostname(archinstall.arguments['hostname']) + installation.set_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors in the installation medium + installation.set_keyboard_language(archinstall.arguments['keyboard-language']) installation.add_bootloader() # If user selected to copy the current ISO network configuration -- cgit v1.2.3-54-g00ecf From ce044064485027647e123b71522729469261113d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 15:40:48 +0200 Subject: Added some debugging --- examples/guided.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/guided.py b/examples/guided.py index 0d8030c7..06f91346 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -247,6 +247,7 @@ def perform_installation_steps(): fs.find_partition('/boot').mount('/mnt/boot') + exit(1) perform_installation('/mnt') -- cgit v1.2.3-54-g00ecf From 0dafeacabd37f77f3ffc6e4a4bf769a7fe3ea2bb Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 15:42:35 +0200 Subject: Removed some debugging --- examples/guided.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 06f91346..0d8030c7 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -247,7 +247,6 @@ def perform_installation_steps(): fs.find_partition('/boot').mount('/mnt/boot') - exit(1) perform_installation('/mnt') -- cgit v1.2.3-54-g00ecf From bd134c5db0f9fb93b51e00b3a2df992715d28d81 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 17:33:44 +0200 Subject: Moved the 'use /mnt' logic to during disk selection. --- archinstall/lib/user_interaction.py | 7 ++++--- examples/guided.py | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 949689c7..cb0fb012 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -179,7 +179,6 @@ def ask_to_configure_network(): def ask_for_disk_layout(): options = { 'keep-existing' : 'Keep existing partition layout and select which ones to use where.', - 'use-mnt' : 'Use whatever is mounted under /mnt and don\'t format anything', 'format-all' : 'Format entire drive and setup a basic partition scheme.', 'abort' : 'Abort the installation.' } @@ -246,8 +245,10 @@ def select_disk(dict_o_disks): if len(drives) >= 1: for index, drive in enumerate(drives): print(f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})") - drive = input('Select one of the above disks (by number or full path): ') - if drive.isdigit(): + drive = input('Select one of the above disks (by number or full path) or write /mnt to skip partitioning: ') + if drive.strip() == '/mnt': + return None + elif drive.isdigit(): drive = int(drive) if drive >= len(drives): raise DiskError(f'Selected option "{drive}" is out of range') diff --git a/examples/guided.py b/examples/guided.py index 0d8030c7..2028c0c4 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -30,6 +30,8 @@ def ask_user_questions(): archinstall.arguments['harddrive'] = archinstall.BlockDevice(archinstall.arguments['harddrive']) else: archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks()) + if archinstall.arguments['harddrive'] is None: + archinstall.arguments['target-mount'] = '/mnt' # Perform a quick sanity check on the selected harddrive. # 1. Check if it has partitions @@ -53,9 +55,6 @@ def ask_user_questions(): if (option := archinstall.ask_for_disk_layout()) == 'abort': archinstall.log(f"Safely aborting the installation. No changes to the disk or system has been made.") exit(1) - elif option == 'use-mnt': - archinstall.arguments['harddrive'] = None - archinstall.arguments['target-mount'] = '/mnt' elif option == 'keep-existing': archinstall.arguments['harddrive'].keep_partitions = True -- cgit v1.2.3-54-g00ecf From 9a6c0e7a41c597d7188c3028a1baaac8f4aa64a9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 17:31:28 -0400 Subject: Begin implementing PipeWire option --- profiles/applications/pipewire.py | 5 +++++ profiles/awesome.py | 6 ++++++ profiles/cinnamon.py | 6 ++++++ profiles/gnome.py | 8 +++++++- profiles/kde.py | 6 ++++++ profiles/xfce4.py | 6 ++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 profiles/applications/pipewire.py diff --git a/profiles/applications/pipewire.py b/profiles/applications/pipewire.py new file mode 100644 index 00000000..2d9f6a6c --- /dev/null +++ b/profiles/applications/pipewire.py @@ -0,0 +1,5 @@ +import archinstall + +__packages__ = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] + +installation.add_additional_packages(__packages__) diff --git a/profiles/awesome.py b/profiles/awesome.py index 0b00a424..0bcdfc59 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -29,6 +29,12 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py") # or through conventional import awesome if __name__ == 'awesome': + # Install the pipewire audio server if the user wants to use it + pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + if choice == "y": + pipewire = archinstall.Application(installation, 'pipewire') + pipewire.install() + # Install the application awesome from the template under /applications/ awesome = archinstall.Application(installation, 'awesome') awesome.install() diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index 91a59811..0c4f13d1 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -24,6 +24,12 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") # or through conventional import cinnamon if __name__ == 'cinnamon': + # Install the pipewire audio server if the user wants to use it + pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + if choice == "y": + pipewire = archinstall.Application(installation, 'pipewire') + pipewire.install() + # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/gnome.py b/profiles/gnome.py index c75cafee..018ea821 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -25,13 +25,19 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("gnome", "/somewhere/gnome.py") # or through conventional import gnome if __name__ == 'gnome': + # Install the pipewire audio server if the user wants to use it + pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + if choice == "y": + pipewire = archinstall.Application(installation, 'pipewire') + pipewire.install() + # Install dependency profiles installation.install_profile('xorg') # Install the application gnome from the template under /applications/ gnome = archinstall.Application(installation, 'gnome') gnome.install() - + installation.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/kde.py b/profiles/kde.py index 6654dfa7..a472394a 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -34,6 +34,12 @@ def _post_install(*args, **kwargs): # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde if __name__ == 'kde': + # Install the pipewire audio server if the user wants to use it + pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + if choice == "y": + pipewire = archinstall.Application(installation, 'pipewire') + pipewire.install() + # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/xfce4.py b/profiles/xfce4.py index fee8c37a..ae318317 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -25,6 +25,12 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") # or through conventional import xfce4 if __name__ == 'xfce4': + # Install the pipewire audio server if the user wants to use it + pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + if choice == "y": + pipewire = archinstall.Application(installation, 'pipewire') + pipewire.install() + # Install dependency profiles installation.install_profile('xorg') -- cgit v1.2.3-54-g00ecf From b803c281ea98f71842c7598e428832eaf4a24584 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 6 Apr 2021 18:04:03 -0400 Subject: Move choice into guided installation instead of DEs Arch wiki says packages should enable the user services automatically --- archinstall/lib/user_interaction.py | 8 ++++++++ examples/guided.py | 10 +++++++++- profiles/applications/pipewire.py | 4 ++-- profiles/awesome.py | 6 ------ profiles/cinnamon.py | 6 ------ profiles/gnome.py | 6 ------ profiles/kde.py | 6 ------ profiles/xfce4.py | 6 ------ 8 files changed, 19 insertions(+), 33 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 1f5924e4..8062f6e3 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -139,6 +139,14 @@ def ask_for_a_timezone(): level=LOG_LEVELS.Warning, fg='red' ) + +def ask_for_audio_selection(): + audio = "pulseaudio" # Default for most desktop environments + pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + if pipewire_choice == "y": + audio = "pipewire" + + return audio def ask_to_configure_network(): # Optionally configure one network interface. diff --git a/examples/guided.py b/examples/guided.py index 6feebd00..77b64450 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -160,6 +160,10 @@ def ask_user_questions(): ) exit(1) + # Ask about audio server selection (this right now just asks for pipewire and defaults to pulseaudio otherwise) + if not archinstall.arguments.get('audio', None): + archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() + # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): print("Packages not part of the desktop environment are not installed by default.") @@ -278,7 +282,11 @@ def perform_installation(device, boot_partition, language, mirrors): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - + print('This audio server will be used: ' + archinstall.arguments.get('audio', None)) + if archinstall.arguments.get('audio', None) == 'pipewire': + print('Installing pipewire ...') + installation.install_profile('pipewire') + if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) diff --git a/profiles/applications/pipewire.py b/profiles/applications/pipewire.py index 2d9f6a6c..aea5b50d 100644 --- a/profiles/applications/pipewire.py +++ b/profiles/applications/pipewire.py @@ -1,5 +1,5 @@ import archinstall -__packages__ = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] +packages = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] -installation.add_additional_packages(__packages__) +installation.add_additional_packages(packages) diff --git a/profiles/awesome.py b/profiles/awesome.py index 0bcdfc59..0b00a424 100644 --- a/profiles/awesome.py +++ b/profiles/awesome.py @@ -29,12 +29,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("awesome", "/somewhere/awesome.py") # or through conventional import awesome if __name__ == 'awesome': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install the application awesome from the template under /applications/ awesome = archinstall.Application(installation, 'awesome') awesome.install() diff --git a/profiles/cinnamon.py b/profiles/cinnamon.py index 0c4f13d1..91a59811 100644 --- a/profiles/cinnamon.py +++ b/profiles/cinnamon.py @@ -24,12 +24,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("cinnamon", "/somewhere/cinnamon.py") # or through conventional import cinnamon if __name__ == 'cinnamon': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/gnome.py b/profiles/gnome.py index 018ea821..2e26350a 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -25,12 +25,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("gnome", "/somewhere/gnome.py") # or through conventional import gnome if __name__ == 'gnome': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/kde.py b/profiles/kde.py index a472394a..6654dfa7 100644 --- a/profiles/kde.py +++ b/profiles/kde.py @@ -34,12 +34,6 @@ def _post_install(*args, **kwargs): # through importlib.util.spec_from_file_location("kde", "/somewhere/kde.py") # or through conventional import kde if __name__ == 'kde': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') diff --git a/profiles/xfce4.py b/profiles/xfce4.py index ae318317..fee8c37a 100644 --- a/profiles/xfce4.py +++ b/profiles/xfce4.py @@ -25,12 +25,6 @@ def _prep_function(*args, **kwargs): # through importlib.util.spec_from_file_location("xfce4", "/somewhere/xfce4.py") # or through conventional import xfce4 if __name__ == 'xfce4': - # Install the pipewire audio server if the user wants to use it - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() - if choice == "y": - pipewire = archinstall.Application(installation, 'pipewire') - pipewire.install() - # Install dependency profiles installation.install_profile('xorg') -- cgit v1.2.3-54-g00ecf From 9395d68d5d2d82bf3df66e9450fb51941552bd4e Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Tue, 6 Apr 2021 20:44:44 -0400 Subject: Try removing pipewire.py and calling add additional packages Unfortunately, calling the profile was not working. --- examples/guided.py | 2 +- profiles/applications/pipewire.py | 5 ----- profiles/gnome.py | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 profiles/applications/pipewire.py diff --git a/examples/guided.py b/examples/guided.py index 77b64450..bd4b5a9f 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -285,7 +285,7 @@ def perform_installation(device, boot_partition, language, mirrors): print('This audio server will be used: ' + archinstall.arguments.get('audio', None)) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') - installation.install_profile('pipewire') + installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) diff --git a/profiles/applications/pipewire.py b/profiles/applications/pipewire.py deleted file mode 100644 index aea5b50d..00000000 --- a/profiles/applications/pipewire.py +++ /dev/null @@ -1,5 +0,0 @@ -import archinstall - -packages = ["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"] - -installation.add_additional_packages(packages) diff --git a/profiles/gnome.py b/profiles/gnome.py index 2e26350a..c75cafee 100644 --- a/profiles/gnome.py +++ b/profiles/gnome.py @@ -31,7 +31,7 @@ if __name__ == 'gnome': # Install the application gnome from the template under /applications/ gnome = archinstall.Application(installation, 'gnome') gnome.install() - + installation.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. -- cgit v1.2.3-54-g00ecf From d252e090a646275b8e0d3b19070577f9884aba58 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Tue, 6 Apr 2021 20:47:30 -0400 Subject: Have pulseaudio installed just in case DEs don't depend on it if pipewire is not requested. --- examples/guided.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/guided.py b/examples/guided.py index bd4b5a9f..f7078242 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -286,6 +286,9 @@ def perform_installation(device, boot_partition, language, mirrors): if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) + elif archinstall.arguments.get('audio', None) == 'pulseaudio': + print('Installing pulseaudio ...') + installation.add_additional_packages("pulseaudio") if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) -- cgit v1.2.3-54-g00ecf From dbea18dab868dd4e32a2e72628dcb75a159f87a9 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 09:28:16 +0200 Subject: Switched from print to installation.log --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index f7078242..490fbe96 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -282,7 +282,7 @@ def perform_installation(device, boot_partition, language, mirrors): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - print('This audio server will be used: ' + archinstall.arguments.get('audio', None)) + installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) -- cgit v1.2.3-54-g00ecf From 9312076cfe552922aeed68f6c83e4a92775683a2 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Wed, 7 Apr 2021 09:29:50 +0200 Subject: Change phrasing to indicate pulseaudio as default --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 8062f6e3..96a76e9e 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -142,7 +142,7 @@ def ask_for_a_timezone(): def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments - pipewire_choice = input("Would you like to install the pipewire audio server? [Y/n] ").lower() + pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() if pipewire_choice == "y": audio = "pipewire" -- cgit v1.2.3-54-g00ecf From 4c92879c1de26b88afcdb1955bd2c9c153d2787a Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 19:51:16 -0400 Subject: Make audio server selection only prompt for desktop profiles --- examples/guided.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index 490fbe96..e136437e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -160,9 +160,16 @@ def ask_user_questions(): ) exit(1) - # Ask about audio server selection (this right now just asks for pipewire and defaults to pulseaudio otherwise) + # Ask about audio server selection if one is not already set if not archinstall.arguments.get('audio', None): - archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() + + # only ask for audio server selection on a desktop profile + if str(archinstall.arguments['profile']) == 'Profile(desktop)': + archinstall.arguments['audio'] = archinstall.ask_for_audio_selection() + else: + # packages installed by a profile may depend on audio and something may get installed anyways, not much we can do about that. + # we will not try to remove packages post-installation to not have audio, as that may cause multiple issues + archinstall.arguments['audio'] = 'none' # Additional packages (with some light weight error handling for invalid package names) if not archinstall.arguments.get('packages', None): @@ -282,13 +289,14 @@ def perform_installation(device, boot_partition, language, mirrors): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) - if archinstall.arguments.get('audio', None) == 'pipewire': - print('Installing pipewire ...') - installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) - elif archinstall.arguments.get('audio', None) == 'pulseaudio': - print('Installing pulseaudio ...') - installation.add_additional_packages("pulseaudio") + if archinstall.arguments['audio'] != 'none': + installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) + if archinstall.arguments.get('audio', None) == 'pipewire': + print('Installing pipewire ...') + installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) + elif archinstall.arguments.get('audio', None) == 'pulseaudio': + print('Installing pulseaudio ...') + installation.add_additional_packages("pulseaudio") if archinstall.arguments.get('packages', None) and archinstall.arguments.get('packages', None)[0] != '': installation.add_additional_packages(archinstall.arguments.get('packages', None)) -- cgit v1.2.3-54-g00ecf From 45c321e327270f010daa42ad247c4c5ca67c1f16 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Wed, 7 Apr 2021 21:31:28 -0400 Subject: Assume yes is the user's intention if empty response for pipewire prompt --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 96a76e9e..f1899a05 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -143,7 +143,7 @@ def ask_for_a_timezone(): def ask_for_audio_selection(): audio = "pulseaudio" # Default for most desktop environments pipewire_choice = input("Would you like to install pipewire instead of pulseaudio as the default audio server? [Y/n] ").lower() - if pipewire_choice == "y": + if pipewire_choice in ("y", ""): audio = "pipewire" return audio -- cgit v1.2.3-54-g00ecf From cf1fd9e25797a73dd8787d741b1276bd5b86e743 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Thu, 8 Apr 2021 08:17:40 +0200 Subject: Safety precaution by using .get instead of ["..."] --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index e136437e..18f2cc64 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -289,7 +289,7 @@ def perform_installation(device, boot_partition, language, mirrors): installation.enable_service('systemd-networkd') installation.enable_service('systemd-resolved') - if archinstall.arguments['audio'] != 'none': + if archinstall.arguments.get('audio', None) != None: installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') -- cgit v1.2.3-54-g00ecf From cab53ef8f611dbee33e946bed4ca2fb1e7ebe285 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 07:24:52 +0530 Subject: networkmanager support --- archinstall/lib/user_interaction.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index f1899a05..5538272f 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -152,7 +152,7 @@ def ask_to_configure_network(): # Optionally configure one network interface. #while 1: # {MAC: Ifname} - interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation', **list_interfaces()} + interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage you internet conntetion', **list_interfaces()} nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': @@ -176,9 +176,9 @@ def ask_to_configure_network(): if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()): dns = dns_input.split(' ') - return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} + return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns}s else: - return {'nic': nic} + return {'nic': nic,'NetworkManager':True} elif nic: return nic -- cgit v1.2.3-54-g00ecf From e1e813fc5e0369387f8aae0ca279758fe9ab5c08 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 07:33:17 +0530 Subject: updated guided.py to allow network manager as nic --- examples/guided.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 18f2cc64..93b0f85f 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -282,7 +282,8 @@ def perform_installation(device, boot_partition, language, mirrors): # Perform a copy of the config if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation': installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium. - + elif archinstall.arguments.get('NetworkManager',None) == True: + installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface elif archinstall.arguments.get('nic', None): installation.configure_nic(**archinstall.arguments.get('nic', {})) -- cgit v1.2.3-54-g00ecf From 55622fd79d25fdef34d06e0c9d4d6444cece98ad Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 08:54:35 +0530 Subject: install networkmanager, if required --- examples/guided.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/guided.py b/examples/guided.py index 93b0f85f..85213960 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -283,6 +283,7 @@ def perform_installation(device, boot_partition, language, mirrors): if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation': installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium. elif archinstall.arguments.get('NetworkManager',None) == True: + installation.add_additional_packages("networkmanager") installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface elif archinstall.arguments.get('nic', None): -- cgit v1.2.3-54-g00ecf From 75a36e2fdc96e0e4e0a758f360f00456b49d37a8 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:03:49 +0530 Subject: fixed typo --- archinstall/lib/user_interaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 5538272f..62b0a3eb 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -176,7 +176,7 @@ def ask_to_configure_network(): if len(dns_input := input('Enter your DNS servers (space separated, blank for none): ').strip()): dns = dns_input.split(' ') - return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns}s + return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} else: return {'nic': nic,'NetworkManager':True} elif nic: -- cgit v1.2.3-54-g00ecf From 46c43b25a6e1dcf6a633744c06738f8efd542ed8 Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:08:17 +0530 Subject: moved around the if block --- archinstall/lib/user_interaction.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 62b0a3eb..c140b6fa 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -156,6 +156,8 @@ def ask_to_configure_network(): nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': + if nic == 'Use NetworkManager to control and manage you internet conntetion': + return {'nic': nic,'NetworkManager':True} mode = generic_select(['DHCP (auto detect)', 'IP (static)'], f"Select which mode to configure for {nic}: ") if mode == 'IP (static)': while 1: @@ -178,7 +180,7 @@ def ask_to_configure_network(): return {'nic': nic, 'dhcp': False, 'ip': ip, 'gateway' : gateway, 'dns' : dns} else: - return {'nic': nic,'NetworkManager':True} + return {'nic': nic} elif nic: return nic -- cgit v1.2.3-54-g00ecf From dd61830d2b6379ff772ab6099560d4e012864b9f Mon Sep 17 00:00:00 2001 From: advaithm Date: Sun, 4 Apr 2021 09:26:28 +0530 Subject: fixed some typos and changed up how we detect if we have to enable/install network manager --- archinstall/lib/user_interaction.py | 4 ++-- examples/guided.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index c140b6fa..b9bfe89c 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -152,11 +152,11 @@ def ask_to_configure_network(): # Optionally configure one network interface. #while 1: # {MAC: Ifname} - interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage you internet conntetion', **list_interfaces()} + interfaces = {'ISO-CONFIG' : 'Copy ISO network configuration to installation','NetworkManager':'Use NetworkManager to control and manage your internet connection', **list_interfaces()} nic = generic_select(interfaces.values(), "Select one network interface to configure (leave blank to skip): ") if nic and nic != 'Copy ISO network configuration to installation': - if nic == 'Use NetworkManager to control and manage you internet conntetion': + if nic == 'Use NetworkManager to control and manage your internet connection': return {'nic': nic,'NetworkManager':True} mode = generic_select(['DHCP (auto detect)', 'IP (static)'], f"Select which mode to configure for {nic}: ") if mode == 'IP (static)': diff --git a/examples/guided.py b/examples/guided.py index 85213960..e8bc2b53 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -282,7 +282,7 @@ def perform_installation(device, boot_partition, language, mirrors): # Perform a copy of the config if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation': installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium. - elif archinstall.arguments.get('NetworkManager',None) == True: + elif archinstall.arguments.get('nic',None) == 'Use NetworkManager to control and manage your internet connection': installation.add_additional_packages("networkmanager") installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface -- cgit v1.2.3-54-g00ecf From b6ad3dffc9b76675741a63d846135f7a3ff353f3 Mon Sep 17 00:00:00 2001 From: Advaith Madhukar Date: Sun, 4 Apr 2021 14:42:19 +0530 Subject: fixed network manager check --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index e8bc2b53..46f0ba54 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -282,7 +282,7 @@ def perform_installation(device, boot_partition, language, mirrors): # Perform a copy of the config if archinstall.arguments.get('nic', None) == 'Copy ISO network configuration to installation': installation.copy_ISO_network_config(enable_services=True) # Sources the ISO network configuration to the install medium. - elif archinstall.arguments.get('nic',None) == 'Use NetworkManager to control and manage your internet connection': + elif archinstall.arguments.get('nic',{}).get('NetworkManager',False): installation.add_additional_packages("networkmanager") installation.enable_service('NetworkManager.service') # Otherwise, if a interface was selected, configure that interface -- cgit v1.2.3-54-g00ecf From 6a0b839bc8be05bce8630758526ec0bc122e91ce Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 11:59:47 -0400 Subject: pipewire-docs isn't really needed. --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 46f0ba54..c7fecb5e 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -295,7 +295,7 @@ def perform_installation(device, boot_partition, language, mirrors): installation.log(f"The {archinstall.arguments.get('audio', None)} audio server will be used.", level=archinstall.LOG_LEVELS.Info) if archinstall.arguments.get('audio', None) == 'pipewire': print('Installing pipewire ...') - installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-docs", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) + installation.add_additional_packages(["pipewire", "pipewire-alsa", "pipewire-jack", "pipewire-media-session", "pipewire-pulse", "gst-plugin-pipewire", "libpulse"]) elif archinstall.arguments.get('audio', None) == 'pulseaudio': print('Installing pulseaudio ...') installation.add_additional_packages("pulseaudio") -- cgit v1.2.3-54-g00ecf From f57b533275251b8f249a1a396261489e4f0266d8 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 20:18:14 +0200 Subject: Added some debug output Adding debug output for additional package selection. --- examples/guided.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/guided.py b/examples/guided.py index c7fecb5e..60517005 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -177,12 +177,14 @@ def ask_user_questions(): print("If you desire a web browser, such as firefox or chromium, you may specify it in the following prompt.") archinstall.arguments['packages'] = [package for package in input('Write additional packages to install (space separated, leave blank to skip): ').split(' ') if len(package)] - # Verify packages that were given - try: - archinstall.validate_package_list(archinstall.arguments['packages']) - except archinstall.RequirementError as e: - archinstall.log(e, fg='red') - exit(1) + if len(archinstall.arguments['packages']): + # Verify packages that were given + try: + archinstall.log(f"Verifying that additional packages exist (this might take a few seconds)") + archinstall.validate_package_list(archinstall.arguments['packages']) + except archinstall.RequirementError as e: + archinstall.log(e, fg='red') + exit(1) # Ask or Call the helper function that asks the user to optionally configure a network. if not archinstall.arguments.get('nic', None): -- cgit v1.2.3-54-g00ecf From 8d627d0c099e33332a7db750b2b875f8d1080947 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 14:19:46 -0400 Subject: Add more suggested packages to sway --- profiles/applications/sway.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/applications/sway.py b/profiles/applications/sway.py index c99f378a..56d7f318 100644 --- a/profiles/applications/sway.py +++ b/profiles/applications/sway.py @@ -1,3 +1,3 @@ import archinstall -packages = "sway swaylock swayidle dmenu alacritty" +packages = "sway swaylock swayidle waybar dmenu light grim slurp pavucontrol alacritty" installation.add_additional_packages(packages) -- cgit v1.2.3-54-g00ecf From 40df2d6e805edd643d8ed28698128247b3bdb44e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 15:28:35 -0400 Subject: Further i3 simplification and cleanup --- profiles/i3-gaps.py | 17 ----------------- profiles/i3-wm.py | 17 ----------------- profiles/i3.py | 17 ++++------------- 3 files changed, 4 insertions(+), 47 deletions(-) delete mode 100644 profiles/i3-gaps.py delete mode 100644 profiles/i3-wm.py diff --git a/profiles/i3-gaps.py b/profiles/i3-gaps.py deleted file mode 100644 index ddca34b7..00000000 --- a/profiles/i3-gaps.py +++ /dev/null @@ -1,17 +0,0 @@ -import archinstall, subprocess - -is_top_level_profile = False - -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. - """ - return True - -if __name__ == 'i3-gaps': - # install the i3 group now - i3 = archinstall.Application(installation, 'i3-gaps') - i3.install() diff --git a/profiles/i3-wm.py b/profiles/i3-wm.py deleted file mode 100644 index 4a0415fc..00000000 --- a/profiles/i3-wm.py +++ /dev/null @@ -1,17 +0,0 @@ -import archinstall, subprocess - -is_top_level_profile = False - -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. - """ - return True - -if __name__ == 'i3-wm': - # install the i3 group now - i3 = archinstall.Application(installation, 'i3-wm') - i3.install() diff --git a/profiles/i3.py b/profiles/i3.py index 9f58e7eb..9ab5f88d 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -22,7 +22,7 @@ def _prep_function(*args, **kwargs): # Temporarily store the selected desktop profile # in a session-safe location, since this module will get reloaded # the next time it gets executed. - archinstall.storage['_desktop_profile'] = desktop + archinstall.storage['_i3_configuration'] = desktop # i3 requires a functioning Xorg installation. profile = archinstall.Profile(None, 'xorg') @@ -32,14 +32,6 @@ def _prep_function(*args, **kwargs): else: print('Deprecated (??): xorg profile has no _prep_function() anymore') - profile = archinstall.Profile(None, desktop) - # Loading the instructions with a custom namespace, ensures that a __name__ comparison is never triggered. - with profile.load_instructions(namespace=f"{desktop}.py") as imported: - if hasattr(imported, '_prep_function'): - return imported._prep_function() - else: - print(f"Deprecated (??): {desktop} profile has no _prep_function() anymore") - if __name__ == 'i3': """ This "profile" is a meta-profile. @@ -66,7 +58,6 @@ if __name__ == 'i3': # Auto start lightdm for all users installation.enable_service('lightdm') - # TODO: Remove magic variable 'installation' and place it - # in archinstall.storage or archinstall.session/archinstall.installation - installation.install_profile(archinstall.storage['_desktop_profile']) - + # install the i3 group now + i3 = archinstall.Application(installation, archinstall.storage['_i3_configuration']) + i3.install() -- cgit v1.2.3-54-g00ecf From 5bc8ca361a9742c28dda2cad2bdd5a6ba8269525 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 21:42:24 +0200 Subject: Update i3.py --- profiles/i3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/i3.py b/profiles/i3.py index 9ab5f88d..09532707 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -59,5 +59,5 @@ if __name__ == 'i3': installation.enable_service('lightdm') # install the i3 group now - i3 = archinstall.Application(installation, archinstall.storage['_i3_configuration']) + i3 = archinstall.Application(installation, archinstall.storage['_i3_configuration']) i3.install() -- cgit v1.2.3-54-g00ecf From 495cd0d5cbcb5a3d882cb1e5bc7a0810cb33f619 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 21:42:37 +0200 Subject: Update i3.py --- profiles/i3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/i3.py b/profiles/i3.py index 09532707..bc6dc2ca 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -60,4 +60,4 @@ if __name__ == 'i3': # install the i3 group now i3 = archinstall.Application(installation, archinstall.storage['_i3_configuration']) - i3.install() + i3.install() -- cgit v1.2.3-54-g00ecf From 5099376dcdf59cbfcd146f3c2fa92872b2b1920c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 21:50:53 +0200 Subject: Attempting to fix auto-detection of encrypted drives. So that #124 can perform reverse detection on partitions and detect encryption. --- archinstall/lib/disk.py | 4 ++++ archinstall/lib/installer.py | 5 +++-- examples/minimal.py | 4 ++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index f6dc16eb..fe06ac00 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -214,6 +214,10 @@ class Partition(): self._encrypted = value + @property + def parent(self): + return self.real_device + @property def real_device(self): if not self._encrypted: diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 48ef7259..7fd775b1 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -283,8 +283,9 @@ class Installer(): if '/usr/bin/btrfs-progs' not in BINARIES: BINARIES.append('/usr/bin/btrfs') - elif partition.encrypted and 'encrypt' not in HOOKS: - HOOKS.insert(HOOKS.find('filesystems'), 'encrypt') + elif (partition.encrypted or Partition(partition.parent, None).filesystem == 'crypto_LUKS'): + if 'encrypt' not in HOOKS: + HOOKS.insert(HOOKS.find('filesystems'), 'encrypt') self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True diff --git a/examples/minimal.py b/examples/minimal.py index 90bd9227..de896d48 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -1,5 +1,9 @@ import archinstall +# Unmount and close previous runs +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 archinstall.log(f"Minimal only supports:") archinstall.log(f" * Being installed to a single disk") -- cgit v1.2.3-54-g00ecf From 3eeb49bd441ea6311f6a38e893c78c271339fefa Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 16:02:26 -0400 Subject: Forgot to commit adding budgie to desktop profile --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/desktop.py b/profiles/desktop.py index e2850da4..7b10f773 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile -- cgit v1.2.3-54-g00ecf From 97540293b8fd1e867006d52f07b3817bf491c7cf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 22:06:17 +0200 Subject: Removed some debugging auto-unmount --- examples/minimal.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/minimal.py b/examples/minimal.py index de896d48..90bd9227 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -1,9 +1,5 @@ import archinstall -# Unmount and close previous runs -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 archinstall.log(f"Minimal only supports:") archinstall.log(f" * Being installed to a single disk") -- cgit v1.2.3-54-g00ecf From 0370c44ed812961460de48d6e8888f8e868cc7fa Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 22:08:33 +0200 Subject: Enabled skipping partitioning in minimal. It now can take /mnt just as guided as it's destination, and skips partitioning all together. Which makes it go straight to installation. --- examples/minimal.py | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/examples/minimal.py b/examples/minimal.py index 90bd9227..98d9a6f0 100644 --- a/examples/minimal.py +++ b/examples/minimal.py @@ -10,7 +10,6 @@ if archinstall.arguments.get('help', None): archinstall.log(f" - Optional systemd network via --network") archinstall.arguments['harddrive'] = archinstall.select_disk(archinstall.all_disks()) -archinstall.arguments['harddrive'].keep_partitions = False def install_on(mountpoint): # We kick off the installer by telling it where the @@ -37,32 +36,36 @@ def install_on(mountpoint): archinstall.log(f" * root (password: airoot)") archinstall.log(f" * devel (password: devel)") -print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') -archinstall.do_countdown() +if archinstall.arguments['harddrive']: + archinstall.arguments['harddrive'].keep_partitions = False + + print(f" ! Formatting {archinstall.arguments['harddrive']} in ", end='') + archinstall.do_countdown() -# First, we configure the basic filesystem layout -with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: - # We use the entire disk instead of setting up partitions on your own - if archinstall.arguments['harddrive'].keep_partitions is False: - fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) + # First, we configure the basic filesystem layout + with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: + # We use the entire disk instead of setting up partitions on your own + if archinstall.arguments['harddrive'].keep_partitions is False: + fs.use_entire_disk(root_filesystem_type=archinstall.arguments.get('filesystem', 'btrfs')) - boot = fs.find_partition('/boot') - root = fs.find_partition('/') + boot = fs.find_partition('/boot') + root = fs.find_partition('/') - boot.format('vfat') + boot.format('vfat') - # We encrypt the root partition if we got a password to do so with, - # Otherwise we just skip straight to formatting and installation - if archinstall.arguments.get('!encryption-password', None): - root.encrypted = True - root.encrypt(password=archinstall.arguments.get('!encryption-password', None)) + # We encrypt the root partition if we got a password to do so with, + # Otherwise we just skip straight to formatting and installation + if archinstall.arguments.get('!encryption-password', None): + root.encrypted = True + root.encrypt(password=archinstall.arguments.get('!encryption-password', None)) - with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: - unlocked_root.format(root.filesystem) - unlocked_root.mount('/mnt') - else: - root.format(root.filesystem) - root.mount('/mnt') + with archinstall.luks2(root, 'luksloop', archinstall.arguments.get('!encryption-password', None)) as unlocked_root: + unlocked_root.format(root.filesystem) + unlocked_root.mount('/mnt') + else: + root.format(root.filesystem) + root.mount('/mnt') - boot.mount('/mnt/boot') - install_on('/mnt') \ No newline at end of file + boot.mount('/mnt/boot') + +install_on('/mnt') \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 8f096001b6f5c8a864bc1e65b56bbfad1a9c9a3f Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 22:34:26 +0200 Subject: Attempting to correct some inconsitencies in disk-parent reporting. --- archinstall/lib/disk.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index fe06ac00..1f0e584a 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -220,12 +220,9 @@ class Partition(): @property def real_device(self): - if not self._encrypted: - return self.path - else: - for blockdevice in json.loads(b''.join(sys_command('lsblk -J')).decode('UTF-8'))['blockdevices']: - if (parent := self.find_parent_of(blockdevice, os.path.basename(self.path))): - return f"/dev/{parent}" + for blockdevice in json.loads(b''.join(sys_command('lsblk -J')).decode('UTF-8'))['blockdevices']: + if (parent := self.find_parent_of(blockdevice, os.path.basename(self.path))): + return f"/dev/{parent}" # raise DiskError(f'Could not find appropriate parent for encrypted partition {self}') return self.path -- cgit v1.2.3-54-g00ecf From c7b213337613ed586bed24486440b4635054b57d Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 22:58:41 +0200 Subject: Attempting to correct some inconsitencies in disk-parent reporting. --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 7fd775b1..a60955b7 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -283,7 +283,7 @@ class Installer(): if '/usr/bin/btrfs-progs' not in BINARIES: BINARIES.append('/usr/bin/btrfs') - elif (partition.encrypted or Partition(partition.parent, None).filesystem == 'crypto_LUKS'): + if (partition.encrypted or Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS'): if 'encrypt' not in HOOKS: HOOKS.insert(HOOKS.find('filesystems'), 'encrypt') -- cgit v1.2.3-54-g00ecf From e49b73cef41b39e0046a8dc10fddfc4337255a5b Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:12:47 +0200 Subject: Attempting to correct some inconsitencies in disk-parent reporting. --- archinstall/lib/disk.py | 3 +++ archinstall/lib/installer.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 1f0e584a..d0d7d4ea 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -166,6 +166,9 @@ class Partition(): self.mountpoint = target if not self.filesystem and autodetect_filesystem: + print(f'Auto-detecting filesystem for: {path}') + print('Mount information:', mount_information.get('fstype', None)) + print('Real device:', get_filesystem_type(self.real_device)) if (fstype := mount_information.get('fstype', get_filesystem_type(self.real_device))): self.filesystem = fstype diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index a60955b7..8adc3515 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -283,7 +283,7 @@ class Installer(): if '/usr/bin/btrfs-progs' not in BINARIES: BINARIES.append('/usr/bin/btrfs') - if (partition.encrypted or Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS'): + if (partition.encrypted or (partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS')): if 'encrypt' not in HOOKS: HOOKS.insert(HOOKS.find('filesystems'), 'encrypt') -- cgit v1.2.3-54-g00ecf From 0531e3a0d6368ee2ae606d2f390ffffaf53e4f2e Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:18:04 +0200 Subject: Attempting to correct some inconsitencies in disk-parent reporting. --- archinstall/lib/disk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index d0d7d4ea..15071c00 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -168,8 +168,8 @@ class Partition(): if not self.filesystem and autodetect_filesystem: print(f'Auto-detecting filesystem for: {path}') print('Mount information:', mount_information.get('fstype', None)) - print('Real device:', get_filesystem_type(self.real_device)) - if (fstype := mount_information.get('fstype', get_filesystem_type(self.real_device))): + print('Real device:', get_filesystem_type(path)) + if (fstype := mount_information.get('fstype', get_filesystem_type(path))): self.filesystem = fstype if self.filesystem == 'crypto_LUKS': -- cgit v1.2.3-54-g00ecf From f031bb077ce8e4eee3745f4f109b451856aab372 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:18:59 +0200 Subject: List function call error. --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 8adc3515..74978ef6 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -285,7 +285,7 @@ class Installer(): if (partition.encrypted or (partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS')): if 'encrypt' not in HOOKS: - HOOKS.insert(HOOKS.find('filesystems'), 'encrypt') + HOOKS.insert(HOOKS.index('filesystems'), 'encrypt') self.pacstrap(self.base_packages) self.helper_flags['base-strapped'] = True -- cgit v1.2.3-54-g00ecf From 99c18d5d663453d792683464ce6b077333ec7775 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:26:16 +0200 Subject: Removed some debugging. --- archinstall/lib/disk.py | 3 --- archinstall/lib/installer.py | 1 - 2 files changed, 4 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 15071c00..e5aa9a85 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -166,9 +166,6 @@ class Partition(): self.mountpoint = target if not self.filesystem and autodetect_filesystem: - print(f'Auto-detecting filesystem for: {path}') - print('Mount information:', mount_information.get('fstype', None)) - print('Real device:', get_filesystem_type(path)) if (fstype := mount_information.get('fstype', get_filesystem_type(path))): self.filesystem = fstype diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 74978ef6..c4e4e515 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -49,7 +49,6 @@ class Installer(): storage['session'] = self self.partitions = get_partitions_in_use(self.target) - print(self.partitions) def log(self, *args, level=LOG_LEVELS.Debug, **kwargs): """ -- cgit v1.2.3-54-g00ecf From 9b2f627d9eb024e5068e317c00e7f8d8bb0ffa09 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:41:13 +0200 Subject: Fixing broken logic in guided --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index 2028c0c4..ed0a485a 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -37,7 +37,7 @@ def ask_user_questions(): # 1. Check if it has partitions # 3. Check that we support the current partitions # 2. If so, ask if we should keep them or wipe everything - if archinstall.arguments['harddrive'].has_partitions(): + if archinstall.arguments['harddrive'] and archinstall.arguments['harddrive'].has_partitions(): archinstall.log(f"{archinstall.arguments['harddrive']} contains the following partitions:", fg='yellow') # We curate a list pf supported partitions -- cgit v1.2.3-54-g00ecf From 22eb6e023ddf04552777d5c59a1054836964dd42 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:42:28 +0200 Subject: Fixing broken logic in guided --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index ed0a485a..b4b970bb 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -116,7 +116,7 @@ def ask_user_questions(): elif option == 'format-all': archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format() archinstall.arguments['harddrive'].keep_partitions = False - else: + elif archinstall.arguments['harddrive']: # If the drive doesn't have any partitions, safely mark the disk with keep_partitions = False # and ask the user for a root filesystem. archinstall.arguments['filesystem'] = archinstall.ask_for_main_filesystem_format() -- cgit v1.2.3-54-g00ecf From 103320b06188565f2166e0330dd3a8bedb9f8572 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 9 Apr 2021 23:43:17 +0200 Subject: Fixing broken logic in guided --- examples/guided.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/guided.py b/examples/guided.py index b4b970bb..79023012 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -123,7 +123,7 @@ def ask_user_questions(): archinstall.arguments['harddrive'].keep_partitions = False # Get disk encryption password (or skip if blank) - if not archinstall.arguments.get('!encryption-password', None): + if archinstall.arguments['harddrive'] and archinstall.arguments.get('!encryption-password', None) is None: if (passwd := archinstall.get_password(prompt='Enter disk encryption password (leave blank for no encryption): ')): archinstall.arguments['!encryption-password'] = passwd archinstall.arguments['harddrive'].encryption_password = archinstall.arguments['!encryption-password'] -- cgit v1.2.3-54-g00ecf From 45500764328d744bb2b4611353461dfc1dcd12e9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 18:05:00 -0400 Subject: Try to solve #261 and related issues --- profiles/desktop.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/desktop.py b/profiles/desktop.py index 7b10f773..4d64dcef 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -6,7 +6,7 @@ is_top_level_profile = True # 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'] +__packages__ = ['nano', 'vim', 'openssh', 'htop', 'wget', 'iwd', 'wireless_tools', 'wpa_supplicant', 'smartmontools', 'xdg-utils'] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-54-g00ecf From e7ad4038bda9fb5906c4708eb8b48babe9778387 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 10 Apr 2021 00:06:25 +0200 Subject: Fixing UUID on encrypted partitions. --- archinstall/lib/installer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c4e4e515..af973227 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -256,6 +256,9 @@ class Installer(): return True + def detect_encryption(self, partition): + return partition.encrypted or (partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS') + def minimal_installation(self): ## Add necessary packages if encrypting the drive ## (encrypted partitions default to btrfs for now, so we need btrfs-progs) @@ -282,7 +285,7 @@ class Installer(): if '/usr/bin/btrfs-progs' not in BINARIES: BINARIES.append('/usr/bin/btrfs') - if (partition.encrypted or (partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS')): + if self.detect_encryption(partition): if 'encrypt' not in HOOKS: HOOKS.insert(HOOKS.index('filesystems'), 'encrypt') @@ -372,7 +375,7 @@ class Installer(): ## so we'll use the old manual method until we get that sorted out. - if root_partition.encrypted: + if self.detect_encryption(root_partition): log(f"Identifying root partition by DISK-UUID on {root_partition}, looking for '{os.path.basename(root_partition.real_device)}'.", level=LOG_LEVELS.Debug) for root, folders, uids in os.walk('/dev/disk/by-uuid'): for uid in uids: -- cgit v1.2.3-54-g00ecf From 40b3a935eb5fb7ed205989094efc29d93cd97393 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 9 Apr 2021 22:12:40 -0400 Subject: i3-sensible-terminal can't find a terminal on new install Add urxvt, the most preferred terminal according to https://man.archlinux.org/man/i3-sensible-terminal.1 Update i3.py Update i3.py --- profiles/i3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles/i3.py b/profiles/i3.py index bc6dc2ca..67028b2d 100644 --- a/profiles/i3.py +++ b/profiles/i3.py @@ -6,7 +6,7 @@ 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__ = ['i3lock', 'i3status', 'i3blocks'] +__packages__ = ['i3lock', 'i3status', 'i3blocks', 'xterm'] def _prep_function(*args, **kwargs): """ -- cgit v1.2.3-54-g00ecf From c674bbd3024dc79ce1e630a0471a4d4fd52f6df5 Mon Sep 17 00:00:00 2001 From: Zach Osman Date: Fri, 9 Apr 2021 23:11:58 -0400 Subject: update docs --- docs/archinstall/general.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/archinstall/general.rst b/docs/archinstall/general.rst index 0403ae30..bcbc554e 100644 --- a/docs/archinstall/general.rst +++ b/docs/archinstall/general.rst @@ -88,3 +88,13 @@ Exceptions .. autofunction:: archinstall.ProfileError .. autofunction:: archinstall.SysCallError + +.. autofunction:: archinstall.ProfileNotFound + +.. autofunction:: archinstall.HardwareIncompatibilityError + +.. autofunction:: archinstall.PermissionError + +.. autofunction:: archinstall.UserError + +.. autofunction:: archinstall.ServiceException -- cgit v1.2.3-54-g00ecf From 29ecf232d40d56811a177375d739e59546d9f38d Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 10 Apr 2021 00:21:15 -0400 Subject: Remove lightdm-gtk-greeter-settings --- profiles/applications/budgie.py | 2 +- profiles/applications/cinnamon.py | 2 +- profiles/applications/xfce4.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/profiles/applications/budgie.py b/profiles/applications/budgie.py index 8c5ea223..ccec4e14 100644 --- a/profiles/applications/budgie.py +++ b/profiles/applications/budgie.py @@ -1,4 +1,4 @@ import archinstall # "It is recommended also to install the gnome group, which contains applications required for the standard GNOME experience." - Arch Wiki -installation.add_additional_packages("budgie-desktop lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings gnome") \ No newline at end of file +installation.add_additional_packages("budgie-desktop lightdm lightdm-gtk-greeter gnome") \ No newline at end of file diff --git a/profiles/applications/cinnamon.py b/profiles/applications/cinnamon.py index 5e2ac02e..de29aa09 100644 --- a/profiles/applications/cinnamon.py +++ b/profiles/applications/cinnamon.py @@ -1,3 +1,3 @@ import archinstall -installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") \ No newline at end of file +installation.add_additional_packages("cinnamon system-config-printer gnome-keyring gnome-terminal blueberry metacity lightdm lightdm-gtk-greeter") \ No newline at end of file diff --git a/profiles/applications/xfce4.py b/profiles/applications/xfce4.py index 809d10d0..e8f659c2 100644 --- a/profiles/applications/xfce4.py +++ b/profiles/applications/xfce4.py @@ -1,3 +1,3 @@ import archinstall -installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings") \ No newline at end of file +installation.add_additional_packages("xfce4 xfce4-goodies lightdm lightdm-gtk-greeter") \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 1e0770e582b8a32175dfda224a153bf19522fb03 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 10 Apr 2021 10:14:15 +0200 Subject: Modified encrypted partitions to use partuuid for now. --- archinstall/lib/disk.py | 12 ++++++++++++ archinstall/lib/installer.py | 30 ++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index e5aa9a85..1a2dc4dc 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -126,6 +126,18 @@ class BlockDevice(): def partition_table_type(self): return GPT + @property + def uuid(self): + log(f'BlockDevice().uuid is untested!', level=LOG_LEVELS.Warning, fg='yellow') + """ + Returns the disk UUID as returned by lsblk. + This is more reliable than relying on /dev/disk/by-partuuid as + it doesn't seam to be able to detect md raid partitions. + """ + lsblk = b''.join(sys_command(f'lsblk -J -o+UUID {self.path}')) + for partition in json.loads(lsblk.decode('UTF-8'))['blockdevices']: + return partition.get('uuid', None) + def has_partitions(self): return len(self.partitions) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index af973227..0c622129 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -257,7 +257,12 @@ class Installer(): return True def detect_encryption(self, partition): - return partition.encrypted or (partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS') + if partition.encrypted: + return partition + elif partition.parent not in partition.path and Partition(partition.parent, None, autodetect_filesystem=True).filesystem == 'crypto_LUKS': + return Partition(partition.parent, None, autodetect_filesystem=True) + + return False def minimal_installation(self): ## Add necessary packages if encrypting the drive @@ -375,26 +380,15 @@ class Installer(): ## so we'll use the old manual method until we get that sorted out. - if self.detect_encryption(root_partition): - log(f"Identifying root partition by DISK-UUID on {root_partition}, looking for '{os.path.basename(root_partition.real_device)}'.", level=LOG_LEVELS.Debug) - for root, folders, uids in os.walk('/dev/disk/by-uuid'): - for uid in uids: - real_path = os.path.realpath(os.path.join(root, uid)) - - log(f"Checking root partition match {os.path.basename(real_path)} against {os.path.basename(root_partition.real_device)}: {os.path.basename(real_path) == os.path.basename(root_partition.real_device)}", level=LOG_LEVELS.Debug) - if not os.path.basename(real_path) == os.path.basename(root_partition.real_device): continue - - entry.write(f'options cryptdevice=UUID={uid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') - - self.helper_flags['bootloader'] = bootloader - return True - break + if (real_device := self.detect_encryption(root_partition)): + log(f"Identifying root partition by PART-UUID on {real_device}: '{real_device.uuid}'.", level=LOG_LEVELS.Debug) + entry.write(f'options cryptdevice=PARTUUID={real_device.uuid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') else: - log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{os.path.basename(root_partition.path)}'.", level=LOG_LEVELS.Debug) + log(f"Identifying root partition by PART-UUID on {root_partition}, looking for '{root_partition.uuid}'.", level=LOG_LEVELS.Debug) entry.write(f'options root=PARTUUID={root_partition.uuid} rw intel_pstate=no_hwp\n') - self.helper_flags['bootloader'] = bootloader - return True + self.helper_flags['bootloader'] = bootloader + return True raise RequirementError(f"Could not identify the UUID of {root_partition}, there for {self.target}/boot/loader/entries/arch.conf will be broken until fixed.") else: -- cgit v1.2.3-54-g00ecf From d9fc8abf02c70ad8177048f85a06294d63e41faf Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 10 Apr 2021 10:25:59 +0200 Subject: Added a #TODO --- archinstall/lib/installer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 0c622129..92e89f26 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -381,6 +381,8 @@ class Installer(): if (real_device := self.detect_encryption(root_partition)): + # TODO: We need to detect if the encrypted device is a whole disk encryption, + # or simply a partition encryption. Right now we assume it's a partition (and we always have) log(f"Identifying root partition by PART-UUID on {real_device}: '{real_device.uuid}'.", level=LOG_LEVELS.Debug) entry.write(f'options cryptdevice=PARTUUID={real_device.uuid}:luksdev root=/dev/mapper/luksdev rw intel_pstate=no_hwp\n') else: -- cgit v1.2.3-54-g00ecf From b9148f6d3be590ec3301337ea2b895d90a9ff9ac Mon Sep 17 00:00:00 2001 From: NicoHood Date: Sat, 10 Apr 2021 10:55:49 +0200 Subject: fix typo --- archinstall/lib/luks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/luks.py b/archinstall/lib/luks.py index 561d4d6e..ca077b3d 100644 --- a/archinstall/lib/luks.py +++ b/archinstall/lib/luks.py @@ -116,7 +116,7 @@ class luks2(): def unlock(self, partition, mountpoint, key_file): """ - Mounts a lukts2 compatible partition to a certain mountpoint. + Mounts a luks2 compatible partition to a certain mountpoint. Keyfile must be specified as there's no way to interact with the pw-prompt atm. :param mountpoint: The name without absolute path, for instance "luksdev" will point to /dev/mapper/luksdev -- cgit v1.2.3-54-g00ecf From 48e801e6fdbc1f74885a3541011d4cce5876ab21 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Sat, 10 Apr 2021 11:21:24 +0200 Subject: Added a mission statement, and updated the minimal example in the readme. --- README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 2f3881e1..a48f0a91 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,18 @@ Assuming you are on a Arch Linux live-ISO and booted into EFI mode. # python -m archinstall guided +# Mission Statement + +Archinstall promises to ship a [guided installer](https://github.com/archlinux/archinstall/blob/master/examples/guided.py) that follows the [Arch Principles](https://wiki.archlinux.org/index.php/Arch_Linux#Principles) as well as a library to manage services, packages and other Arch Linux aspects. + +The guided installer will provide user friendly options along the way, but the keyword here is options, they are optional and will never be forced upon anyone. The guided installer itself is also optional to use if so desired and not forced upon anyone. + +--- + +Archinstall has one fundamental function which is to be a flexible library to manage services, packages and other aspects inside the installed system. This library is in turn used by the provided guided installer but is also for anyone who wants to script their own installations. + +Therefore, Archinstall will try its best to not introduce any breaking changes except for major releases which may break backwards compability after notifying about such changes. + # Scripting your own installation You could just copy [guided.py](examples/guided.py) as a starting point. @@ -35,23 +47,44 @@ import archinstall, getpass harddrive = archinstall.select_disk(archinstall.all_disks()) disk_password = getpass.getpass(prompt='Disk password (won\'t echo): ') -with archinstall.Filesystem(harddrive, archinstall.GPT) as fs: - # use_entire_disk() is a helper to not have to format manually - fs.use_entire_disk('luks2') +# We disable safety precautions in the library that protects the partitions +harddrive.keep_partitions = False + +# First, we configure the basic filesystem layout +with archinstall.Filesystem(archinstall.arguments['harddrive'], archinstall.GPT) as fs: + # We create a filesystem layout that will use the entire drive + # (this is a helper function, you can partition manually as well) + fs.use_entire_disk(root_filesystem_type='btrfs') + + boot = fs.find_partition('/boot') + root = fs.find_partition('/') + + boot.format('vfat') + + # Set the flat for encrypted to allow for encryption and then encrypt + root.encrypted = True + root.encrypt(password=archinstall.arguments.get('!encryption-password', None)) + +with archinstall.luks2(root, 'luksloop', disk_password) as unlocked_root: + unlocked_root.format(root.filesystem) + unlocked_root.mount('/mnt') + + boot.mount('/mnt/boot') - harddrive.partition[0].format('fat32') - with archinstall.luks2(harddrive.partition[1], 'luksloop', disk_password) as unlocked_device: - unlocked_device.format('btrfs') +with archinstall.Installer('/mnt') as installation: + if installation.minimal_installation(): + installation.set_hostname('minimal-arch') + installation.add_bootloader() - with archinstall.Installer(unlocked_device, hostname='testmachine') as installation: - if installation.minimal_installation(): - installation.add_bootloader(harddrive.partition[0]) + installation.add_additional_packages(['nano', 'wget', 'git']) - installation.add_additional_packages(['nano', 'wget', 'git']) - installation.install_profile('awesome') + # Optionally, install a profile of choice. + # In this case, we install a minimal profile that is empty + installation.install_profile('minimal') - installation.user_create('anton', 'test') - installation.user_set_pw('root', 'toor') + installation.user_create('devel', 'devel') + installation.user_set_pw('root', 'airoot') + ``` This installer will perform the following: -- cgit v1.2.3-54-g00ecf From a7b01aa29e38a2faf88f04b7df7dcb4ee8545d90 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sat, 10 Apr 2021 11:11:09 -0400 Subject: Show size in partition string representation --- archinstall/lib/disk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py index 1a2dc4dc..bada4076 100644 --- a/archinstall/lib/disk.py +++ b/archinstall/lib/disk.py @@ -199,9 +199,9 @@ class Partition(): mount_repr = f", rel_mountpoint={self.target_mountpoint}" if self._encrypted: - return f'Partition(path={self.path}, real_device={self.real_device}, fs={self.filesystem}{mount_repr})' + return f'Partition(path={self.path}, size={self.size}, real_device={self.real_device}, fs={self.filesystem}{mount_repr})' else: - return f'Partition(path={self.path}, fs={self.filesystem}{mount_repr})' + return f'Partition(path={self.path}, size={self.size}, fs={self.filesystem}{mount_repr})' @property def uuid(self) -> str: -- cgit v1.2.3-54-g00ecf From cf46642037bf6ed098dc5dfd088b7a2f2e6d5d68 Mon Sep 17 00:00:00 2001 From: Dylan Taylor Date: Sun, 11 Apr 2021 09:50:52 -0400 Subject: Implement MATE desktop environment --- profiles/applications/mate.py | 3 +++ profiles/desktop.py | 2 +- profiles/mate.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 profiles/applications/mate.py create mode 100644 profiles/mate.py diff --git a/profiles/applications/mate.py b/profiles/applications/mate.py new file mode 100644 index 00000000..24d6be47 --- /dev/null +++ b/profiles/applications/mate.py @@ -0,0 +1,3 @@ +import archinstall + +installation.add_additional_packages("mate mate-extra lightdm lightdm-gtk-greeter") \ No newline at end of file diff --git a/profiles/desktop.py b/profiles/desktop.py index 4d64dcef..846182e2 100644 --- a/profiles/desktop.py +++ b/profiles/desktop.py @@ -16,7 +16,7 @@ def _prep_function(*args, **kwargs): for more input before any other installer steps start. """ - supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie'] + supported_desktops = ['gnome', 'kde', 'awesome', 'sway', 'cinnamon', 'xfce4', 'lxqt', 'i3', 'budgie', 'mate'] desktop = archinstall.generic_select(supported_desktops, 'Select your desired desktop environment: ') # Temporarily store the selected desktop profile diff --git a/profiles/mate.py b/profiles/mate.py new file mode 100644 index 00000000..b4c697b1 --- /dev/null +++ b/profiles/mate.py @@ -0,0 +1,34 @@ +# A desktop environment using "MATE" + +import archinstall + +is_top_level_profile = False + +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 + installation.install_profile('xorg') + + # Install the application mate from the template under /applications/ + mate = archinstall.Application(installation, 'mate') + mate.install() + + installation.enable_service('lightdm') # Light Display Manager -- cgit v1.2.3-54-g00ecf