diff --git a/setup.py b/setup.py index a0ffc4a..3acaa05 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/initial_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/initial_setup b/src/initial_setup new file mode 100755 index 0000000..4b8538c --- /dev/null +++ b/src/initial_setup @@ -0,0 +1,36 @@ +#!/bin/sh +# +# PROVIDE: initial_setup +# REQUIRE: LOGIN FILESYSTEMS +# BEFORE: lightdm +# KEYWORD: shutdown + +. /etc/rc.subr + +name="initial_setup" +rcvar="${name}_enable" +start_cmd="${name}_start" +stop_cmd=":" + +initial_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 initial_setup_enable=NO +} + +load_rc_config $name +run_rc_command "$1"