resolv revision 100280
166830Sobrien#!/bin/sh 266830Sobrien# 366830Sobrien# Copyright (c) 1999 Matt Dillon 466830Sobrien# All rights reserved. 566830Sobrien# 666830Sobrien# Redistribution and use in source and binary forms, with or without 766830Sobrien# modification, are permitted provided that the following conditions 866830Sobrien# are met: 966830Sobrien# 1. Redistributions of source code must retain the above copyright 1066830Sobrien# notice, this list of conditions and the following disclaimer. 1166830Sobrien# 2. Redistributions in binary form must reproduce the above copyright 1266830Sobrien# notice, this list of conditions and the following disclaimer in the 1366830Sobrien# documentation and/or other materials provided with the distribution. 1466830Sobrien# 1566830Sobrien# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1666830Sobrien# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1766830Sobrien# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1866830Sobrien# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1966830Sobrien# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2066830Sobrien# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2166830Sobrien# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2266830Sobrien# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2366830Sobrien# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2466830Sobrien# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25100280Sgordon# SUCH DAMAGE. 2651231Ssheldonh# 2766830Sobrien# $FreeBSD: head/etc/rc.d/resolv 100280 2002-07-18 05:00:17Z gordon $ 2866830Sobrien# 2943803Sdillon 3043803Sdillon# PROVIDE: diskless 3143803Sdillon# REQUIRE: initdiskless mountcritlocal 3276409Sbsd# BEFORE: addswap random 3376409Sbsd# KEYWORD: FreeBSD 3475931Simp 3576409Sbsddlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` 3676409Sbsd[ ${dlv:=0} -eq 0 ] && exit 0 3776409Sbsd 3876409Sbsdname="diskless2" 3976409Sbsd 4076409Sbsd# Provide a function for normalizing the mounting of memory 4176409Sbsd# filesystems. This should allow the rest of the code here to remain 4276409Sbsd# as close as possible between 5-current and 4-stable. 4375931Simp# $1 = size 4475931Simp# $2 = mount point 4576409Sbsd# $3 = md unit number (ignored in pre 5.0 systems) 4675931Simp# $4 = (optional) bytes-per-inode 4775931Simpmount_md() 4875931Simp{ 4943803Sdillon if [ -n "$4" ]; then 5043803Sdillon bpi="-i $4" 5151231Ssheldonh fi 5243849Sjkh /sbin/mdconfig -a -t malloc -s $1 -u $3 5359674Ssheldonh /sbin/disklabel -r -w md$3 auto 5451231Ssheldonh /sbin/newfs $bpi /dev/md$3c 5543849Sjkh /sbin/mount /dev/md$3c $2 5643803Sdillon} 5743803Sdillon 5877575Sru# If there is a global system configuration file, suck it in. 5991074Sobrien# 6075898Simpif [ -r /etc/rc.subr ]; then 6175898Simp . /etc/rc.subr 6275898Simp load_rc_config $name 63100280Sgordonelif [ -r /etc/defaults/rc.conf ]; then 64100280Sgordon . /etc/defaults/rc.conf 65100280Sgordon source_rc_confs 66100280Sgordonelif [ -r /etc/rc.conf ]; then 67100280Sgordon . /etc/rc.conf 68100280Sgordonfi 69100280Sgordon 7075898Simpecho "+++ mount_md of /var" 7175898Simpmount_md ${varsize:=32m} /var 1 7275898Simp 7375898Simpecho "+++ populate /var using /etc/mtree/BSD.var.dist" 7475898Simp/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var 7575898Simpcase ${sendmail_enable} in 7685062Sbsdecho "+++ create log files based on the contents of /etc/newsyslog.conf" 7785062SbsdLOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } ' /etc/newsyslog.conf` 7885062Sbsdif [ -n "$LOGFILES" ]; then 7975898Simp /usr/bin/touch $LOGFILES 8075898Simpfi 8175898Simp 8291105Sobrienecho "+++ create lastlog" 8391105Sobrien/usr/bin/touch /var/log/lastlog 8491105Sobrien 8591785Sobrienmount -a # chown and chgrp are in /usr 8691105Sobrien 8755520Sluigi# Since we are starting with a very fresh /etc on an MFS: 8855520Sluigiif [ -d /conf/default/etc ]; then 8955520Sluigi newaliases 9043803Sdillonfi 9176409Sbsd 9243803Sdillon# 9388497Srwatson# XXX make sure to create one dir for each printer as requested by lpd 9488497Srwatson# 9588497Srwatson 9688497Srwatson# If /tmp is a symlink, assume it points to somewhere writable, like 9776409Sbsd# /var/tmp, otherwise, use a small memory filesystem for /tmp. 9891074Sobrien# 9987010Srwatson# XXX: mtree runs too early to create any directories needed in /tmp, 10076409Sbsd# so if /var/tmp == /tmp, then you don't get a vi.recover. 10176409Sbsd# 10276193Sphkif [ ! -h /tmp ]; then 10376193Sphk mount_md ${tmpsize:=64m} /tmp 2 10476193Sphk chmod 01777 /tmp 10576193Sphkfi 10676193Sphk 10776193Sphkif sysctl vfs.devfs.generation > /dev/null 2>&1 ; then 10876409Sbsd # we have DEVFS, no worries... 10976193Sphk true 11076193Sphkelse 11143803Sdillon # extract a list of device entries, then copy them to a writable fs 11243803Sdillon (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp 11343803Sdillon mount_md 4096 /dev 3 512 11443803Sdillon (cd /; cpio -i -H newc -d < /tmp/dev.tmp) 11543803Sdillonfi 116