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.3 2004/11/11 20:30:05 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 echo "#@@@@@" >>/etc/rc.conf
26 cat /etc/pfi.conf >>/etc/rc.conf
27 if [ -r /etc/defaults/pfi.conf ]; then
28 . /etc/defaults/pfi.conf
31 if [ "$pfi_script" != "" -a -x "$1/$pfi_script" ]; then
40 look_for_pfi_config_msdos()
42 [ -r /etc/pfi.conf ] && return 0
44 for try_device in da0s1 da1s1 fd0 fd1; do
45 echo -n "Looking for pfi.conf on /dev/${try_device}..."
46 if [ ! -e /dev/${try_device} ]; then
47 ( cd /dev && ./MAKEDEV ${try_device} )
49 if mount_msdos -o rdonly /dev/$try_device /mnt ; then
50 echo -n " /dev/$try_device ok..."
51 if get_pfi_config /mnt /dev/$try_device; then
62 look_for_pfi_config_cd9660()
64 [ -r /etc/pfi.conf ] && return 0
66 for try_device in acd0c; do
67 echo -n "Looking for pfi.conf on /dev/${try_device}..."
68 if [ ! -e /dev/${try_device} ]; then
69 ( cd /dev && ./MAKEDEV ${try_device} )
71 if mount_cd9660 /dev/$try_device /mnt ; then
72 echo -n " /dev/$try_device ok..."
73 if get_pfi_config /mnt /dev/$try_device; then
86 echo "Starting pfi..."
88 # Get the pfi.conf file off the pfi media and into /etc/pfi.conf.
90 look_for_pfi_config_cd9660
91 look_for_pfi_config_msdos
93 if [ ! -r /etc/pfi.conf ]; then
94 echo '' >/etc/pfi.conf
97 if [ -r /etc/defaults/pfi.conf ]; then
98 . /etc/defaults/pfi.conf
102 # We can perform any pre-install tasks here by
103 # examining the contents of pfi_* variables.
105 # Interpret pfi_sshd_* options. These basically add settings
106 # to /etc/ssh/sshd_config; it is assumed "sshd" will appear
107 # in pfi_rc_actions to restart sshd.
109 case ${pfi_sshd_permit_root_login} in
111 echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
114 echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
116 forced-commands-only)
117 echo "PermitRootLogin forced-commands-only" >> /etc/ssh/sshd_config
123 case ${pfi_sshd_permit_empty_passwords} in
125 echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
131 # Interpret pfi_set_root_password. If it is not empty, use
132 # it to set root's LiveCD password.
134 if [ "X$pfi_set_root_password" != "X" ]; then
135 echo "$pfi_set_root_password" | \
136 /usr/sbin/pw usermod root -h 0
139 # The most important pre-install task is to restart
140 # any RCNG scripts listed in pfi_rc_actions with any new
141 # settings that might have been set up by pfi.conf.
143 if [ "X$pfi_rc_actions" != "X" ]; then
144 rev_actions=`reverse_list $pfi_rc_actions`
146 for _rc_elem in ${rev_actions}; do
147 echo "Stopping ${_rc_elem}..."
150 for _rc_elem in ${pfi_rc_actions}; do
151 echo "Starting ${_rc_elem}..."
156 # Now remove the copy of pfi.conf that we tacked onto
157 # the end of rc.conf so the above would work
159 awk '$1=="#@@@@@" || cut { cut = 1 } !cut { print $0 }' \
160 </etc/rc.conf >/etc/rc.conf.new
161 mv /etc/rc.conf.new /etc/rc.conf
163 # Set up auto-login if requested.
165 if [ "X$pfi_autologin" != "XNONE" ]; then
166 echo 'autologin|al.9600:\' >> /etc/gettytab
167 echo " :al=${pfi_autologin}:tc=std.9600:" >> /etc/gettytab
168 sed -i '' 's/^ttyv0=.*/ttyv0 "/usr/libexec/getty Al" cons25 on secure/' /etc/ttys
171 # Finally, start thttpd if the user wants to use
174 if [ "X$pfi_frontend" = "Xcgi" ]; then
175 echo "Starting thttpd..."
176 /usr/local/sbin/thttpd_wrapper &