resolv revision 75931
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
2551237Speter# $FreeBSD: head/etc/rc.d/resolv 75931 2001-04-25 05:46:40Z imp $
2651231Ssheldonh#
2766830Sobrien# $FreeBSD: head/etc/rc.d/resolv 75931 2001-04-25 05:46:40Z imp $
2866830Sobrien#
2943803Sdillon
3043803Sdillon# PROVIDE: diskless
3143803Sdillon# REQUIRE: initdiskless mountcritlocal
3275931Simp
3375931Simp#   $1 = size
3475931Simp#   $2 = mount point
3575931Simp	/sbin/newfs /dev/md$3c
3675931Simp#   $4 = (optional) bytes-per-inode
3775931Simpmount_md()
3875931Simp{
3943803Sdillon	if [ -n "$4" ]; then
4043803Sdillon		bpi="-i $4"
4151231Ssheldonh	fi
4243849Sjkh	/sbin/mdconfig -a -t malloc -s $1 -u $3
4359674Ssheldonh	/sbin/disklabel -r -w md$3 auto
4451231Ssheldonh	/sbin/newfs $bpi /dev/md$3c
4543849Sjkh	/sbin/mount /dev/md$3c $2
4643803Sdillon}
4743803Sdillon
4875898Simpecho "+++ mfs_mount of /var"
4975931Simpmount_md ${varsize:=65536} /var 2
5075898Simpif [ -r /etc/rc.subr ]; then
5175898Simp        . /etc/rc.subr
5275898Simp        load_rc_config $name
5375898Simpecho "+++ mount_md of /var"
5475898Simpmount_md ${varsize:=32m} /var 1
5575898Simp
5675898Simpecho "+++ populate /var using /etc/mtree/BSD.var.dist"
5775898Simp/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var
5875898Simpcase ${sendmail_enable} in
5975898Simp	/usr/bin/touch $LOGFILES
6075898Simpfi
6175898Simp
6255520Sluigi# Since we are starting with a very fresh /etc on an MFS:
6355520Sluigiif [ -d /conf/default/etc ]; then
6455520Sluigi	newaliases
6543803Sdillonfi
6675898Simp# We assume that /tmp is symlinked to /var/tmp on the shared root
6775898Simp# partition. mount_null seems to have problems.
6875898Simp#if [ ! -h /tmp -a ! -h /var/tmp ]; then
6975898Simp#	mount_null /var/tmp /tmp
7075898Simp#fi
7143803Sdillon#
7255520Sluigi# extract a list of device entries, then copy them to a writable partition
7351231Ssheldonh(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
7475898Simpecho "+++ mount_mfs of /dev"
7575931Simpmount_md 4096 /dev 3
7651231Ssheldonh(cd /; cpio -i -H newc -d < /tmp/dev.tmp)
7743803Sdillon	# extract a list of device entries, then copy them to a writable fs
7843803Sdillon	(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
7943803Sdillon	mount_md 4096 /dev 3 512
8043803Sdillon	(cd /; cpio -i -H newc -d < /tmp/dev.tmp)
8143803Sdillonfi
82