resolv revision 104288
1193323Sed#!/bin/sh 2193323Sed# 3193323Sed# Copyright (c) 1999 Matt Dillon 4193323Sed# All rights reserved. 5193323Sed# 6193323Sed# Redistribution and use in source and binary forms, with or without 7193323Sed# modification, are permitted provided that the following conditions 8193323Sed# are met: 9193323Sed# 1. Redistributions of source code must retain the above copyright 10193323Sed# notice, this list of conditions and the following disclaimer. 11193323Sed# 2. Redistributions in binary form must reproduce the above copyright 12193323Sed# notice, this list of conditions and the following disclaimer in the 13193323Sed# documentation and/or other materials provided with the distribution. 14193323Sed# 15193323Sed# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16193323Sed# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17288943Sdim# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18193323Sed# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19193323Sed# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20193323Sed# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21201360Srdivacky# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22288943Sdim# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23288943Sdim# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24201360Srdivacky# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25193323Sed# SUCH DAMAGE. 26193323Sed# 27193323Sed# $FreeBSD: head/etc/rc.d/resolv 104288 2002-10-01 13:29:45Z ru $ 28212904Sdim# 29218893Sdim 30193323Sed# PROVIDE: diskless 31212904Sdim# REQUIRE: initdiskless mountcritlocal 32193323Sed# BEFORE: addswap random 33193323Sed# KEYWORD: FreeBSD 34193323Sed 35193323Seddlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` 36193323Sed[ ${dlv:=0} -eq 0 ] && exit 0 37193323Sed 38193323Sedname="diskless2" 39280031Sdim 40280031Sdim# Provide a function for normalizing the mounting of memory 41193323Sed# filesystems. This should allow the rest of the code here to remain 42193323Sed# as close as possible between 5-current and 4-stable. 43193323Sed# $1 = size 44193323Sed# $2 = mount point 45193323Sed# $3 = md unit number (ignored in pre 5.0 systems) 46193323Sed# $4 = (optional) bytes-per-inode 47212904Sdimmount_md() 48218893Sdim{ 49193323Sed if [ -n "$4" ]; then 50193323Sed bpi="-i $4" 51193323Sed fi 52193323Sed /sbin/mdmfs $bpi -s $1 -M md$3 $2 53193323Sed} 54193323Sed 55193323Sed# If there is a global system configuration file, suck it in. 56193323Sed# 57193323Sedif [ -r /etc/rc.subr ]; then 58193323Sed . /etc/rc.subr 59198090Srdivacky load_rc_config $name 60198090Srdivackyelif [ -r /etc/defaults/rc.conf ]; then 61198090Srdivacky . /etc/defaults/rc.conf 62198090Srdivacky source_rc_confs 63288943Sdimelif [ -r /etc/rc.conf ]; then 64288943Sdim . /etc/rc.conf 65288943Sdimfi 66288943Sdim 67288943Sdimecho "+++ mount_md of /var" 68288943Sdimmount_md ${varsize:=32m} /var 1 69288943Sdim 70288943Sdimecho "+++ populate /var using /etc/mtree/BSD.var.dist" 71288943Sdim/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var 72288943Sdimcase ${sendmail_enable} in 73288943Sdim[Nn][Oo][Nn][Ee]) 74288943Sdim ;; 75288943Sdim*) 76288943Sdim /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / 77288943Sdim ;; 78288943Sdimesac 79288943Sdim 80288943Sdimecho "+++ create log files based on the contents of /etc/newsyslog.conf" 81288943SdimLOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } ' /etc/newsyslog.conf` 82288943Sdimif [ -n "$LOGFILES" ]; then 83288943Sdim /usr/bin/touch $LOGFILES 84288943Sdimfi 85288943Sdim 86288943Sdimecho "+++ create lastlog" 87288943Sdim/usr/bin/touch /var/log/lastlog 88288943Sdim 89288943Sdimmount -a # chown and chgrp are in /usr 90288943Sdim 91288943Sdim# Since we are starting with a very fresh /etc on an MFS: 92288943Sdimif [ -d /conf/default/etc ]; then 93288943Sdim newaliases 94288943Sdimfi 95288943Sdim 96288943Sdim# 97288943Sdim# XXX make sure to create one dir for each printer as requested by lpd 98288943Sdim# 99288943Sdim 100288943Sdim# If /tmp is a symlink, assume it points to somewhere writable, like 101288943Sdim# /var/tmp, otherwise, use a small memory filesystem for /tmp. 102288943Sdim# 103288943Sdim# XXX: mtree runs too early to create any directories needed in /tmp, 104288943Sdim# so if /var/tmp == /tmp, then you don't get a vi.recover. 105288943Sdim# 106288943Sdimif [ ! -L /tmp ]; then 107288943Sdim mount_md ${tmpsize:=64m} /tmp 2 108288943Sdim chmod 01777 /tmp 109288943Sdimfi 110288943Sdim 111288943Sdimif sysctl vfs.devfs.generation > /dev/null 2>&1 ; then 112288943Sdim # we have DEVFS, no worries... 113288943Sdim true 114288943Sdimelse 115288943Sdim # extract a list of device entries, then copy them to a writable fs 116288943Sdim (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp 117288943Sdim mount_md 4096 /dev 3 512 118288943Sdim (cd /; cpio -i -H newc -d < /tmp/dev.tmp) 119288943Sdimfi 120288943Sdim