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:
@@ -1,7 +1,6 @@
|
|||||||
"""
|
"""
|
||||||
Contains the data class and some commonly use variables
|
Contains the data class and some commonly use variables
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import gettext
|
import gettext
|
||||||
|
|
||||||
be_name: str = "default"
|
be_name: str = "default"
|
||||||
@@ -46,8 +45,8 @@ class InstallationData:
|
|||||||
ufs_config_data: list = []
|
ufs_config_data: list = []
|
||||||
|
|
||||||
# Installation type and mode
|
# Installation type and mode
|
||||||
install_mode: str = "" # "install" or "try"
|
what_to_do: str = "" # "install" or "try"
|
||||||
filesystem_type: str = "" # "zfs", "ufs", or "custom"
|
install_type: str = "" # "zfs", "ufs", or "custom"
|
||||||
|
|
||||||
# Language and localization
|
# Language and localization
|
||||||
language: str = ""
|
language: str = ""
|
||||||
@@ -79,8 +78,8 @@ class InstallationData:
|
|||||||
cls.boot = ""
|
cls.boot = ""
|
||||||
cls.zfs_config_data = []
|
cls.zfs_config_data = []
|
||||||
cls.ufs_config_data = []
|
cls.ufs_config_data = []
|
||||||
cls.install_mode = ""
|
cls.what_to_do = ""
|
||||||
cls.filesystem_type = ""
|
cls.install_type = ""
|
||||||
cls.language = ""
|
cls.language = ""
|
||||||
cls.language_code = ""
|
cls.language_code = ""
|
||||||
cls.keyboard_layout = ""
|
cls.keyboard_layout = ""
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class InstallTypes:
|
|||||||
# Only respond to activation, not deactivation
|
# Only respond to activation, not deactivation
|
||||||
if widget.get_active():
|
if widget.get_active():
|
||||||
cls.ne = val
|
cls.ne = val
|
||||||
InstallationData.filesystem_type = val
|
InstallationData.install_type = val
|
||||||
print(f"Filesystem type selected: {val}")
|
print(f"Filesystem type selected: {val}")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -58,7 +58,7 @@ class InstallTypes:
|
|||||||
Returns:
|
Returns:
|
||||||
str: Current filesystem type ('zfs' or 'custom')
|
str: Current filesystem type ('zfs' or 'custom')
|
||||||
"""
|
"""
|
||||||
return InstallationData.filesystem_type or cls.ne
|
return InstallationData.install_type or cls.ne
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_model(cls) -> Gtk.Box:
|
def get_model(cls) -> Gtk.Box:
|
||||||
@@ -88,7 +88,7 @@ class InstallTypes:
|
|||||||
cls.vbox1.show()
|
cls.vbox1.show()
|
||||||
vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
|
vbox2 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
|
||||||
hbox1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, 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)
|
cls.vbox1.pack_start(hbox1, True, False, 0)
|
||||||
hbox1.set_halign(Gtk.Align.CENTER)
|
hbox1.set_halign(Gtk.Align.CENTER)
|
||||||
label = Gtk.Label(label=get_text("How do you want to install GhostBSD?"))
|
label = Gtk.Label(label=get_text("How do you want to install GhostBSD?"))
|
||||||
|
|||||||
@@ -208,12 +208,14 @@ class Interface:
|
|||||||
InstallationData.keyboard_variant,
|
InstallationData.keyboard_variant,
|
||||||
InstallationData.keyboard_model_code
|
InstallationData.keyboard_model_code
|
||||||
)
|
)
|
||||||
|
with open('/usr/home/ghostbsd/.xinitrc', 'w') as xinitrc:
|
||||||
# Continue to network setup for live session
|
xinitrc.writelines('gsettings set org.mate.SettingsDaemon.plugins.housekeeping active true &\n')
|
||||||
cls.next_setup_page()
|
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:
|
elif page == 4:
|
||||||
Button.show_back()
|
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 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
|
||||||
custom_box.show()
|
custom_box.show()
|
||||||
get_part = cls.custom_partition.get_model()
|
get_part = cls.custom_partition.get_model()
|
||||||
@@ -223,7 +225,7 @@ class Interface:
|
|||||||
cls.page.next_page()
|
cls.page.next_page()
|
||||||
cls.page.show_all()
|
cls.page.show_all()
|
||||||
Button.next_button.set_sensitive(False)
|
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 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
|
||||||
zfs_box.show()
|
zfs_box.show()
|
||||||
get_zfs = cls.full_zfs.get_model()
|
get_zfs = cls.full_zfs.get_model()
|
||||||
@@ -234,6 +236,11 @@ class Interface:
|
|||||||
cls.page.show_all()
|
cls.page.show_all()
|
||||||
Button.next_button.set_sensitive(False)
|
Button.next_button.set_sensitive(False)
|
||||||
elif page == 5:
|
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 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
|
||||||
boot_manager_box.show()
|
boot_manager_box.show()
|
||||||
get_root = cls.boot_manager.get_model()
|
get_root = cls.boot_manager.get_model()
|
||||||
@@ -265,28 +272,6 @@ class Interface:
|
|||||||
title_text = cls.page.get_tab_label_text(current_page_widget)
|
title_text = cls.page.get_tab_label_text(current_page_widget)
|
||||||
Window.set_title(title_text)
|
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
|
@classmethod
|
||||||
def back_page(cls, _widget: Gtk.Button) -> None:
|
def back_page(cls, _widget: Gtk.Button) -> None:
|
||||||
"""Go back to the previous window."""
|
"""Go back to the previous window."""
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class TryOrInstall:
|
|||||||
# Only respond to activation, not deactivation
|
# Only respond to activation, not deactivation
|
||||||
if widget.get_active():
|
if widget.get_active():
|
||||||
cls.what = val
|
cls.what = val
|
||||||
InstallationData.install_mode = val
|
InstallationData.what_to_do = val
|
||||||
print(f"Mode selected: {val}")
|
print(f"Mode selected: {val}")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -62,7 +62,7 @@ class TryOrInstall:
|
|||||||
Returns:
|
Returns:
|
||||||
str: Current installation mode ('install' or 'try')
|
str: Current installation mode ('install' or 'try')
|
||||||
"""
|
"""
|
||||||
return InstallationData.install_mode or cls.what
|
return InstallationData.what_to_do or cls.what
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def initialize(cls) -> None:
|
def initialize(cls) -> None:
|
||||||
@@ -78,7 +78,7 @@ class TryOrInstall:
|
|||||||
This method is called automatically by get_model() when the interface is first accessed.
|
This method is called automatically by get_model() when the interface is first accessed.
|
||||||
"""
|
"""
|
||||||
cls.what = 'install' # Default to install mode
|
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 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, homogeneous=False, spacing=0)
|
||||||
cls.vbox1.show()
|
cls.vbox1.show()
|
||||||
|
|||||||
Reference in New Issue
Block a user