Skip to content

Commit 1b92b93

Browse files
committed
Remove plugin system
1 parent d6de03a commit 1b92b93

9 files changed

Lines changed: 9 additions & 298 deletions

File tree

archinstall/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
from archinstall.lib.plugins import plugin
2-
3-
__all__ = ['plugin']

archinstall/lib/args.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from archinstall.lib.models.profile import ProfileConfiguration
2626
from archinstall.lib.models.users import Password, User, UserSerialization
2727
from archinstall.lib.output import debug, error, logger, warn
28-
from archinstall.lib.plugins import load_plugin
2928
from archinstall.lib.translationhandler import Language, tr, translation_handler
3029
from archinstall.lib.version import get_version
3130
from archinstall.tui.ui.components import tui
@@ -48,7 +47,6 @@ class Arguments:
4847
debug: bool = False
4948
offline: bool = False
5049
no_pkg_lookups: bool = False
51-
plugin: str | None = None
5250
skip_version_check: bool = False
5351
skip_wifi_check: bool = False
5452
advanced: bool = False
@@ -395,13 +393,6 @@ def _define_arguments(self) -> ArgumentParser:
395393
default=False,
396394
help='Disabled package validation specifically prior to starting installation.',
397395
)
398-
parser.add_argument(
399-
'--plugin',
400-
nargs='?',
401-
type=str,
402-
default=None,
403-
help='File path to a plugin to load',
404-
)
405396
parser.add_argument(
406397
'--skip-version-check',
407398
action='store_true',
@@ -441,10 +432,6 @@ def _parse_args(self) -> Arguments:
441432
if args.debug:
442433
warn(f'Warning: --debug mode will write certain credentials to {logger.path}!')
443434

444-
if args.plugin:
445-
plugin_path = Path(args.plugin)
446-
load_plugin(plugin_path)
447-
448435
if args.creds_decryption_key is None:
449436
if os.environ.get('ARCHINSTALL_CREDS_DECRYPTION_KEY'):
450437
args.creds_decryption_key = os.environ.get('ARCHINSTALL_CREDS_DECRYPTION_KEY')

archinstall/lib/installer.py

Lines changed: 9 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
from archinstall.lib.pacman.config import PacmanConfig
5555
from archinstall.lib.pacman.pacman import Pacman
5656
from archinstall.lib.pathnames import MIRRORLIST, PACMAN_CONF
57-
from archinstall.lib.plugins import plugins
5857
from archinstall.lib.translationhandler import tr
5958

6059
# Any package that the Installer() is responsible for (optional and the default ones)
@@ -560,11 +559,6 @@ def set_mirrors(
560559
"""
561560
debug('Setting mirrors on ' + ('target' if on_target else 'live system'))
562561

563-
for plugin in plugins.values():
564-
if hasattr(plugin, 'on_mirrors'):
565-
if result := plugin.on_mirrors(mirror_config):
566-
mirror_config = result
567-
568562
if on_target:
569563
mirrorlist_config = self.target / MIRRORLIST.relative_to_root()
570564
pacman_config = self.target / PACMAN_CONF.relative_to_root()
@@ -606,11 +600,6 @@ def genfstab(self, flags: str = '-pU') -> None:
606600
if not fstab_path.is_file():
607601
raise RequirementError('Could not create fstab file')
608602

609-
for plugin in plugins.values():
610-
if hasattr(plugin, 'on_genfstab'):
611-
if plugin.on_genfstab(self) is True:
612-
break
613-
614603
with open(fstab_path, 'a') as fp:
615604
for entry in self._fstab_entries:
616605
fp.write(f'{entry}\n')
@@ -673,11 +662,6 @@ def set_timezone(self, zone: str) -> bool:
673662
if not len(zone):
674663
return True # Redundant
675664

676-
for plugin in plugins.values():
677-
if hasattr(plugin, 'on_timezone'):
678-
if result := plugin.on_timezone(zone):
679-
zone = result
680-
681665
if (Path('/usr') / 'share' / 'zoneinfo' / zone).exists():
682666
(Path(self.target) / 'etc' / 'localtime').unlink(missing_ok=True)
683667
self.arch_chroot(f'ln -s /usr/share/zoneinfo/{zone} /etc/localtime')
@@ -713,10 +697,6 @@ def enable_service(self, services: str | list[str]) -> None:
713697
except SysCallError as err:
714698
raise ServiceException(f'Unable to start service {service}: {err}')
715699

716-
for plugin in plugins.values():
717-
if hasattr(plugin, 'on_service'):
718-
plugin.on_service(service)
719-
720700
def disable_service(self, services_disable: str | list[str]) -> None:
721701
if isinstance(services_disable, str):
722702
services_disable = [services_disable]
@@ -744,19 +724,6 @@ def drop_to_shell(self) -> None:
744724
def configure_nic(self, nic: Nic) -> None:
745725
conf = nic.as_systemd_config()
746726

747-
for plugin in plugins.values():
748-
if hasattr(plugin, 'on_configure_nic'):
749-
conf = (
750-
plugin.on_configure_nic(
751-
nic.iface,
752-
nic.dhcp,
753-
nic.ip,
754-
nic.gateway,
755-
nic.dns,
756-
)
757-
or conf
758-
)
759-
760727
with open(f'{self.target}/etc/systemd/network/10-{nic.iface}.network', 'a') as netconf:
761728
netconf.write(str(conf))
762729

@@ -818,12 +785,6 @@ def post_install_enable_networkd_resolved(*args: str, **kwargs: str) -> None:
818785
return True
819786

820787
def mkinitcpio(self, flags: list[str]) -> bool:
821-
for plugin in plugins.values():
822-
if hasattr(plugin, 'on_mkinitcpio'):
823-
# Allow plugins to override the usage of mkinitcpio altogether.
824-
if plugin.on_mkinitcpio(self):
825-
return True
826-
827788
with open(f'{self.target}/etc/mkinitcpio.conf', 'r+') as mkinit:
828789
content = mkinit.read()
829790
content = re.sub('\nMODULES=(.*)', f'\nMODULES=({" ".join(self._modules)})', content)
@@ -963,10 +924,6 @@ def minimal_installation(
963924
info(f'Running post-installation hook: {function}')
964925
function(self)
965926

966-
for plugin in plugins.values():
967-
if hasattr(plugin, 'on_install'):
968-
plugin.on_install(self)
969-
970927
def setup_btrfs_snapshot(
971928
self,
972929
snapshot_type: SnapshotType,
@@ -1812,14 +1769,6 @@ def add_bootloader(self, bootloader: Bootloader, uki_enabled: bool = False, boot
18121769
:param uki_enabled: Whether to use unified kernel images
18131770
:param bootloader_removable: Whether to install to removable media location (UEFI only, for GRUB and Limine)
18141771
"""
1815-
1816-
for plugin in plugins.values():
1817-
if hasattr(plugin, 'on_add_bootloader'):
1818-
# Allow plugins to override the boot-loader handling.
1819-
# This allows for boot configuring and installing bootloaders.
1820-
if plugin.on_add_bootloader(self):
1821-
return
1822-
18231772
efi_partition = self._get_efi_partition()
18241773
boot_partition = self._get_boot_partition()
18251774
root = self._get_root()
@@ -1902,33 +1851,19 @@ def create_users(self, users: User | list[User]) -> None:
19021851
self._create_user(user)
19031852

19041853
def _create_user(self, user: User) -> None:
1905-
# This plugin hook allows for the plugin to handle the creation of the user.
1906-
# Password and Group management is still handled by user_create()
1907-
handled_by_plugin = False
1908-
for plugin in plugins.values():
1909-
if hasattr(plugin, 'on_user_create'):
1910-
if result := plugin.on_user_create(self, user):
1911-
handled_by_plugin = result
1912-
1913-
if not handled_by_plugin:
1914-
info(f'Creating user {user.username}')
1854+
info(f'Creating user {user.username}')
19151855

1916-
cmd = 'useradd -m'
1856+
cmd = 'useradd -m'
19171857

1918-
if user.sudo:
1919-
cmd += ' -G wheel'
1858+
if user.sudo:
1859+
cmd += ' -G wheel'
19201860

1921-
cmd += f' {user.username}'
1861+
cmd += f' {user.username}'
19221862

1923-
try:
1924-
self.arch_chroot(cmd)
1925-
except SysCallError as err:
1926-
raise SystemError(f'Could not create user inside installation: {err}')
1927-
1928-
for plugin in plugins.values():
1929-
if hasattr(plugin, 'on_user_created'):
1930-
if result := plugin.on_user_created(self, user):
1931-
handled_by_plugin = result
1863+
try:
1864+
self.arch_chroot(cmd)
1865+
except SysCallError as err:
1866+
raise SystemError(f'Could not create user inside installation: {err}')
19321867

19331868
self.set_user_password(user)
19341869

archinstall/lib/pacman/pacman.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from archinstall.lib.exceptions import RequirementError
88
from archinstall.lib.output import error, info, warn
99
from archinstall.lib.pathnames import PACMAN_CONF
10-
from archinstall.lib.plugins import plugins
1110
from archinstall.lib.translationhandler import tr
1211

1312

@@ -67,11 +66,6 @@ def strap(self, packages: str | list[str]) -> None:
6766
if isinstance(packages, str):
6867
packages = [packages]
6968

70-
for plugin in plugins.values():
71-
if hasattr(plugin, 'on_pacstrap'):
72-
if result := plugin.on_pacstrap(packages):
73-
packages = result
74-
7569
info(f'Installing packages: {packages}')
7670

7771
self.ask(

archinstall/lib/plugins.py

Lines changed: 0 additions & 120 deletions
This file was deleted.

0 commit comments

Comments
 (0)