From 123a3ac115dccf17f0846e92d8ab2223d84726ff Mon Sep 17 00:00:00 2001 From: ericbsd Date: Fri, 19 Dec 2025 17:57:53 -0400 Subject: [PATCH 1/2] Replace autologin shrc approach with rc.d service Instead of using autologin with shrc to run the setup, implement a cleaner rc.d service that handles the setup-to-lightdm transition. The setup app now exits cleanly via Gtk.main_quit() and lets the rc.d service continue boot. - Bump version from 0.1 to 0.3 - Add ghostbsd_setup rc.d script installation - Replace direct lightdm startup with Gtk.main_quit() - Remove start_lightdm import and call --- setup.py | 5 +++-- setup_station/setup_system.py | 12 ++++-------- src/ghostbsd_setup | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 10 deletions(-) create mode 100755 src/ghostbsd_setup diff --git a/setup.py b/setup.py index a0ffc4a..a13229f 100755 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ from DistUtilsExtra.command.clean_i18n import clean_i18n prefix = sys.prefix -__VERSION__ = '0.1' +__VERSION__ = '0.3' PROGRAM_VERSION = __VERSION__ @@ -142,7 +142,8 @@ def run(self): data_files = [ (f'{prefix}/lib/setup-station', ['src/ghostbsd-style.css']), (f'{prefix}/lib/setup-station/image', lib_setup_station_image), - (f'{prefix}/share/applications', ['src/setup-station.desktop']) + (f'{prefix}/share/applications', ['src/setup-station.desktop']), + (f'{prefix}/etc/rc.d', ['src/ghostbsd_setup']) ] # Add locale files if they exist diff --git a/setup_station/setup_system.py b/setup_station/setup_system.py index 5ef6e44..0bbb22c 100644 --- a/setup_station/setup_system.py +++ b/setup_station/setup_system.py @@ -39,8 +39,7 @@ def setup_system(progress_bar: Gtk.ProgressBar) -> None: from setup_station.add_admin import AddAdminUser from setup_station.system_calls import ( enable_lightdm, - remove_ghostbsd_autologin, - start_lightdm + remove_ghostbsd_autologin ) # Step 0/6: Setting system language @@ -77,7 +76,7 @@ def setup_system(progress_bar: Gtk.ProgressBar) -> None: GLib.idle_add(update_progress, progress_bar, 1, get_text("Setup complete!")) sleep(1) - # Update label text before starting lightdm + # Update label text before exiting def update_label(): SetupWindow.slide_text.set_markup( get_text("Configuration complete.") + @@ -88,11 +87,8 @@ def update_label(): GLib.idle_add(update_label) sleep(2) - # Start lightdm and exit - start_lightdm() - - import sys - sys.exit(0) + # Quit GTK main loop - X will exit and rc.d service will continue boot to lightdm + GLib.idle_add(Gtk.main_quit) class SetupWindow: diff --git a/src/ghostbsd_setup b/src/ghostbsd_setup new file mode 100755 index 0000000..cd6a7f0 --- /dev/null +++ b/src/ghostbsd_setup @@ -0,0 +1,36 @@ +#!/bin/sh +# +# PROVIDE: ghostbsd_setup +# REQUIRE: LOGIN FILESYSTEMS +# BEFORE: lightdm +# KEYWORD: shutdown + +. /etc/rc.subr + +name="ghostbsd_setup" +rcvar="${name}_enable" +start_cmd="${name}_start" +stop_cmd=":" + +ghostbsd_setup_start() +{ + # Create .xinitrc for root to run setup + cat > /root/.xinitrc <<'EOF' +exec marco & +exec feh --bg-fill /usr/local/share/backgrounds/ghostbsd/blue-layered-stripes.jpg & +exec setup-station-init +EOF + chmod 755 /root/.xinitrc + + # Start X as root - this will block until setup-station-init exits + su -l root -c "startx -- :0 vt09" + + # Cleanup + rm -f /root/.xinitrc + + # Disable this service for future boots + sysrc ghostbsd_setup_enable=NO +} + +load_rc_config $name +run_rc_command "$1" From 3dc6750b6f9640e552c2b2ff7ce7dab576bfaf3c Mon Sep 17 00:00:00 2001 From: ericbsd Date: Sun, 21 Dec 2025 20:12:24 -0400 Subject: [PATCH 2/2] rename ghostbsd_setup to initial_setup --- setup.py | 2 +- src/{ghostbsd_setup => initial_setup} | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/{ghostbsd_setup => initial_setup} (85%) diff --git a/setup.py b/setup.py index a13229f..3acaa05 100755 --- a/setup.py +++ b/setup.py @@ -143,7 +143,7 @@ def run(self): (f'{prefix}/lib/setup-station', ['src/ghostbsd-style.css']), (f'{prefix}/lib/setup-station/image', lib_setup_station_image), (f'{prefix}/share/applications', ['src/setup-station.desktop']), - (f'{prefix}/etc/rc.d', ['src/ghostbsd_setup']) + (f'{prefix}/etc/rc.d', ['src/initial_setup']) ] # Add locale files if they exist diff --git a/src/ghostbsd_setup b/src/initial_setup similarity index 85% rename from src/ghostbsd_setup rename to src/initial_setup index cd6a7f0..4b8538c 100755 --- a/src/ghostbsd_setup +++ b/src/initial_setup @@ -1,18 +1,18 @@ #!/bin/sh # -# PROVIDE: ghostbsd_setup +# PROVIDE: initial_setup # REQUIRE: LOGIN FILESYSTEMS # BEFORE: lightdm # KEYWORD: shutdown . /etc/rc.subr -name="ghostbsd_setup" +name="initial_setup" rcvar="${name}_enable" start_cmd="${name}_start" stop_cmd=":" -ghostbsd_setup_start() +initial_setup_start() { # Create .xinitrc for root to run setup cat > /root/.xinitrc <<'EOF' @@ -29,7 +29,7 @@ EOF rm -f /root/.xinitrc # Disable this service for future boots - sysrc ghostbsd_setup_enable=NO + sysrc initial_setup_enable=NO } load_rc_config $name