resolv revision 76409
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# $FreeBSD: head/etc/rc.d/resolv 76409 2001-05-09 15:13:51Z bsd $ 26# 27# $FreeBSD: head/etc/rc.d/resolv 76409 2001-05-09 15:13:51Z bsd $ 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 58echo "+++ mfs_mount of /var" 59mount_md ${varsize:=65536} /var 1 60if [ -r /etc/rc.subr ]; then 61 . /etc/rc.subr 62 load_rc_config $name 63echo "+++ mount_md of /var" 64mount_md ${varsize:=32m} /var 1 65 66echo "+++ populate /var using /etc/mtree/BSD.var.dist" 67/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var 68case ${sendmail_enable} in 69 /usr/bin/touch $LOGFILES 70fi 71 72# Since we are starting with a very fresh /etc on an MFS: 73if [ -d /conf/default/etc ]; then 74 newaliases 75fi 76 77# 78# /var/tmp, otherwise, use a small memory filesystem for /tmp. 79 mount_md ${tmpsize:=20480} /tmp 2 80# so if /var/tmp == /tmp, then you don't get a vi.recover. 81# 82if [ ! -h /tmp ]; then 83 mount_md ${tmpsize:=64m} /tmp 2 84 chmod 01777 /tmp 85fi 86 87if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then 88 # we have DEVFS, no worries... 89 true 90else 91 # extract a list of device entries, then copy them to a writable fs 92 (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp 93 mount_md 4096 /dev 3 512 94 (cd /; cpio -i -H newc -d < /tmp/dev.tmp) 95fi 96