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