3 # $DragonFly: src/nrelease/installer/etc/rc.d/pfi,v 1.2 2004/07/11 18:55:20 cpressey Exp $
7 # REQUIRE: mountoptional
18 [ -r /etc/pfi.conf ] && return 0
20 if [ -r $1/pfi.conf ]; then
22 tr -d "\r" < $1/pfi.conf > /etc/pfi.conf
23 echo "pfi_found_on_device='$2'" >> /etc/pfi.conf
24 echo "#@@@@@" >>/etc/rc.conf
25 cat /etc/pfi.conf >>/etc/rc.conf
26 if [ -r /etc/defaults/pfi.conf ]; then
27 . /etc/defaults/pfi.conf
30 if [ "$pfi_script" != "" -a -x "$1/$pfi_script" ]; then
39 look_for_pfi_config_msdos()
41 [ -r /etc/pfi.conf ] && return 0
43 for try_device in da0s1 da1s1 fd0 fd1; do
44 echo -n "Looking for pfi.conf on /dev/${try_device}..."
45 if [ ! -e /dev/${try_device} ]; then
46 ( cd /dev && ./MAKEDEV ${try_device} )
48 if mount_msdos -o rdonly /dev/$try_device /mnt ; then
49 echo -n " /dev/$try_device ok..."
50 if get_pfi_config /mnt /dev/$try_device; then
61 look_for_pfi_config_cd9660()
63 [ -r /etc/pfi.conf ] && return 0
65 for try_device in acd0c; do
66 echo -n "Looking for pfi.conf on /dev/${try_device}..."
67 if [ ! -e /dev/${try_device} ]; then
68 ( cd /dev && ./MAKEDEV ${try_device} )
70 if mount_cd9660 /dev/$try_device /mnt ; then
71 echo -n " /dev/$try_device ok..."
72 if get_pfi_config /mnt /dev/$try_device; then
85 echo "Starting pfi..."
87 # Get the pfi.conf file off the pfi media and into /etc/pfi.conf.
89 look_for_pfi_config_cd9660
90 look_for_pfi_config_msdos
92 if [ ! -r /etc/pfi.conf ]; then
93 echo '' >/etc/pfi.conf
96 if [ -r /etc/defaults/pfi.conf ]; then
97 . /etc/defaults/pfi.conf
101 # We can perform any pre-install tasks here by
102 # examining the contents of pfi_* variables.
104 # Interpret pfi_sshd_* options. These basically add settings
105 # to /etc/ssh/sshd_config; it is assumed "sshd" will appear
106 # in pfi_rc_actions to restart sshd.
108 case ${pfi_sshd_permit_root_login} in
110 echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
116 case ${pfi_sshd_permit_empty_passwords} in
118 echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
124 # Interpret pfi_set_root_password. If it is not empty, use
125 # it to set root's LiveCD password.
127 if [ "X$pfi_set_root_password" != "X" ]; then
128 echo "$pfi_set_root_password" | \
129 /usr/sbin/pw usermod root -h 0
132 # Lastly, the most important pre-install task is to restart
133 # any RCNG scripts listed in pfi_rc_actions with any new
134 # settings that might have been set up by pfi.conf.
136 if [ "X$pfi_rc_actions" != "X" ]; then
137 rev_actions=`reverse_list $pfi_rc_actions`
139 for _rc_elem in ${rev_actions}; do
140 echo "Stopping ${_rc_elem}..."
143 for _rc_elem in ${pfi_rc_actions}; do
144 echo "Starting ${_rc_elem}..."
149 # Now remove the copy of pfi.conf that we tacked onto
150 # the end of rc.conf so the above would work
152 awk '$1=="#@@@@@" || cut { cut = 1 } !cut { print $0 }' \
153 </etc/rc.conf >/etc/rc.conf.new
154 mv /etc/rc.conf.new /etc/rc.conf