resolv revision 100280
1#!/bin/sh 2# 3# Copyright (c) 1999 Matt Dillon 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: 9# 1. Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# 2. Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# 15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# 27# $FreeBSD: head/etc/rc.d/resolv 100280 2002-07-18 05:00:17Z gordon $ 28# 29 30# PROVIDE: diskless 31# REQUIRE: initdiskless mountcritlocal 32# BEFORE: addswap random 33# KEYWORD: FreeBSD 34 35dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` 36[ ${dlv:=0} -eq 0 ] && exit 0 37 38name="diskless2" 39 40# Provide a function for normalizing the mounting of memory 41# filesystems. This should allow the rest of the code here to remain 42# as close as possible between 5-current and 4-stable. 43# $1 = size 44# $2 = mount point 45# $3 = md unit number (ignored in pre 5.0 systems) 46# $4 = (optional) bytes-per-inode 47mount_md() 48{ 49 if [ -n "$4" ]; then 50 bpi="-i $4" 51 fi 52 /sbin/mdconfig -a -t malloc -s $1 -u $3 53 /sbin/disklabel -r -w md$3 auto 54 /sbin/newfs $bpi /dev/md$3c 55 /sbin/mount /dev/md$3c $2 56} 57 58# If there is a global system configuration file, suck it in. 59# 60if [ -r /etc/rc.subr ]; then 61 . /etc/rc.subr 62 load_rc_config $name 63elif [ -r /etc/defaults/rc.conf ]; then 64 . /etc/defaults/rc.conf 65 source_rc_confs 66elif [ -r /etc/rc.conf ]; then 67 . /etc/rc.conf 68fi 69 70echo "+++ mount_md of /var" 71mount_md ${varsize:=32m} /var 1 72 73echo "+++ populate /var using /etc/mtree/BSD.var.dist" 74/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var 75case ${sendmail_enable} in 76echo "+++ create log files based on the contents of /etc/newsyslog.conf" 77LOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } ' /etc/newsyslog.conf` 78if [ -n "$LOGFILES" ]; then 79 /usr/bin/touch $LOGFILES 80fi 81 82echo "+++ create lastlog" 83/usr/bin/touch /var/log/lastlog 84 85mount -a # chown and chgrp are in /usr 86 87# Since we are starting with a very fresh /etc on an MFS: 88if [ -d /conf/default/etc ]; then 89 newaliases 90fi 91 92# 93# XXX make sure to create one dir for each printer as requested by lpd 94# 95 96# If /tmp is a symlink, assume it points to somewhere writable, like 97# /var/tmp, otherwise, use a small memory filesystem for /tmp. 98# 99# XXX: mtree runs too early to create any directories needed in /tmp, 100# so if /var/tmp == /tmp, then you don't get a vi.recover. 101# 102if [ ! -h /tmp ]; then 103 mount_md ${tmpsize:=64m} /tmp 2 104 chmod 01777 /tmp 105fi 106 107if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then 108 # we have DEVFS, no worries... 109 true 110else 111 # extract a list of device entries, then copy them to a writable fs 112 (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp 113 mount_md 4096 /dev 3 512 114 (cd /; cpio -i -H newc -d < /tmp/dev.tmp) 115fi 116