From 4971c4da3ac1934d5c50e22ae23837c0a07bd631 Mon Sep 17 00:00:00 2001 From: Chris Pressey Date: Thu, 11 Nov 2004 20:30:05 +0000 Subject: [PATCH] Add various improvements to the "pre-flight installer": - Add pfi_autologin variable. If set to a valid username, the installation medium boot process will automatically log in as that user. Defaults to "NONE". - Add pfi_shutdown_command variable. This can be set to the desired command used to shut down the system when the installer finishes doing its thing. Defaults to "shutdown -h now". - Launch thttpd on boot if pfi_frontend="cgi". In combination, these three settings allow completely headless (no monitor, no keyboard) operation of the installer independent of a serial connection (i.e. over the network.) - Have the pfi_sshd_permit_root_login variable honour "without-password" and "forced-commands-only" settings. [1] [1] Submitted by: geekgod --- nrelease/installer/etc/defaults/pfi.conf | 18 +++++++++++++-- nrelease/installer/etc/rc.d/pfi | 27 ++++++++++++++++++++-- nrelease/installer/usr/local/bin/installer | 8 +++---- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/nrelease/installer/etc/defaults/pfi.conf b/nrelease/installer/etc/defaults/pfi.conf index 7d2e3f7f54..729cec47c1 100644 --- a/nrelease/installer/etc/defaults/pfi.conf +++ b/nrelease/installer/etc/defaults/pfi.conf @@ -1,6 +1,6 @@ ####################################################################### -# $Id: pfi.conf,v 1.2 2004/07/10 21:52:27 cpressey Exp $ -# $DragonFly: src/nrelease/installer/etc/defaults/pfi.conf,v 1.2 2004/07/11 01:55:28 cpressey Exp $ +# $Id: pfi.conf,v 1.2 2004/08/04 17:53:50 cpressey Exp $ +# $DragonFly: src/nrelease/installer/etc/defaults/pfi.conf,v 1.3 2004/11/11 20:30:05 cpressey Exp $ # Defaults for pfi.conf. # A space-seperated list of what services to restart when we are done @@ -43,6 +43,16 @@ pfi_run="" pfi_dfui_transport="tcp" +# User to automatically log in as, or "NONE". + +pfi_autologin="NONE" + +# Command to use to reboot. "shutdown -h now" is typically used +# interactively, to give the user a chance to eject the disk, but +# "shutdown -r now" can be used for headless operation. + +pfi_shutdown_command="shutdown -h now" + ####################################################################### # EXAMPLES # To use one of these examples, extract it to a text file and remove the @@ -65,6 +75,8 @@ pfi_dfui_transport="tcp" # ifconfig_dc0="DHCP" # pfi_rc_actions="netif dhclient" # pfi_frontend="cgi" +# pfi_autologin="installer" +# pfi_shutdown_command="shutdown -r now" # EXAMPLE 2: # Boot the installer headless, configure the network interface rl0, @@ -75,3 +87,5 @@ pfi_dfui_transport="tcp" # pfi_set_root_password="sekrit" # pfi_rc_actions="netif dhclient sshd" # pfi_frontend="none" +# pfi_autologin="installer" +# pfi_shutdown_command="shutdown -r now" diff --git a/nrelease/installer/etc/rc.d/pfi b/nrelease/installer/etc/rc.d/pfi index bd98372e7b..9eba3d303c 100755 --- a/nrelease/installer/etc/rc.d/pfi +++ b/nrelease/installer/etc/rc.d/pfi @@ -1,6 +1,7 @@ #!/bin/sh -# $DragonFly: src/nrelease/installer/etc/rc.d/pfi,v 1.2 2004/07/11 18:55:20 cpressey Exp $ +# $Id: pfi,v 1.4 2004/08/06 23:26:05 cpressey Exp $ +# $DragonFly: src/nrelease/installer/etc/rc.d/pfi,v 1.3 2004/11/11 20:30:05 cpressey Exp $ # # PROVIDE: pfi @@ -109,6 +110,12 @@ pfi_start() YES) echo "PermitRootLogin yes" >> /etc/ssh/sshd_config ;; + without-password) + echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config + ;; + forced-commands-only) + echo "PermitRootLogin forced-commands-only" >> /etc/ssh/sshd_config + ;; *) ;; esac @@ -129,7 +136,7 @@ pfi_start() /usr/sbin/pw usermod root -h 0 fi - # Lastly, the most important pre-install task is to restart + # The most important pre-install task is to restart # any RCNG scripts listed in pfi_rc_actions with any new # settings that might have been set up by pfi.conf. @@ -152,6 +159,22 @@ pfi_start() awk '$1=="#@@@@@" || cut { cut = 1 } !cut { print $0 }' \ /etc/rc.conf.new mv /etc/rc.conf.new /etc/rc.conf + + # Set up auto-login if requested. + + if [ "X$pfi_autologin" != "XNONE" ]; then + echo 'autologin|al.9600:\' >> /etc/gettytab + echo " :al=${pfi_autologin}:tc=std.9600:" >> /etc/gettytab + sed -i '' 's/^ttyv0=.*/ttyv0 "/usr/libexec/getty Al" cons25 on secure/' /etc/ttys + fi + + # Finally, start thttpd if the user wants to use + # the cgi frontend. + + if [ "X$pfi_frontend" = "Xcgi" ]; then + echo "Starting thttpd..." + /usr/local/sbin/thttpd_wrapper & + fi } load_rc_config $name diff --git a/nrelease/installer/usr/local/bin/installer b/nrelease/installer/usr/local/bin/installer index a947b317d0..462a1a33c7 100755 --- a/nrelease/installer/usr/local/bin/installer +++ b/nrelease/installer/usr/local/bin/installer @@ -1,8 +1,8 @@ #!/bin/sh # installer - start installer frontend and backend as per pfi config. -# $Id: installer,v 1.10 2004/07/11 16:00:01 cpressey Exp $ -# $DragonFly: src/nrelease/installer/usr/local/bin/installer,v 1.5 2004/07/11 19:36:03 dillon Exp $ +# $Id: installer,v 1.5 2004/08/11 19:37:07 cpressey Exp $ +# $DragonFly: src/nrelease/installer/usr/local/bin/installer,v 1.6 2004/11/11 20:30:05 cpressey Exp $ ### SUBS ### @@ -17,7 +17,7 @@ background_backend() 0) ;; 5) - shutdown -h now + $pfi_shutdown_command ;; *) ;; @@ -118,7 +118,7 @@ installer_start() 0) ;; 5) - shutdown -h now + $pfi_shutdown_command ;; *) ;; -- 2.35.2