@@ -1004,27 +1004,19 @@ def setup_btrfs_snapshot(
10041004 self ._configure_grub_btrfsd (snapshot_type )
10051005 self .enable_service ('grub-btrfsd.service' )
10061006
1007- def setup_swap (self , kind : str = 'zram' , algo : ZramAlgorithm = ZramAlgorithm .ZSTD ) -> None :
1008- if kind == 'zram' :
1009- info ('Setting up swap on zram' )
1010- self .pacman .strap ('zram-generator' )
1011- # Get RAM size in MB from hardware info
1012- ram_kb = SysInfo .mem_total ()
1013- # Convert KB to MB and divide by 2, with minimum of 4096 MB
1014- size_mb = max (ram_kb // 2048 , 4096 )
1015- info (f'Zram size: { size_mb } from RAM: { ram_kb } ' )
1016- info (f'Zram compression algorithm: { algo .value } ' )
1017-
1018- with open (f'{ self .target } /etc/systemd/zram-generator.conf' , 'w' ) as zram_conf :
1019- zram_conf .write ('[zram0]\n ' )
1020- zram_conf .write (f'zram-size = { size_mb } \n ' )
1021- zram_conf .write (f'compression-algorithm = { algo .value } \n ' )
1022-
1023- self .enable_service ('systemd-zram-setup@zram0.service' )
1024-
1025- self ._zram_enabled = True
1026- else :
1027- raise ValueError ('Archinstall currently only supports setting up swap on zram' )
1007+ def setup_swap (self , algo : ZramAlgorithm = ZramAlgorithm .ZSTD ) -> None :
1008+ info ('Setting up swap on zram' )
1009+ self .pacman .strap ('zram-generator' )
1010+
1011+ info (f'Zram compression algorithm: { algo .value } ' )
1012+
1013+ with open (f'{ self .target } /etc/systemd/zram-generator.conf' , 'w' ) as zram_conf :
1014+ zram_conf .write ('[zram0]\n ' )
1015+ zram_conf .write (f'compression-algorithm = { algo .value } \n ' )
1016+
1017+ self .enable_service ('systemd-zram-setup@zram0.service' )
1018+
1019+ self ._zram_enabled = True
10281020
10291021 def _get_efi_partition (self ) -> PartitionModification | None :
10301022 for layout in self ._disk_config .device_modifications :
0 commit comments