index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | archinstall/lib/installer.py | 24 |
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 11a0f24e..b400e741 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -6,7 +6,7 @@ import shlex import pathlib import subprocess import glob -from .disk import get_partitions_in_use, Partition, find_partition +from .disk import get_partitions_in_use, Partition, find_partition_by_mountpoint from .general import SysCommand from .hardware import has_uefi, is_vm, cpu_vendor from .locale_helpers import verify_keyboard_layout, verify_x11_keyboard_layout @@ -14,7 +14,6 @@ from .disk.helpers import get_mount_info from .mirrors import use_mirrors from .plugins import plugins from .storage import storage -from .systemd import Boot # from .user_interaction import * from .output import log from .profiles import Profile @@ -270,6 +269,7 @@ class Installer: fh.write("NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org\n") fh.write("FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 0.fr.pool.ntp.org\n") + from .systemd import Boot with Boot(self) as session: session.SysCommand(["timedatectl", "set-ntp", 'true']) @@ -463,6 +463,22 @@ class Installer: return True + def setup_swap(self, kind='zram'): + if kind == 'zram': + self.log(f"Setting up swap on zram") + self.pacstrap('zram-generator') + + # We could use the default example below, but maybe not the best idea: https://github.com/archlinux/archinstall/pull/678#issuecomment-962124813 + # zram_example_location = '/usr/share/doc/zram-generator/zram-generator.conf.example' + # shutil.copy2(f"{self.target}{zram_example_location}", f"{self.target}/usr/lib/systemd/zram-generator.conf") + with open(f"{self.target}/etc/systemd/zram-generator.conf", "w") as zram_conf: + zram_conf.write("[zram0]\n") + + if self.enable_service('systemd-zram-setup@zram0.service'): + return True + else: + raise ValueError(f"Archinstall currently only supports setting up swap on zram") + def add_bootloader(self, bootloader='systemd-bootctl'): for plugin in plugins.values(): if hasattr(plugin, 'on_add_bootloader'): @@ -575,7 +591,7 @@ class Installer: self.helper_flags['bootloader'] = True return True else: - boot_partition = find_partition(mountpoint=f"{self.target}/boot") + boot_partition = find_partition_by_mountpoint(self.partitions, relative_mountpoint=f"/boot") SysCommand(f'/usr/bin/arch-chroot {self.target} grub-install --target=i386-pc --recheck {boot_partition.path}') SysCommand(f'/usr/bin/arch-chroot {self.target} grub-mkconfig -o /boot/grub/grub.cfg') self.helper_flags['bootloader'] = True @@ -651,7 +667,6 @@ class Installer: # In accordance with https://github.com/archlinux/archinstall/issues/107#issuecomment-841701968 # Setting an empty keymap first, allows the subsequent call to set layout for both console and x11. from .systemd import Boot - with Boot(self) as session: session.SysCommand(["localectl", "set-keymap", '""']) @@ -675,7 +690,6 @@ class Installer: return False from .systemd import Boot - with Boot(self) as session: session.SysCommand(["localectl", "set-x11-keymap", '""']) |