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(-) (limited to 'archinstall') 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(-) (limited to 'archinstall') 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(-) (limited to 'archinstall') 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(-) (limited to 'archinstall') 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(-) (limited to 'archinstall') 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 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 (limited to 'archinstall') 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(-) (limited to 'archinstall') 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 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(-) (limited to 'archinstall') 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 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(-) (limited to 'archinstall') 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 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(-) (limited to 'archinstall') 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 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(-) (limited to 'archinstall') 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 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(-) (limited to 'archinstall') 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 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(-) (limited to 'archinstall') 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 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(-) (limited to 'archinstall') 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