Add missing logic for .xinitrc updates in "Try Live" mode

- Renamed `install_mode` to `what_to_do` and `filesystem_type` to `install_type` across modules for clarity and consistency
- Implemented `.xinitrc` configuration updates in "Try Live" mode
- Added logic to save ZFS configuration during installation process
- Improved button handling and code readability in the interface controller
This commit is contained in:
ericbsd
2025-12-09 19:43:45 -04:00
parent f8afc8002a
commit 1507a5a456
4 changed files with 22 additions and 38 deletions
+4 -5
View File
@@ -1,7 +1,6 @@
"""
Contains the data class and some commonly use variables
"""
import os
import gettext
be_name: str = "default"
@@ -46,8 +45,8 @@ class InstallationData:
ufs_config_data: list = []
# Installation type and mode
install_mode: str = "" # "install" or "try"
filesystem_type: str = "" # "zfs", "ufs", or "custom"
what_to_do: str = "" # "install" or "try"
install_type: str = "" # "zfs", "ufs", or "custom"
# Language and localization
language: str = ""
@@ -79,8 +78,8 @@ class InstallationData:
cls.boot = ""
cls.zfs_config_data = []
cls.ufs_config_data = []
cls.install_mode = ""
cls.filesystem_type = ""
cls.what_to_do = ""
cls.install_type = ""
cls.language = ""
cls.language_code = ""
cls.keyboard_layout = ""
+3 -3
View File
@@ -48,7 +48,7 @@ class InstallTypes:
# Only respond to activation, not deactivation
if widget.get_active():
cls.ne = val
InstallationData.filesystem_type = val
InstallationData.install_type = val
print(f"Filesystem type selected: {val}")
@classmethod
@@ -58,7 +58,7 @@ class InstallTypes:
Returns:
str: Current filesystem type ('zfs' or 'custom')
"""
return InstallationData.filesystem_type or cls.ne
return InstallationData.install_type or cls.ne
@classmethod
def get_model(cls) -> Gtk.Box:
@@ -88,7 +88,7 @@ class InstallTypes:
cls.vbox1.show()
vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
hbox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, homogeneous=False, spacing=0)
InstallationData.filesystem_type = cls.ne
InstallationData.install_type = cls.ne
cls.vbox1.pack_start(hbox1, True, False, 0)
hbox1.set_halign(Gtk.Align.CENTER)
label = Gtk.Label(label=get_text("How do you want to install GhostBSD?"))
+12 -27
View File
@@ -208,12 +208,14 @@ class Interface:
InstallationData.keyboard_variant,
InstallationData.keyboard_model_code
)
# Continue to network setup for live session
cls.next_setup_page()
with open('/usr/home/ghostbsd/.xinitrc', 'w') as xinitrc:
xinitrc.writelines('gsettings set org.mate.SettingsDaemon.plugins.housekeeping active true &\n')
xinitrc.writelines('gsettings set org.mate.screensaver lock-enabled false &\n')
xinitrc.writelines('exec ck-launch-session mate-session\n')
Gtk.main_quit()
elif page == 4:
Button.show_back()
if InstallationData.filesystem_type == "custom":
if InstallationData.install_type == "custom":
custom_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
custom_box.show()
get_part = cls.custom_partition.get_model()
@@ -223,7 +225,7 @@ class Interface:
cls.page.next_page()
cls.page.show_all()
Button.next_button.set_sensitive(False)
elif InstallationData.filesystem_type == "zfs":
elif InstallationData.install_type == "zfs":
zfs_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
zfs_box.show()
get_zfs = cls.full_zfs.get_model()
@@ -234,6 +236,11 @@ class Interface:
cls.page.show_all()
Button.next_button.set_sensitive(False)
elif page == 5:
# Save ZFS configuration before proceeding
if InstallationData.install_type == "zfs":
cls.full_zfs.save_selection()
# For custom partitioning, data is already saved in InstallationData
boot_manager_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
boot_manager_box.show()
get_root = cls.boot_manager.get_model()
@@ -265,28 +272,6 @@ class Interface:
title_text = cls.page.get_tab_label_text(current_page_widget)
Window.set_title(title_text)
@classmethod
def next_setup_page(cls) -> None:
page = cls.page.get_current_page()
if page == 0:
Button.next_button.show()
Button.next_button.set_sensitive(False)
Window.set_title(get_text("Network Setup"))
net_setup_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
net_setup_box.show()
model = cls.network_setup.get_model()
net_setup_box.pack_start(model, True, True, 0)
label = Gtk.Label(label=get_text("Network Setup"))
cls.page.insert_page(net_setup_box, label, 1)
cls.page.next_page()
cls.page.show_all()
if page == 1:
with open('/usr/home/ghostbsd/.xinitrc', 'w') as xinitrc:
xinitrc.writelines('gsettings set org.mate.SettingsDaemon.plugins.housekeeping active true &\n')
xinitrc.writelines('gsettings set org.mate.screensaver lock-enabled false &\n')
xinitrc.writelines('exec ck-launch-session mate-session\n')
Gtk.main_quit()
@classmethod
def back_page(cls, _widget: Gtk.Button) -> None:
"""Go back to the previous window."""
+3 -3
View File
@@ -48,7 +48,7 @@ class TryOrInstall:
# Only respond to activation, not deactivation
if widget.get_active():
cls.what = val
InstallationData.install_mode = val
InstallationData.what_to_do = val
print(f"Mode selected: {val}")
@classmethod
@@ -62,7 +62,7 @@ class TryOrInstall:
Returns:
str: Current installation mode ('install' or 'try')
"""
return InstallationData.install_mode or cls.what
return InstallationData.what_to_do or cls.what
@classmethod
def initialize(cls) -> None:
@@ -78,7 +78,7 @@ class TryOrInstall:
This method is called automatically by get_model() when the interface is first accessed.
"""
cls.what = 'install' # Default to install mode
InstallationData.install_mode = cls.what
InstallationData.what_to_do = cls.what
cls.vbox1 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
cls.vbox1.show()