|
54 | 54 | from archinstall.lib.pacman.config import PacmanConfig |
55 | 55 | from archinstall.lib.pacman.pacman import Pacman |
56 | 56 | from archinstall.lib.pathnames import MIRRORLIST, PACMAN_CONF |
57 | | -from archinstall.lib.plugins import plugins |
58 | 57 | from archinstall.lib.translationhandler import tr |
59 | 58 |
|
60 | 59 | # Any package that the Installer() is responsible for (optional and the default ones) |
@@ -560,11 +559,6 @@ def set_mirrors( |
560 | 559 | """ |
561 | 560 | debug('Setting mirrors on ' + ('target' if on_target else 'live system')) |
562 | 561 |
|
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 | | - |
568 | 562 | if on_target: |
569 | 563 | mirrorlist_config = self.target / MIRRORLIST.relative_to_root() |
570 | 564 | pacman_config = self.target / PACMAN_CONF.relative_to_root() |
@@ -606,11 +600,6 @@ def genfstab(self, flags: str = '-pU') -> None: |
606 | 600 | if not fstab_path.is_file(): |
607 | 601 | raise RequirementError('Could not create fstab file') |
608 | 602 |
|
609 | | - for plugin in plugins.values(): |
610 | | - if hasattr(plugin, 'on_genfstab'): |
611 | | - if plugin.on_genfstab(self) is True: |
612 | | - break |
613 | | - |
614 | 603 | with open(fstab_path, 'a') as fp: |
615 | 604 | for entry in self._fstab_entries: |
616 | 605 | fp.write(f'{entry}\n') |
@@ -673,11 +662,6 @@ def set_timezone(self, zone: str) -> bool: |
673 | 662 | if not len(zone): |
674 | 663 | return True # Redundant |
675 | 664 |
|
676 | | - for plugin in plugins.values(): |
677 | | - if hasattr(plugin, 'on_timezone'): |
678 | | - if result := plugin.on_timezone(zone): |
679 | | - zone = result |
680 | | - |
681 | 665 | if (Path('/usr') / 'share' / 'zoneinfo' / zone).exists(): |
682 | 666 | (Path(self.target) / 'etc' / 'localtime').unlink(missing_ok=True) |
683 | 667 | 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: |
713 | 697 | except SysCallError as err: |
714 | 698 | raise ServiceException(f'Unable to start service {service}: {err}') |
715 | 699 |
|
716 | | - for plugin in plugins.values(): |
717 | | - if hasattr(plugin, 'on_service'): |
718 | | - plugin.on_service(service) |
719 | | - |
720 | 700 | def disable_service(self, services_disable: str | list[str]) -> None: |
721 | 701 | if isinstance(services_disable, str): |
722 | 702 | services_disable = [services_disable] |
@@ -744,19 +724,6 @@ def drop_to_shell(self) -> None: |
744 | 724 | def configure_nic(self, nic: Nic) -> None: |
745 | 725 | conf = nic.as_systemd_config() |
746 | 726 |
|
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 | | - |
760 | 727 | with open(f'{self.target}/etc/systemd/network/10-{nic.iface}.network', 'a') as netconf: |
761 | 728 | netconf.write(str(conf)) |
762 | 729 |
|
@@ -818,12 +785,6 @@ def post_install_enable_networkd_resolved(*args: str, **kwargs: str) -> None: |
818 | 785 | return True |
819 | 786 |
|
820 | 787 | 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 | | - |
827 | 788 | with open(f'{self.target}/etc/mkinitcpio.conf', 'r+') as mkinit: |
828 | 789 | content = mkinit.read() |
829 | 790 | content = re.sub('\nMODULES=(.*)', f'\nMODULES=({" ".join(self._modules)})', content) |
@@ -963,10 +924,6 @@ def minimal_installation( |
963 | 924 | info(f'Running post-installation hook: {function}') |
964 | 925 | function(self) |
965 | 926 |
|
966 | | - for plugin in plugins.values(): |
967 | | - if hasattr(plugin, 'on_install'): |
968 | | - plugin.on_install(self) |
969 | | - |
970 | 927 | def setup_btrfs_snapshot( |
971 | 928 | self, |
972 | 929 | snapshot_type: SnapshotType, |
@@ -1812,14 +1769,6 @@ def add_bootloader(self, bootloader: Bootloader, uki_enabled: bool = False, boot |
1812 | 1769 | :param uki_enabled: Whether to use unified kernel images |
1813 | 1770 | :param bootloader_removable: Whether to install to removable media location (UEFI only, for GRUB and Limine) |
1814 | 1771 | """ |
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 | | - |
1823 | 1772 | efi_partition = self._get_efi_partition() |
1824 | 1773 | boot_partition = self._get_boot_partition() |
1825 | 1774 | root = self._get_root() |
@@ -1902,33 +1851,19 @@ def create_users(self, users: User | list[User]) -> None: |
1902 | 1851 | self._create_user(user) |
1903 | 1852 |
|
1904 | 1853 | 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}') |
1915 | 1855 |
|
1916 | | - cmd = 'useradd -m' |
| 1856 | + cmd = 'useradd -m' |
1917 | 1857 |
|
1918 | | - if user.sudo: |
1919 | | - cmd += ' -G wheel' |
| 1858 | + if user.sudo: |
| 1859 | + cmd += ' -G wheel' |
1920 | 1860 |
|
1921 | | - cmd += f' {user.username}' |
| 1861 | + cmd += f' {user.username}' |
1922 | 1862 |
|
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}') |
1932 | 1867 |
|
1933 | 1868 | self.set_user_password(user) |
1934 | 1869 |
|
|
0 commit comments