Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions install_station/create_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,11 @@ def create_cfg(cls):
f.write("runCommand=pw userdel -n ghostbsd -r\n")
f.write("runCommand=sed -i '' 's/ghostbsd/root/g' /etc/gettytab\n")
f.write("runCommand=sed -i '' 's/ghostbsd/root/g' /etc/ttys\n")
f.write("runCommand=echo '# WARNING: Do NOT set initial_setup_enable=YES manually!' >> /etc/rc.conf\n")
f.write("runCommand=echo '# This service is ONLY for first boot after installation.' >> /etc/rc.conf\n")
f.write("runCommand=echo '# It will automatically disable itself after running.' >> /etc/rc.conf\n")
f.write("runCommand=sysrc initial_setup_enable=YES\n")
f.write("runCommand=sed -i '' '/^autologin-user=/d' /usr/local/etc/lightdm/lightdm.conf\n")
f.write("runCommand=sed -i '' '/^autologin-session=/d' /usr/local/etc/lightdm/lightdm.conf\n")
except IOError as e:
raise IOError(f"Failed to write configuration file: {e}") from e
2 changes: 1 addition & 1 deletion install_station/interface_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,4 @@ def back_page(cls, _widget: Gtk.Button) -> None:
current_page_widget = cls.page.get_nth_page(cls.page.get_current_page())
title_text = cls.page.get_tab_label_text(current_page_widget)
Window.set_title(title_text)
# Button.next_button.set_sensitive(True)
Button.next_button.set_sensitive(True)
5 changes: 3 additions & 2 deletions install_station/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from time import sleep
from subprocess import Popen, PIPE, STDOUT, call
from install_station.data import query, zfs_datasets, InstallationData
from install_station.system_calls import get_ram_size_mb

# Define required file paths

Expand Down Expand Up @@ -779,7 +780,7 @@ def create_mbr_partiton(self, drive, size, path, fs):
InstallationData.slice = main_slice.replace(drive, "")

root_size = int(main_size)
swap_size = 2048
swap_size = get_ram_size_mb()
root_size -= swap_size

part_list = disk_db[drive]['partitions'][main_slice]['partition-list']
Expand Down Expand Up @@ -861,7 +862,7 @@ def create_gpt_partiton(self, drive, size, path, fs, efi_exist):
InstallationData.disk = drive
InstallationData.scheme = 'partscheme=GPT'
root_size = int(main_size)
swap_size = 2048
swap_size = get_ram_size_mb()
root_size -= int(swap_size)
if self.bios_type == "UEFI" and efi_exist is False:
boot_size = 256
Expand Down
15 changes: 15 additions & 0 deletions install_station/system_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,21 @@ def timezone_dictionary() -> dict[str, list[str]]:
return dictionary


def get_ram_size_mb() -> int:
"""Query the system RAM size in megabytes using sysctl.

Returns:
System RAM size in MB
"""
output = Popen(
'sysctl -n hw.realmem',
shell=True,
stdout=PIPE,
universal_newlines=True
).stdout.read().strip()
return int(output) // 1048576
Comment thread
sourcery-ai[bot] marked this conversation as resolved.


def zfs_disk_query() -> list[str]:
"""Query available disks for ZFS installation.

Expand Down
Loading