3 # $Id: pfi,v 1.4 2004/08/06 23:26:05 cpressey Exp $
4 # $DragonFly: src/nrelease/installer/etc/rc.d/pfi,v 1.5 2005/03/07 17:44:40 cpressey Exp $
8 # REQUIRE: mountoptional
19 [ -r /etc/pfi.conf ] && return 0
21 if [ -r $1/pfi.conf ]; then
23 tr -d "\r" < $1/pfi.conf > /etc/pfi.conf
24 echo "pfi_found_on_device='$2'" >> /etc/pfi.conf
25 if [ -r /etc/defaults/pfi.conf ]; then
26 . /etc/defaults/pfi.conf
29 if [ "$pfi_script" != "" -a -x "$1/$pfi_script" ]; then
38 look_for_pfi_config_msdos()
40 [ -r /etc/pfi.conf ] && return 0
42 for try_device in da0s1 da1s1 fd0 fd1; do
43 echo -n "Looking for pfi.conf on /dev/${try_device}..."
44 if [ ! -e /dev/${try_device} ]; then
45 ( cd /dev && ./MAKEDEV ${try_device} )
47 if mount_msdos -o rdonly /dev/$try_device /mnt ; then
48 echo -n " /dev/$try_device ok..."
49 if get_pfi_config /mnt /dev/$try_device; then
60 look_for_pfi_config_cd9660()
62 [ -r /etc/pfi.conf ] && return 0
64 for try_device in acd0c; do
65 echo -n "Looking for pfi.conf on /dev/${try_device}..."
66 if [ ! -e /dev/${try_device} ]; then
67 ( cd /dev && ./MAKEDEV ${try_device} )
69 if mount_cd9660 /dev/$try_device /mnt ; then
70 echo -n " /dev/$try_device ok..."
71 if get_pfi_config /mnt /dev/$try_device; then
84 echo "Starting pfi..."
86 # Get the pfi.conf file off the pfi media and into /etc/pfi.conf.
88 look_for_pfi_config_cd9660
89 look_for_pfi_config_msdos
91 if [ ! -r /etc/pfi.conf ]; then
92 echo '' >/etc/pfi.conf
95 # Tack pfi.conf onto the end of rc.conf, so that variables in
96 # pfi.conf are available to the rc subsystem (for pfi_rc_actions.)
98 cp /etc/rc.conf /etc/rc.conf.orig
99 cat /etc/pfi.conf >>/etc/rc.conf
101 if [ -r /etc/defaults/pfi.conf ]; then
102 . /etc/defaults/pfi.conf
106 # We can perform any pre-install tasks here by
107 # examining the contents of pfi_* variables.
109 # Interpret pfi_sshd_* options. These basically add settings
110 # to /etc/ssh/sshd_config; it is assumed "sshd" will appear
111 # in pfi_rc_actions to restart sshd.
113 case ${pfi_sshd_permit_root_login} in
115 echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
118 echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
120 forced-commands-only)
121 echo "PermitRootLogin forced-commands-only" >> /etc/ssh/sshd_config
127 case ${pfi_sshd_permit_empty_passwords} in
129 echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
135 # Interpret pfi_set_root_password. If it is not empty, use
136 # it to set root's LiveCD password.
138 if [ "X$pfi_set_root_password" != "X" ]; then
139 echo "$pfi_set_root_password" | \
140 /usr/sbin/pw usermod root -h 0
143 # The most important pre-install task is to restart
144 # any RCNG scripts listed in pfi_rc_actions with any new
145 # settings that might have been set up by pfi.conf.
147 if [ "X$pfi_rc_actions" != "X" ]; then
148 rev_actions=`reverse_list $pfi_rc_actions`
150 for _rc_elem in ${rev_actions}; do
151 echo "Stopping ${_rc_elem}..."
154 for _rc_elem in ${pfi_rc_actions}; do
155 echo "Starting ${_rc_elem}..."
160 # Restore the original rc.conf.
162 mv /etc/rc.conf.orig /etc/rc.conf
164 # Set up auto-login if requested.
166 if [ "X$pfi_autologin" != "XNONE" ]; then
167 echo 'AL.pfi:\' >> /etc/gettytab
168 echo " :al=${pfi_autologin}:tc=Pc:" >> /etc/gettytab
169 sed -i '' 's|^ttyv0.*|ttyv0 "/usr/libexec/getty AL.pfi" cons25 on secure|' /etc/ttys
172 # Finally, start thttpd if the user wants to use
175 if [ "X$pfi_frontend" = "Xcgi" ]; then
176 echo "Starting thttpd..."
177 /usr/local/sbin/thttpd_wrapper &