From 6035e6355fef528e3a22a53dc9fb93156d8f6383 Mon Sep 17 00:00:00 2001 From: ericbsd Date: Sun, 21 Dec 2025 20:40:28 -0400 Subject: [PATCH] Add install_station service and related configuration updates --- install_station/create_cfg.py | 6 ++++++ setup.py | 3 ++- src/install_station | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 src/install_station diff --git a/install_station/create_cfg.py b/install_station/create_cfg.py index 71391ac..6220be9 100644 --- a/install_station/create_cfg.py +++ b/install_station/create_cfg.py @@ -156,5 +156,11 @@ class Configuration: 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 diff --git a/setup.py b/setup.py index d5340c2..3c6c45e 100755 --- a/setup.py +++ b/setup.py @@ -157,7 +157,8 @@ lib_install_station_backend_query = [ data_files = [ (f'{prefix}/lib/install-station', ['src/ghostbsd-style.css']), (f'{prefix}/lib/install-station/backend-query', lib_install_station_backend_query), - (f'{prefix}/lib/install-station/image', lib_install_station_image) + (f'{prefix}/lib/install-station/image', lib_install_station_image), + (f'{prefix}/etc/rc.d', ['src/install_station']) ] data_files.extend(data_file_list(f'{prefix}/share/locale', 'build/mo')) diff --git a/src/install_station b/src/install_station new file mode 100755 index 0000000..c92e336 --- /dev/null +++ b/src/install_station @@ -0,0 +1,36 @@ +#!/bin/sh +# +# PROVIDE: install_station +# REQUIRE: LOGIN FILESYSTEMS +# BEFORE: lightdm +# KEYWORD: shutdown + +. /etc/rc.subr + +name="install_station" +rcvar="${name}_enable" +start_cmd="${name}_start" +stop_cmd=":" + +install_station_start() +{ + # Create .xinitrc for root to run installer + cat > /root/.xinitrc <<'EOF' +exec marco & +exec feh --bg-fill /usr/local/share/backgrounds/ghostbsd/blue-layered-stripes.jpg & +exec install-station +EOF + chmod 755 /root/.xinitrc + + # Start X as root - this will block until install-station exits + su -l root -c "startx -- :0 vt09" + + # Cleanup + rm -f /root/.xinitrc + + # Disable this service for future boots + sysrc install_station_enable=NO +} + +load_rc_config $name +run_rc_command "$1" \ No newline at end of file