head	1.49;
access;
symbols
	RELENG_8_4:1.49.0.2
	RELENG_9_1_0_RELEASE:1.46.2.2.2.2
	RELENG_9_1:1.46.2.2.0.2
	RELENG_9_1_BP:1.46.2.2
	RELENG_8_3_0_RELEASE:1.44.2.3.2.1
	RELENG_8_3:1.44.2.3.0.2
	RELENG_8_3_BP:1.44.2.3
	RELENG_9_0_0_RELEASE:1.46.2.1.2.1
	RELENG_9_0:1.46.2.1.0.2
	RELENG_9_0_BP:1.46.2.1
	RELENG_9:1.46.0.2
	RELENG_9_BP:1.46
	RELENG_7_4_0_RELEASE:1.43.2.1.8.1
	RELENG_8_2_0_RELEASE:1.44.2.1.6.1
	RELENG_7_4:1.43.2.1.0.8
	RELENG_7_4_BP:1.43.2.1
	RELENG_8_2:1.44.2.1.0.6
	RELENG_8_2_BP:1.44.2.1
	RELENG_8_1_0_RELEASE:1.44.2.1.4.1
	RELENG_8_1:1.44.2.1.0.4
	RELENG_8_1_BP:1.44.2.1
	RELENG_7_3_0_RELEASE:1.43.2.1.6.1
	RELENG_7_3:1.43.2.1.0.6
	RELENG_7_3_BP:1.43.2.1
	RELENG_8_0_0_RELEASE:1.44.2.1.2.1
	RELENG_8_0:1.44.2.1.0.2
	RELENG_8_0_BP:1.44.2.1
	RELENG_8:1.44.0.2
	RELENG_8_BP:1.44
	RELENG_7_2_0_RELEASE:1.43.2.1.4.1
	RELENG_7_2:1.43.2.1.0.4
	RELENG_7_2_BP:1.43.2.1
	RELENG_7_1_0_RELEASE:1.43.2.1.2.1
	RELENG_6_4_0_RELEASE:1.40.2.4.2.1
	RELENG_7_1:1.43.2.1.0.2
	RELENG_7_1_BP:1.43.2.1
	RELENG_6_4:1.40.2.4.0.2
	RELENG_6_4_BP:1.40.2.4
	RELENG_7_0_0_RELEASE:1.43.4.1
	RELENG_6_3_0_RELEASE:1.40.2.3
	RELENG_7_0:1.43.0.4
	RELENG_7_0_BP:1.43
	RELENG_6_3:1.40.2.3.0.2
	RELENG_6_3_BP:1.40.2.3
	RELENG_7:1.43.0.2
	RELENG_7_BP:1.43
	RELENG_6_2_0_RELEASE:1.40
	RELENG_6_2:1.40.0.8
	RELENG_6_2_BP:1.40
	RELENG_5_5_0_RELEASE:1.32.2.5
	RELENG_5_5:1.32.2.5.0.2
	RELENG_5_5_BP:1.32.2.5
	RELENG_6_1_0_RELEASE:1.40
	RELENG_6_1:1.40.0.6
	RELENG_6_1_BP:1.40
	RELENG_6_0_0_RELEASE:1.40
	RELENG_6_0:1.40.0.4
	RELENG_6_0_BP:1.40
	RELENG_6:1.40.0.2
	RELENG_6_BP:1.40
	RELENG_5_4_0_RELEASE:1.32.2.3
	RELENG_5_4:1.32.2.3.0.2
	RELENG_5_4_BP:1.32.2.3
	RELENG_5_3_0_RELEASE:1.32.2.2
	RELENG_5_3:1.32.2.2.0.2
	RELENG_5_3_BP:1.32.2.2
	RELENG_5:1.32.0.2
	RELENG_5_BP:1.32
	old_RELENG_5_2_1_RELEASE:1.29
	old_RELENG_5_2_0_RELEASE:1.29
	old_RELENG_5_2:1.29.0.2
	old_RELENG_5_2_BP:1.29
	old_RELENG_5_1_0_RELEASE:1.25
	old_RELENG_5_1:1.25.0.2
	old_RELENG_5_1_BP:1.25
	old_RELENG_5_0_0_RELEASE:1.23
	old_RELENG_5_0:1.23.0.2
	old_RELENG_5_0_BP:1.23
	old_old_RELENG_4_6_1_RELEASE:1.5.2.12
	old_old_RELENG_4_6_0_RELEASE:1.5.2.12
	old_old_RELENG_4_6:1.5.2.12.0.2
	old_old_RELENG_4_6_BP:1.5.2.12
	old_old_RELENG_4_5_0_RELEASE:1.5.2.9
	old_old_RELENG_4_5:1.5.2.9.0.2
	old_old_RELENG_4_5_BP:1.5.2.9
	old_old_RELENG_4_4_0_RELEASE:1.5.2.8
	old_old_RELENG_4_4:1.5.2.8.0.2
	old_old_RELENG_4_4_BP:1.5.2.8
	old_old_RELENG_4_3_0_RELEASE:1.5.2.5
	old_old_RELENG_4_3:1.5.2.5.0.2
	old_old_RELENG_4_3_BP:1.5.2.5
	old_old_RELENG_4_2_0_RELEASE:1.5.2.2
	old_old_RELENG_4_1_1_RELEASE:1.5.2.1
	old_old_PRE_SMPNG:1.6
	old_old_RELENG_4_1_0_RELEASE:1.5.2.1
	old_old_RELENG_3_5_0_RELEASE:1.2.2.1
	old_old_RELENG_4_0_0_RELEASE:1.5
	old_old_RELENG_4:1.5.0.2
	old_old_RELENG_4_BP:1.5
	old_old_RELENG_3_4_0_RELEASE:1.2.2.1
	old_old_RELENG_3_3_0_RELEASE:1.2.2.1
	old_old_RELENG_3_2_PAO:1.2.2.1.0.2
	old_old_RELENG_3_2_PAO_BP:1.2.2.1
	old_old_RELENG_3_2_0_RELEASE:1.2.2.1
	old_old_RELENG_3:1.2.0.2;
locks; strict;
comment	@# @;


1.49
date	2012.11.17.01.49.06;	author svnexp;	state Exp;
branches
	1.49.2.1;
next	1.48;

1.48
date	2012.09.11.05.04.59;	author obrien;	state Exp;
branches;
next	1.47;

1.47
date	2012.02.11.06.21.16;	author dougb;	state Exp;
branches;
next	1.46;

1.46
date	2011.06.18.19.41.05;	author dougb;	state Exp;
branches
	1.46.2.1;
next	1.45;

1.45
date	2010.01.13.19.07.48;	author ed;	state Exp;
branches;
next	1.44;

1.44
date	2007.12.08.23.00.28;	author dougb;	state Exp;
branches
	1.44.2.1;
next	1.43;

1.43
date	2007.05.24.05.54.37;	author rse;	state Exp;
branches
	1.43.2.1
	1.43.4.1;
next	1.42;

1.42
date	2007.04.02.22.53.07;	author des;	state Exp;
branches;
next	1.41;

1.41
date	2006.12.30.22.53.20;	author yar;	state Exp;
branches;
next	1.40;

1.40
date	2005.03.02.16.41.35;	author brooks;	state Exp;
branches
	1.40.2.1;
next	1.39;

1.39
date	2005.03.02.02.46.47;	author brooks;	state Exp;
branches;
next	1.38;

1.38
date	2005.03.02.00.58.05;	author brooks;	state Exp;
branches;
next	1.37;

1.37
date	2005.03.02.00.40.55;	author brooks;	state Exp;
branches;
next	1.36;

1.36
date	2005.03.01.22.08.15;	author brooks;	state Exp;
branches;
next	1.35;

1.35
date	2004.11.09.10.03.17;	author keramida;	state Exp;
branches;
next	1.34;

1.34
date	2004.10.07.13.55.26;	author mtm;	state Exp;
branches;
next	1.33;

1.33
date	2004.09.13.17.40.14;	author ru;	state Exp;
branches;
next	1.32;

1.32
date	2004.03.23.23.22.35;	author brooks;	state Exp;
branches
	1.32.2.1;
next	1.31;

1.31
date	2004.03.08.12.25.05;	author pjd;	state Exp;
branches;
next	1.30;

1.30
date	2004.01.05.19.14.47;	author brooks;	state Exp;
branches;
next	1.29;

1.29
date	2003.10.13.08.18.05;	author dougb;	state Exp;
branches;
next	1.28;

1.28
date	2003.10.03.19.57.58;	author phk;	state Exp;
branches;
next	1.27;

1.27
date	2003.10.03.19.07.31;	author phk;	state Exp;
branches;
next	1.26;

1.26
date	2003.10.03.18.26.33;	author phk;	state Exp;
branches;
next	1.25;

1.25
date	2003.02.15.16.34.14;	author jhay;	state Exp;
branches;
next	1.24;

1.24
date	2002.12.22.22.18.41;	author dillon;	state Exp;
branches;
next	1.23;

1.23
date	2002.10.12.10.31.31;	author schweikh;	state Exp;
branches;
next	1.22;

1.22
date	2002.10.01.13.29.44;	author ru;	state Exp;
branches;
next	1.21;

1.21
date	2002.09.22.09.48.02;	author phk;	state Exp;
branches;
next	1.20;

1.20
date	2002.06.25.01.52.33;	author bsd;	state Exp;
branches;
next	1.19;

1.19
date	2002.06.13.22.14.36;	author gordon;	state Exp;
branches;
next	1.18;

1.18
date	2002.03.07.07.17.15;	author obrien;	state Exp;
branches;
next	1.17;

1.17
date	2002.02.23.01.49.20;	author obrien;	state Exp;
branches;
next	1.16;

1.16
date	2002.02.22.19.05.22;	author obrien;	state Exp;
branches;
next	1.15;

1.15
date	2001.12.26.17.18.39;	author rwatson;	state Exp;
branches;
next	1.14;

1.14
date	2001.11.27.22.12.27;	author rwatson;	state Exp;
branches;
next	1.13;

1.13
date	2001.10.17.14.30.19;	author bsd;	state Exp;
branches;
next	1.12;

1.12
date	2001.06.01.10.07.15;	author ru;	state Exp;
branches;
next	1.11;

1.11
date	2001.05.09.15.13.51;	author bsd;	state Exp;
branches;
next	1.10;

1.10
date	2001.05.01.20.13.59;	author phk;	state Exp;
branches;
next	1.9;

1.9
date	2001.04.25.05.46.40;	author imp;	state Exp;
branches;
next	1.8;

1.8
date	2001.04.24.07.02.01;	author imp;	state Exp;
branches;
next	1.7;

1.7
date	2000.10.08.19.18.24;	author obrien;	state Exp;
branches;
next	1.6;

1.6
date	2000.04.27.08.43.48;	author sheldonh;	state Exp;
branches;
next	1.5;

1.5
date	2000.01.06.18.17.38;	author luigi;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	99.09.13.17.09.07;	author peter;	state Exp;
branches;
next	1.3;

1.3
date	99.09.13.15.44.18;	author sheldonh;	state Exp;
branches;
next	1.2;

1.2
date	99.02.10.18.08.16;	author jkh;	state Exp;
branches
	1.2.2.1;
next	1.1;

1.1
date	99.02.09.17.17.18;	author dillon;	state Exp;
branches;
next	;

1.49.2.1
date	2012.11.17.01.49.06;	author svnexp;	state dead;
branches;
next	1.49.2.2;

1.49.2.2
date	2013.03.28.13.02.44;	author svnexp;	state Exp;
branches;
next	;

1.46.2.1
date	2011.09.23.00.51.37;	author kensmith;	state Exp;
branches
	1.46.2.1.2.1;
next	1.46.2.2;

1.46.2.2
date	2012.02.14.10.33.57;	author dougb;	state Exp;
branches
	1.46.2.2.2.1;
next	1.46.2.3;

1.46.2.3
date	2012.10.26.18.06.49;	author obrien;	state Exp;
branches;
next	1.46.2.4;

1.46.2.4
date	2012.11.17.11.36.11;	author svnexp;	state Exp;
branches;
next	;

1.46.2.1.2.1
date	2011.11.11.04.20.22;	author kensmith;	state Exp;
branches;
next	1.46.2.1.2.2;

1.46.2.1.2.2
date	2012.11.17.08.36.11;	author svnexp;	state Exp;
branches;
next	;

1.46.2.2.2.1
date	2012.08.05.23.54.33;	author kensmith;	state Exp;
branches;
next	1.46.2.2.2.2;

1.46.2.2.2.2
date	2012.11.17.08.47.01;	author svnexp;	state Exp;
branches;
next	;

1.44.2.1
date	2009.08.03.08.13.06;	author kensmith;	state Exp;
branches
	1.44.2.1.2.1
	1.44.2.1.4.1
	1.44.2.1.6.1;
next	1.44.2.2;

1.44.2.2
date	2011.06.25.23.05.56;	author dougb;	state Exp;
branches;
next	1.44.2.3;

1.44.2.3
date	2012.02.14.10.34.15;	author dougb;	state Exp;
branches
	1.44.2.3.2.1;
next	1.44.2.4;

1.44.2.4
date	2012.11.17.10.35.57;	author svnexp;	state Exp;
branches;
next	;

1.44.2.1.2.1
date	2009.10.25.01.10.29;	author kensmith;	state Exp;
branches;
next	;

1.44.2.1.4.1
date	2010.06.14.02.09.06;	author kensmith;	state Exp;
branches;
next	;

1.44.2.1.6.1
date	2010.12.21.17.09.25;	author kensmith;	state Exp;
branches;
next	;

1.44.2.3.2.1
date	2012.03.03.06.15.13;	author kensmith;	state Exp;
branches;
next	1.44.2.3.2.2;

1.44.2.3.2.2
date	2012.11.17.08.24.38;	author svnexp;	state Exp;
branches;
next	;

1.43.2.1
date	2008.01.29.00.18.08;	author dougb;	state Exp;
branches
	1.43.2.1.2.1
	1.43.2.1.4.1
	1.43.2.1.6.1
	1.43.2.1.8.1;
next	1.43.2.2;

1.43.2.2
date	2011.06.25.23.09.25;	author dougb;	state Exp;
branches;
next	1.43.2.3;

1.43.2.3
date	2012.02.14.10.34.27;	author dougb;	state Exp;
branches;
next	1.43.2.4;

1.43.2.4
date	2012.11.17.08.01.23;	author svnexp;	state Exp;
branches;
next	;

1.43.2.1.2.1
date	2008.11.25.02.59.29;	author kensmith;	state Exp;
branches;
next	;

1.43.2.1.4.1
date	2009.04.15.03.14.26;	author kensmith;	state Exp;
branches;
next	;

1.43.2.1.6.1
date	2010.02.10.00.26.20;	author kensmith;	state Exp;
branches;
next	;

1.43.2.1.8.1
date	2010.12.21.17.10.29;	author kensmith;	state Exp;
branches;
next	1.43.2.1.8.2;

1.43.2.1.8.2
date	2012.11.17.08.16.37;	author svnexp;	state Exp;
branches;
next	;

1.43.4.1
date	2008.01.29.00.22.33;	author dougb;	state Exp;
branches;
next	;

1.40.2.1
date	2007.05.24.16.14.37;	author des;	state Exp;
branches;
next	1.40.2.2;

1.40.2.2
date	2007.10.25.14.36.11;	author mtm;	state Exp;
branches;
next	1.40.2.3;

1.40.2.3
date	2007.10.25.14.58.33;	author mtm;	state Exp;
branches;
next	1.40.2.4;

1.40.2.4
date	2008.01.29.00.33.16;	author dougb;	state Exp;
branches
	1.40.2.4.2.1;
next	1.40.2.5;

1.40.2.5
date	2012.11.17.07.39.09;	author svnexp;	state Exp;
branches;
next	;

1.40.2.4.2.1
date	2008.10.02.02.57.24;	author kensmith;	state Exp;
branches;
next	;

1.32.2.1
date	2004.10.10.09.50.54;	author mtm;	state Exp;
branches;
next	1.32.2.2;

1.32.2.2
date	2004.10.14.14.38.49;	author brooks;	state Exp;
branches;
next	1.32.2.3;

1.32.2.3
date	2005.01.17.11.51.00;	author keramida;	state Exp;
branches;
next	1.32.2.4;

1.32.2.4
date	2006.01.11.06.06.53;	author brooks;	state Exp;
branches;
next	1.32.2.5;

1.32.2.5
date	2006.01.11.16.39.09;	author brooks;	state Exp;
branches;
next	;

1.5.2.1
date	2000.05.28.19.17.15;	author asmodai;	state Exp;
branches;
next	1.5.2.2;

1.5.2.2
date	2000.10.30.10.40.11;	author obrien;	state Exp;
branches;
next	1.5.2.3;

1.5.2.3
date	2001.03.06.01.58.45;	author obrien;	state Exp;
branches;
next	1.5.2.4;

1.5.2.4
date	2001.03.06.02.15.04;	author obrien;	state Exp;
branches;
next	1.5.2.5;

1.5.2.5
date	2001.04.17.15.52.28;	author luigi;	state Exp;
branches;
next	1.5.2.6;

1.5.2.6
date	2001.04.22.23.14.46;	author bsd;	state Exp;
branches;
next	1.5.2.7;

1.5.2.7
date	2001.05.11.17.46.57;	author bsd;	state Exp;
branches;
next	1.5.2.8;

1.5.2.8
date	2001.07.24.09.49.37;	author dd;	state Exp;
branches;
next	1.5.2.9;

1.5.2.9
date	2001.11.02.23.20.43;	author bsd;	state Exp;
branches;
next	1.5.2.10;

1.5.2.10
date	2002.02.12.17.25.11;	author luigi;	state Exp;
branches;
next	1.5.2.11;

1.5.2.11
date	2002.02.12.18.36.23;	author luigi;	state Exp;
branches;
next	1.5.2.12;

1.5.2.12
date	2002.03.15.08.00.37;	author luigi;	state Exp;
branches;
next	1.5.2.13;

1.5.2.13
date	2002.07.04.13.22.35;	author bsd;	state Exp;
branches;
next	;

1.2.2.1
date	99.03.09.17.04.40;	author luigi;	state Exp;
branches;
next	;


desc
@@


1.49
log
@Switching exporter and resync
@
text
@#!/bin/sh
#
# Copyright (c) 1999  Matt Dillon
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: head/etc/rc.d/var 240336 2012-09-11 05:04:59Z obrien $
#

# PROVIDE: var
# REQUIRE: mountcritlocal zfs

# NFS /var is not supported, unless NFS /var is part of diskless NFS /

. /etc/rc.subr

name="var"
stop_cmd=':'

load_rc_config $name

populate_var()
{
	/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null
	case ${sendmail_enable} in
	[Nn][Oo][Nn][Ee])
		;;
	*)
		/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null
		;;
	esac
}

# If we do not have a writable /var, create a memory filesystem for /var
# unless told otherwise by rc.conf.  We don't have /usr yet so use mkdir
# instead of touch to test.  We want mount to record its mounts so we
# have to make sure /var/db exists before doing the mount -a.
#
case "${varmfs}" in
[Yy][Ee][Ss])
	mount_md ${varsize} /var "${varmfs_flags}"
	;;
[Nn][Oo])
	;;
*)
	if /bin/mkdir -p /var/.diskless 2> /dev/null; then
		rmdir /var/.diskless
	else
		mount_md ${varsize} /var "${varmfs_flags}"
	fi
esac


# If we have an empty looking /var, populate it, but only if we have
# /usr available.  Hopefully, we'll eventually find a workaround, but
# in realistic diskless setups, we're probably ok.
case "${populate_var}" in
[Yy][Ee][Ss])
	populate_var
	;;
[Nn][Oo])
	exit 0
	;;
*)
	if [ -d /var/run -a -d /var/db -a -d /var/empty ] ; then
		true
	elif [ -x /usr/sbin/mtree ] ; then
		populate_var
	else
		# We need mtree to populate /var so try mounting /usr.
		# If this does not work, we can not boot so it is OK to
		# try to mount out of order.
		mount /usr
		if [ ! -x /usr/sbin/mtree ] ; then
			exit 1
		else
			populate_var
		fi
	fi
	;;
esac

# Make sure we have /var/log/utx.lastlogin and /var/log/utx.log files
if [ ! -f /var/log/utx.lastlogin ]; then
	cp /dev/null /var/log/utx.lastlogin
	chmod 644 /var/log/utx.lastlogin
fi
if [ ! -f /var/log/utx.log ]; then
	cp /dev/null /var/log/utx.log
	chmod 644 /var/log/utx.log
fi
@


1.49.2.1
log
@file var was added on branch RELENG_8_4 on 2013-03-28 13:02:44 +0000
@
text
@d1 111
@


1.49.2.2
log
@## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/248810
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
@
text
@a0 109
#!/bin/sh
#
# Copyright (c) 1999  Matt Dillon
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: releng/8.4/etc/rc.d/var 231665 2012-02-14 10:34:15Z dougb $
#

# PROVIDE: var
# REQUIRE: FILESYSTEMS kld addswap

. /etc/rc.subr

name="var"
stop_cmd=':'

load_rc_config $name

populate_var()
{
	/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null
	case ${sendmail_enable} in
	[Nn][Oo][Nn][Ee])
		;;
	*)
		/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null
		;;
	esac
}

# If we do not have a writable /var, create a memory filesystem for /var
# unless told otherwise by rc.conf.  We don't have /usr yet so use mkdir
# instead of touch to test.  We want mount to record its mounts so we
# have to make sure /var/db exists before doing the mount -a.
#
case "${varmfs}" in
[Yy][Ee][Ss])
	mount_md ${varsize} /var "${varmfs_flags}"
	;;
[Nn][Oo])
	;;
*)
	if /bin/mkdir -p /var/.diskless 2> /dev/null; then
		rmdir /var/.diskless
	else
		mount_md ${varsize} /var "${varmfs_flags}"
	fi
esac


# If we have an empty looking /var, populate it, but only if we have
# /usr available.  Hopefully, we'll eventually find a workaround, but
# in realistic diskless setups, we're probably ok.
case "${populate_var}" in
[Yy][Ee][Ss])
	populate_var
	;;
[Nn][Oo])
	exit 0
	;;
*)
	if [ -d /var/run -a -d /var/db -a -d /var/empty ] ; then
		true
	elif [ -x /usr/sbin/mtree ] ; then
		populate_var
	else
		# We need mtree to populate /var so try mounting /usr.
		# If this does not work, we can not boot so it is OK to
		# try to mount out of order.
		mount /usr
		if [ ! -x /usr/sbin/mtree ] ; then
			exit 1
		else
			populate_var
		fi
	fi
	;;
esac

# Make sure we have /var/log/lastlog and /var/log/wtmp files
if [ ! -f /var/log/lastlog ]; then
	cp /dev/null /var/log/lastlog
	chmod 644 /var/log/lastlog
fi
if [ ! -f /var/log/wtmp ]; then
	cp /dev/null /var/log/wtmp
	chmod 644 /var/log/wtmp
fi
@


1.48
log
@SVN rev 240336 on 2012-09-11 05:04:59Z by obrien

Simply things so that "#REQUIRE: FILESYSTEMS" means the file
systems are fully "ready to go".

'FILESYSTEMS' states: "This is a dummy dependency, for services which
require file systems to be mounted before starting."  However, we have
'var' which is was run after 'FILESYSTEMS' and can mount /var if it
already isn't mounted.  Furthermore, several scripts cannot use /var
until 'cleanvar' has done its thing.  Thus "FILESYSTEMS" hasn't really
meant all critical file systems are fully usable.
@
text
@d27 1
a27 1
# $FreeBSD$
@


1.47
log
@SVN rev 231507 on 2012-02-11 06:21:16Z by dougb

In the days before r208307 addswap was running early in the second stage
of rcorder. Somehow in the intervening period addswap got moved to the
very end, which is almost certainly not what we want.

This change moves it to right after kld so that for users who need it,
they'll get it ASAP.
@
text
@d31 3
a33 1
# REQUIRE: FILESYSTEMS kld addswap
@


1.46
log
@SVN rev 223264 on 2011-06-18 19:41:05Z by dougb

Add rc.d/kld to load kernel modules after local disks are up.
This method is many times faster than doing it in /boot/loader.conf.
@
text
@d31 1
a31 1
# REQUIRE: FILESYSTEMS kld
@


1.46.2.1
log
@SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.46.2.2
log
@SVN rev 231664 on 2012-02-14 10:33:57Z by dougb

MFC r231507:

Move addswap to run right after kld (aka early in the second stage),
as it did previously.
@
text
@d31 1
a31 1
# REQUIRE: FILESYSTEMS kld addswap
@


1.46.2.3
log
@SVN rev 242153 on 2012-10-26 18:06:49Z by obrien

MFC: r240336:
  Simply things so that "#REQUIRE: FILESYSTEMS" means the file
  systems are fully "ready to go".

  'FILESYSTEMS' states: "This is a dummy dependency, for services which
  require file systems to be mounted before starting."  However, we have
  'var' which is was run after 'FILESYSTEMS' and can mount /var if it
  already isn't mounted.  Furthermore, several scripts cannot use /var
  until 'cleanvar' has done its thing.  Thus "FILESYSTEMS" hasn't really
  meant all critical file systems are fully usable.
@
text
@d31 1
a31 3
# REQUIRE: mountcritlocal zfs

# NFS /var is not supported, unless NFS /var is part of diskless NFS /
@


1.46.2.4
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242902
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242902 | dteske | 2012-11-11 23:29:45 +0000 (Sun, 11 Nov 2012) | 10 lines
## SVN ##
## SVN ## Fix a regression introduced by SVN r211417 that saw the breakage of a feature
## SVN ## documented in usr.sbin/sysinstall/help/shortcuts.hlp (reproduced below):
## SVN ##
## SVN ## If /usr/sbin/sysinstall is linked to another filename, say
## SVN ## `/usr/local/bin/configPackages', then the basename will be used
## SVN ## as an implicit command name.
## SVN ##
## SVN ## Reviewed by:	adrian (co-mentor)
## SVN ## Approved by:	adrian (co-mentor)
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d27 1
a27 1
# $FreeBSD: stable/9/etc/rc.d/var 242153 2012-10-26 18:06:49Z obrien $
@


1.46.2.2.2.1
log
@SVN rev 239080 on 2012-08-05 23:54:33Z by kensmith

Copy stable/9 to releng/9.1 as part of the 9.1-RELEASE release process.

Approved by:	re (implicit)
@
text
@@


1.46.2.2.2.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: releng/9.1/etc/rc.d/var 231664 2012-02-14 10:33:57Z dougb $
@


1.46.2.1.2.1
log
@SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)
@
text
@@


1.46.2.1.2.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: releng/9.0/etc/rc.d/var 223264 2011-06-18 19:41:05Z dougb $
@


1.45
log
@SVN rev 202218 on 2010-01-13 19:07:48Z by ed

Let rc and periodic infrastructure and newsyslog use the utmpx files.
@
text
@d31 1
a31 1
# REQUIRE: FILESYSTEMS
@


1.44
log
@Add an empty stop_cmd to the remaining scripts that don't start
daemons and don't already have one.
@
text
@d101 4
a104 4
# Make sure we have /var/log/lastlog and /var/log/wtmp files
if [ ! -f /var/log/lastlog ]; then
	cp /dev/null /var/log/lastlog
	chmod 644 /var/log/lastlog
d106 3
a108 3
if [ ! -f /var/log/wtmp ]; then
	cp /dev/null /var/log/wtmp
	chmod 644 /var/log/wtmp
@


1.44.2.1
log
@SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)
@
text
@@


1.44.2.2
log
@SVN rev 223550 on 2011-06-25 23:05:56Z by dougb

MFC r223264:

Add rc.d/kld to load kernel modules after local disks are up.
@
text
@d31 1
a31 1
# REQUIRE: FILESYSTEMS kld
@


1.44.2.3
log
@SVN rev 231665 on 2012-02-14 10:34:15Z by dougb

MFC r231507:

Move addswap to run right after kld (aka early in the second stage),
as it did previously.
@
text
@d31 1
a31 1
# REQUIRE: FILESYSTEMS kld addswap
@


1.44.2.4
log
@## SVN ##
## SVN ## Exported commit - http://svnweb.freebsd.org/changeset/base/ 242909
## SVN ## CVS IS DEPRECATED: http://wiki.freebsd.org/CvsIsDeprecated
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ## r242909 | dim | 2012-11-12 07:47:19 +0000 (Mon, 12 Nov 2012) | 20 lines
## SVN ##
## SVN ## MFC r242625:
## SVN ##
## SVN ## Remove duplicate const specifiers in many drivers (I hope I got all of
## SVN ## them, please let me know if not).  Most of these are of the form:
## SVN ##
## SVN ## static const struct bzzt_type {
## SVN ##       [...list of members...]
## SVN ## } const bzzt_devs[] = {
## SVN ##       [...list of initializers...]
## SVN ## };
## SVN ##
## SVN ## The second const is unnecessary, as arrays cannot be modified anyway,
## SVN ## and if the elements are const, the whole thing is const automatically
## SVN ## (e.g. it is placed in .rodata).
## SVN ##
## SVN ## I have verified this does not change the binary output of a full kernel
## SVN ## build (except for build timestamps embedded in the object files).
## SVN ##
## SVN ## Reviewed by:	yongari, marius
## SVN ##
## SVN ## ------------------------------------------------------------------------
## SVN ##
@
text
@d27 1
a27 1
# $FreeBSD: stable/8/etc/rc.d/var 231665 2012-02-14 10:34:15Z dougb $
@


1.44.2.3.2.1
log
@SVN rev 232438 on 2012-03-03 06:15:13Z by kensmith

Copy stable/8 to releng/8.3 as part of 8.3-RELEASE release cycle.

Approved by:	re (implicit)
@
text
@@


1.44.2.3.2.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: releng/8.3/etc/rc.d/var 231665 2012-02-14 10:34:15Z dougb $
@


1.44.2.1.6.1
log
@SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)
@
text
@@


1.44.2.1.4.1
log
@SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)
@
text
@@


1.44.2.1.2.1
log
@SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)
@
text
@@


1.43
log
@Remove two unnecessary and useless sub-shell constructs.
@
text
@d36 1
@


1.43.4.1
log
@MFC functional changes to etc:
1. yar's "dry run" patch to Makefile
2. Add zfs to the list of filesystems to check in
periodic/security/100.chksetuid
3. GC the nfslocking script, which has been superseded by lockd and statd
4. Add security warning to rc.d/jail
5. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.

And update comments in rc.firewall* and defaults/rc.conf.

Approved by:	re (kensmith)
@
text
@a35 1
stop_cmd=':'
@


1.43.2.1
log
@MFC functional changes to etc:
1. yar's "dry run" patch to Makefile
2. Add zfs to the list of filesystems to check in
periodic/security/100.chksetuid
3. GC the nfslocking script, which has been superseded by lockd and statd
4. Add security warning to rc.d/jail
5. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.
@
text
@a35 1
stop_cmd=':'
@


1.43.2.2
log
@SVN rev 223551 on 2011-06-25 23:09:25Z by dougb

MFC r223264:

Add rc.d/kld to load kernel modules after local disks are up.
@
text
@d31 1
a31 1
# REQUIRE: FILESYSTEMS kld
@


1.43.2.3
log
@SVN rev 231666 on 2012-02-14 10:34:27Z by dougb

MFC r231507:

Move addswap to run right after kld (aka early in the second stage),
as it did previously.
@
text
@d31 1
a31 1
# REQUIRE: FILESYSTEMS kld addswap
@


1.43.2.4
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: stable/7/etc/rc.d/var 231666 2012-02-14 10:34:27Z dougb $
@


1.43.2.1.8.1
log
@SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)
@
text
@@


1.43.2.1.8.2
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: releng/7.4/etc/rc.d/var 175781 2008-01-29 00:18:08Z dougb $
@


1.43.2.1.6.1
log
@SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)
@
text
@@


1.43.2.1.4.1
log
@SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)
@
text
@@


1.43.2.1.2.1
log
@SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)
@
text
@@


1.42
log
@Add a dummy script, FILESYSTEMS, which depends on root and mountcritlocal
and takes over mountcritlocal's role as the early / late divider.  This
makes it far easier to add rc scripts which need to run early, such as a
startup script for zfs, which is right around the corner.

This change should be a no-op; I have verified that the only change in
rcorder's output is the insertion of FILESYSTEMS immediately after
mountcritlocal.

MFC after:	3 weeks
@
text
@d63 1
a63 1
	if (/bin/mkdir -p /var/.diskless 2> /dev/null); then
@


1.41
log
@Eliminate global symbols starting with an underscore from rc.d
scripts, except for mdconfig* and jail.  Such symbols are reserved
for the rc.subr internals.  Most scripts can be fixed by just
declaring _foo symbols as local: few scripts actually need them to
be global.

Discussed with:	dougb in freebsd-rc
@
text
@d31 1
a31 1
# REQUIRE: mountcritlocal
@


1.40
log
@Remove stray else.

Reported by:	Tai-hwa Liang <avatar at mmlab dot cse dot yzu dot edu dot tw>
Point hat:	brooks
@
text
@d39 1
a39 1
_populate_var()
d76 1
a76 1
	_populate_var
d85 1
a85 1
		_populate_var
d94 1
a94 1
			_populate_var
@


1.40.2.1
log
@MFC: add FILESYSTEMS
@
text
@d31 1
a31 1
# REQUIRE: FILESYSTEMS
@


1.40.2.2
log
@MFC:
  Eliminate global symbols starting with an underscore from rc.d
  scripts, except for mdconfig* and jail.  Such symbols are reserved
  for the rc.subr internals.  Most scripts can be fixed by just
  declaring _foo symbols as local: few scripts actually need them to
  be global.
@
text
@d39 1
a39 1
populate_var()
d76 1
a76 1
	populate_var
d85 1
a85 1
		populate_var
d94 1
a94 1
			populate_var
@


1.40.2.3
log
@MFC:
    rc.d/var rc.d/tmp:
    Remove unnecessary subshell constructs.

    rc.d/clean rc.d/initrandom:
    Remove unnecessary semi-colon at the end of a command line.
@
text
@d63 1
a63 1
	if /bin/mkdir -p /var/.diskless 2> /dev/null; then
@


1.40.2.4
log
@MFC a more limited set of changes that make sense for this branch:

1. GC the nfslocking script, which has been superseded by lockd and statd
2. Add security warning to rc.d/jail
3. Add stop_cmd=':' to those rc.d scripts that do not start services,
but did not already have a stop_cmd.
@
text
@a35 1
stop_cmd=':'
@


1.40.2.5
log
@Switch importer
@
text
@d27 1
a27 1
# $FreeBSD: stable/6/etc/rc.d/var 175784 2008-01-29 00:33:16Z dougb $
@


1.40.2.4.2.1
log
@SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)
@
text
@@


1.39
log
@Allow chkprintcap(8) to be run before lpd is started.  Disabled by
default for now.  Default flags create missing directories.

Remove comment about doing this in etc/rc.d/var.

Unlike in the PR, I chose to do this in the lpd script where we reliably
have /usr available.

PR:		conf/71488
Submitted by:	RZ-FreeBSD0904 at fh-karlsruhe dot de
@
text
@a95 1
	else
@


1.38
log
@If we don't have /usr/sbin/mtree, try to mount /usr.  We're only likely
to hit this case when /usr is remote and thus hasn't been mounted (since
you're supposed to have /var before mounting remote file systems).
Normal machines that don't have a /var for some reason will have /usr
already available because it's local.
@
text
@a48 2

	# XXX: should create spool dirs for lpd
@


1.37
log
@ - Update etc/rc.d/newsyslog to FreeBSD standards and install it.
 - Enable it by default, running newsyslog with -CN which creates files
   that have the C flag specified in /etc/newsyslog.conf.
 - Remove the "newsyslog -CC" call from etc/rc.d/var and the check for
   newsyslog.
 - Add the C flag to entries in /etc/newsyslog.conf that are currently
   installed as part of the base system.

There are two effects from this change:
 - Users who delete default syslog files to stop logging to them
   will need to set newsyslog_enable=NO in rc.conf or remove the C
   flag from those file in /etc/newsyslog.conf or they will come back
   on the next boot.
 - Diskless systems now create the same set of files that ordinary
   systems have by default instead of every file in newsyslog.conf.
@
text
@d86 12
a97 2
	elif [ ! -x /usr/sbin/mtree ] ; then
		false
a98 1
		_populate_var
@


1.36
log
@- Remove the dependency of /usr/bin/touch by using "cp /dev/null <target>"
  to create /var/log/lastlog.
- Also create /var/log/wtmp if missing.
- Attempt to create these files unless populate_var is NO rather then
  only when /var is empty or populate_var=YES.
@
text
@a49 2
	/usr/sbin/newsyslog -CC

d86 1
a86 1
	elif [ ! -x /usr/sbin/mtree -o ! -x /usr/sbin/newsyslog ] ; then
@


1.35
log
@Add two new rc.conf options: tmpmfs_flags and varmfs_flags.

These can be used to pass extra options to the mdmfs(8) utility,
to customize the finer details of the md file system creation
(i.e. to turn on/off softupdates, to specify a default owner for md
filesystem, etc).

Use these two new flags to mount tmpmfs and varmfs without
softupdates, since it doesn't make much sense to use SU on
malloc-backed file systems.

Reviewed by:	mtm
Inspired by:	J. D. Bronson, jbronson at wixb dot com
@
text
@a51 2
	/usr/bin/touch /var/log/lastlog

d83 1
d88 1
a88 2
	elif [ ! -x /usr/sbin/mtree -o ! -x /usr/sbin/newsyslog -o \
	    ! -x /usr/bin/touch ] ; then
d95 10
@


1.34
log
@Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
@
text
@d64 1
a64 1
	mount_md ${varsize} /var
d72 1
a72 1
		mount_md ${varsize} /var
@


1.33
log
@A power failure left the temporary /var/.diskless directory
on my system, and since then my /var was always created as
MFS which was very surprising.  Fix this for /tmp and /var.
@
text
@a31 1
# KEYWORD: FreeBSD
@


1.32
log
@Overhaul the /etc/rc.d/diskless script by splitting it out into
hostname, resolve, tmp, and var scripts.  The latter three are new and
were repo copied.  These scripts no longer depend on being booted with
and NFS root instead attempt to automaticly create mfs /tmp and /var
volumes if the they are not writable.  This behavior can be overridden
in /etc/rc.conf.

Reviewed by:    luigi, pjd
@
text
@d70 1
a70 1
	if (/bin/mkdir /var/.diskless 2> /dev/null); then
@


1.32.2.1
log
@RCS file: /home/ncvs/src/etc/rc,v
----------------------------
revision 1.335
date: 2004/10/08 14:23:49;  author: mtm;  state: Exp;  lines: +0 -1
Remove an unused variable.

Submitted by: Pawel Worach <pawel.worach@@telia.com>
----------------------------
revision 1.334
date: 2004/10/07 13:55:25;  author: mtm;  state: Exp;  lines: +1 -1
Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/nsswitch,v
----------------------------
revision 1.4
date: 2004/09/16 17:03:12;  author: keramida;  state: Exp;  lines: +1 -1
Fix requirement of `network' to `NETWORK' because the former isn't
provided by any rc.d script.

Approved by:	mtm
=============================================================================
RCS file: /home/ncvs/src/etc/rc.d/pflog,v
----------------------------
revision 1.3
date: 2004/09/16 17:04:20;  author: keramida;  state: Exp;  lines: +1 -1
We don't have any providers of `beforenetlkm' in FreeBSD.  Remove the
dependency to it from our rc.d scripts.

Approved by:	mtm
=============================================================================

Approved by: re/scottl
@
text
@d32 1
@


1.32.2.2
log
@MFC rev 1.33:

  A power failure left the temporary /var/.diskless directory
  on my system, and since then my /var was always created as
  MFS which was very surprising.  Fix this for /tmp and /var.

Approved by:    re (kensmith)
@
text
@d69 1
a69 1
	if (/bin/mkdir -p /var/.diskless 2> /dev/null); then
@


1.32.2.3
log
@MFC: defaults/rc.conf	-> 1.230, 1.231
     rc.subr		-> 1.32, 1.33
     rc.d/tmp		-> 1.35
     rc.d/var		-> 1.35

Fix a minor, cosmetic typo of `rc.subr'.
Add two new rc.conf options: tmpmfs_flags and varmfs_flags.

These can be used to pass extra options to the mdmfs(8) utility,
to customize the finer details of the md file system creation
(i.e. to turn on/off softupdates, to specify a default owner for
md filesystem, etc).

Use these two new flags to mount tmpmfs and varmfs without
softupdates, since it doesn't make much sense to use SU on
malloc-backed file systems.
@
text
@d64 1
a64 1
	mount_md ${varsize} /var "${varmfs_flags}"
d72 1
a72 1
		mount_md ${varsize} /var "${varmfs_flags}"
@


1.32.2.4
log
@MFC:
Allow chkprintcap(8) to be run before lpd is started.  Disabled by
default. Default flags create missing directories.

Remove comment about doing this in etc/rc.d/var.

PR:		conf/71488
@
text
@d53 2
@


1.32.2.5
log
@MFC rev 1.38: attempt to mount /usr if we need to populate /var and we
can't find mtree.

PR:		conf/71757
@
text
@d87 4
a90 1
	elif [ -x /usr/sbin/mtree ] ; then
a91 10
	else
		# We need mtree to populate /var so try mounting /usr.
		# If this does not work, we can not boot so it is OK to
		# try to mount out of order.
		mount /usr
		if [ ! -x /usr/sbin/mtree ] ; then
			exit 1
		else
			_populate_var
		fi
@


1.31
log
@Mark scripts as not usable inside a jail by adding keyword 'nojail'.

Some suggestions from:	rwatson, Ruben de Groot <mail25@@bzerk.org>
@
text
@d30 22
a51 22
# PROVIDE: diskless
# REQUIRE: initdiskless rcconf mountcritlocal
# BEFORE: addswap random
# KEYWORD: FreeBSD nojail

dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
[ ${dlv:=0} -eq 0 ] && exit 0

name="diskless2"

# Provide a function for normalizing the mounting of memory
# filesystems.  This should allow the rest of the code here to remain
# as close as possible between 5-current and 4-stable.
#   $1 = size
#   $2 = mount point
#   $3 = (optional) bytes-per-inode
mount_md() {
	if [ -n "$3" ]; then
		bpi="-i $3"
	fi
	/sbin/mdmfs $bpi -s $1 -M md $2
}
d53 1
a53 28
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/rc.subr ]; then
	. /etc/rc.subr
	load_rc_config $name
elif [ -r /etc/defaults/rc.conf ]; then
	. /etc/defaults/rc.conf
	source_rc_confs
elif [ -r /etc/rc.conf ]; then
	. /etc/rc.conf
fi

# If we do not have a writable /var, create a memory
# filesystem for /var.  We don't have /usr yet so
# use mkdir instead of touch to test.  We want mount
# to record its mounts so we have to make sure /var/db
# exists before doing the mount -a.
#
if (/bin/mkdir /var/.diskless 2> /dev/null); then
        rmdir /var/.diskless
else
	echo "+++ mount_md of /var"
	mount_md ${varsize:=32m} /var
fi

if [ ! -d /var/db ]; then
	mkdir /var/db
fi
d55 2
a56 3
# Now we need the rest of our mounts, particularly /usr
#
mount -a       # chown and chgrp are in /usr
d58 10
a67 6
# Populate /var
#
echo "+++ populate /var using /etc/mtree/BSD.var.dist"
/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null
case ${sendmail_enable} in
[Nn][Oo][Nn][Ee])
d70 5
a74 2
	/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null
	;;
a76 5
echo "+++ create log files based on the contents of /etc/newsyslog.conf"
LOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } ' /etc/newsyslog.conf`
if [ -n "$LOGFILES" ]; then
	/usr/bin/touch $LOGFILES
fi
d78 8
a85 8
echo "+++ create lastlog"
/usr/bin/touch /var/log/lastlog

# Make sure our aliases database is uptodate, the aliases may have
# been overriden in /conf.
#
case ${sendmail_enable} in
[Nn][Oo][Nn][Ee])
d88 8
a95 1
	/usr/bin/newaliases
a97 57

# XXX make sure to create one dir for each printer as requested by lpd
#
# If we do not have a writable /tmp, create a memory
# filesystem for /tmp.  If /tmp is a symlink (e.g. to /var/tmp,
# then it should already be writable).
#
if (/bin/mkdir /tmp/.diskless 2> /dev/null); then
	rmdir /tmp/.diskless
else
	if [ -h /tmp ]; then
		echo "*** /tmp is a symlink to a non-writable area!"
		echo "dropping into shell, ^D to continue anyway."
		/bin/sh
	else
		mount_md ${tmpsize:=20480} /tmp
		chmod 01777 /tmp
	fi
fi

if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
	# we have DEVFS, no worries...
	true
elif (/bin/mkdir /dev/.diskless 2> /dev/null); then
	# if /dev is writable assume it has already been populated
	# via /etc/rc.d/initdiskless
	#
	rmdir /dev/.diskless
else
	(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
	mount_md 4096 /dev 512
	(cd /; cpio -i -H newc -d < /tmp/dev.tmp)
	rm -f /tmp/dev.tmp
fi

# generate our hostname
#
if [ -z "`hostname -s`" -a \
    "x`/bin/kenv dhcp.host-name`" != "x" ]; then
        hostname=`/bin/kenv dhcp.host-name`
        hostname $hostname
	echo "Hostname is $hostname"
fi

# if the info is available via dhcp/kenv
# build the resolv.conf
#
if [ ! -e /etc/resolv.conf -a \
    "x`/bin/kenv dhcp.domain-name-servers`" != "x" ]; then
        echo domain `/bin/kenv dhcp.domain-name` > /etc/resolv.conf

        set `/bin/kenv dhcp.domain-name-servers`
        for ns in `IFS=','; echo $*`; do
                echo nameserver $ns >> /etc/resolv.conf;
        done
fi

@


1.30
log
@Don't run newaliases if sendmail_enable=NONE.

Submitted by:	Matt Peterson <matt at peterson dot org>
Approved by:	silence on freebsd-rc
@
text
@d33 1
a33 1
# KEYWORD: FreeBSD
@


1.29
log
@Update references to rc.diskless[12]
@
text
@d110 7
a116 1
/usr/bin/newaliases
@


1.28
log
@Fix typo.

Spotted by:	"Bjoern A. Zeeb" <bzeeb@@zabbadoz.net>
@
text
@d136 1
a136 1
	# via rc.diskless1
@


1.27
log
@More checking if kenv actually know something.

Guard against test(1)-unfriendly outputs from kenv.
@
text
@d149 1
a149 1
    "x`/bin/kenv dhdp.host-name`" != "x" ]; then
@


1.26
log
@In case we have no /etc/resolv.conf, don't try to make it out of
thin blue air if the kenv doesn't have any info.

This improves the truth value of the comment above significantly and
reduces the bogous output on the console considerably.
@
text
@d148 2
a149 1
if [ -z "`hostname -s`" ]; then
d158 2
a159 1
if [ ! -e /etc/resolv.conf -a `/bin/kenv dhcp.domain-name-servers` != "" ]; then
@


1.25
log
@kenv moved from /usr/bin/ to /bin/.
@
text
@d157 1
a157 1
if [ ! -e /etc/resolv.conf ]; then
@


1.24
log
@Do not unconditionally load the configuration files for the RCNG case.
Instead, load them as part of the rc.d system.  This allows us to prioritize
the initidiskless script so it runs before the configuration files are loaded
and allows us to get rid of the exit 2 hack in /etc/rc.  The exit 2 never
worked anyway since it did not unset the prior configuration, causing the
diskless code to not operate properly.

Do a major cleanup and revamping of the diskless code for RCNG.  This will
be backported to the non-RCNG scripts as well as -stable.

With suggestions from: Mike Makonnen <mtm@@identd.net>
MFC after:	7 days
@
text
@d149 1
a149 1
        hostname=`/usr/bin/kenv dhcp.host-name`
d158 1
a158 1
        echo domain `/usr/bin/kenv dhcp.domain-name` > /etc/resolv.conf
d160 1
a160 1
        set `/usr/bin/kenv dhcp.domain-name-servers`
@


1.23
log
@Fix style bugs:
* Space -> tabs conversion.
* Removed blanks before semicolon in "if ... ; then".
* Proper indentation of misindented lines.
* Put a full stop after some comments.
* Removed whitespace at end of line.

Approved by:	silence from gordon
@
text
@d31 1
a31 1
# REQUIRE: initdiskless mountcritlocal
d45 4
a48 6
#   $3 = md unit number (ignored in pre 5.0 systems)
#   $4 = (optional) bytes-per-inode
mount_md()
{
	if [ -n "$4" ]; then
		bpi="-i $4"
d50 1
a50 1
	/sbin/mdmfs $bpi -s $1 -M md$3 $2
d65 12
a76 2
echo "+++ mount_md of /var"
mount_md ${varsize:=32m} /var 1
d78 10
d89 1
a89 1
/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var
d94 1
a94 1
	/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p /
d107 4
a110 6
mount -a       # chown and chgrp are in /usr

# Since we are starting with a very fresh /etc on an MFS:
if [ -d /conf/default/etc ]; then
	newaliases
fi
a111 1
#
d114 3
a116 3

# If /tmp is a symlink, assume it points to somewhere writable, like
# /var/tmp, otherwise, use a small memory filesystem for /tmp.
d118 11
a128 6
# XXX: mtree runs too early to create any directories needed in /tmp,
# so if /var/tmp == /tmp, then you don't get a vi.recover.
#
if [ ! -L /tmp ]; then
	mount_md ${tmpsize:=64m} /tmp 2
	chmod 01777 /tmp
d131 1
a131 1
if sysctl vfs.devfs.generation > /dev/null 2>&1; then
d134 5
a139 1
	# extract a list of device entries, then copy them to a writable fs
d141 1
a141 1
	mount_md 4096 /dev 3 512
d143 1
d145 21
@


1.22
log
@test -h is deprecated; use -L instead.

PR:             bin/40846
@
text
@d58 2
a59 2
        . /etc/rc.subr
        load_rc_config $name
d111 1
a111 1
if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
@


1.21
log
@Use mdmfs(8) rather than rolling our own RAM-disks.

Sponsored by:	DARPA & NAI Labs.
@
text
@d106 1
a106 1
if [ ! -h /tmp ]; then
@


1.20
log
@Apply same fix as Rev 1.19 of /etc/rc.diskless2: create sendmail
required directories if sendmail_enable is not set to "none".

Suggested by:   gordon
@
text
@d52 1
a52 4
	/sbin/mdconfig -a -t malloc -s $1 -u $3
	/sbin/disklabel -r -w md$3 auto
	/sbin/newfs $bpi /dev/md$3c
	/sbin/mount /dev/md$3c $2
@


1.19
log
@Merge in all the changes that Mike Makonnen has been maintaining for a
while. This is only the script pieces, the glue for the build comes next.

Submitted by:   Mike Makonnen <makonnen@@pacbell.net>
Reviewed by:    silence on -current and -hackers
Prodded by:     rwatson
@
text
@d76 7
@


1.18
log
@fix backwards spelling
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.17 2002/02/23 01:49:20 obrien Exp $
d63 7
@


1.17
log
@The usage of 'newaliases' needs to be after we know for sure that /usr
is mounted.

Submitted by:	rizzo
@
text
@d25 1
a25 1
# $FreeBSD$
d78 1
a78 1
if
@


1.16
log
@The existing bazaar and site-specific policy in rc.diskless1 is Just Wrong;
and looks like no other Unix diskless configuration I've ever seen.
Thus allow a more traditional /etc.

Note, the use of an MFS /var should also be settable.
Otherwise installing ports(packages) is just a total PITA.
@
text
@d75 5
@


1.15
log
@o Add a comment indicating that if /tmp==/var/tmp in rc.diskless2, the
  md device and file system creation occurs *after* mtree is run, and
  as such an /var/tmp/* or /tmp/* entries will be under the mountpoint
  (or fail) rather than appearing in the md filesystems.  This prevents
  the creation of vi.recover, and might affect other localizations that
  rely on the mtree calls affecting these directories.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.14 2001/11/27 22:12:27 rwatson Exp $
d59 1
a59 1
mount_md ${varsize:=65536} /var 1
d86 1
a86 1
	mount_md ${tmpsize:=20480} /tmp 2
@


1.14
log
@Remeber to set the permissions on an md-backed /tmp to 01777, rather than
using the default of 0755.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.13 2001/10/17 14:30:19 bsd Exp $
d81 4
@


1.13
log
@Ensure that /var/log/lastlog exists so that login doesn't complain.

Submitted by:	Harti Brandt <brandt@@fokus.gmd.de>
MFC after:	2 weeks
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.12 2001/06/01 10:07:15 ru Exp $
d83 1
@


1.12
log
@Remove vestiges of MFS.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.11 2001/05/09 15:13:51 bsd Exp $
d69 3
@


1.11
log
@  * Simplify the population of the /etc memory filesystem.  To avoid
    the null mount, we currently create a temporary mfs on /tmp, copy
    /etc to /tmp, then mount /etc as mfs and copy everything back from
    /tmp, then delete the /tmp mfs.

    The patch eliminates the temporary /tmp mfs and the subsequent
    copying and simply populates the /etc mfs by copying from
    /conf/default/etc.  This requires that /conf/default/etc contain a
    complete copy of all the /etc stuff instead of just overrides.  I
    don't think that is too much of an extra step in setting up a
    diskless environment.

  * Provide the ability to make /tmp a memory filesystem independent
    of /var.  This removes the requirement that /tmp be a symlink to
    /var/tmp and this makes the diskless code work with the default
    filesystem layout.  If a seperate /tmp memory filesystem is
    created, the 'tmpsize' environment variable is used to determine
    its size (default to 10 Meg).

  * Reduce diffs between the -current and -stable versions of these
    files to a bare minimum.  Only the definition of the shell
    function 'mount_md' is different.

Not Objected to by: -arch@@, -small@@

MFC after: 2 days
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.10 2001/05/01 20:13:59 phk Exp $
d58 1
a58 1
echo "+++ mfs_mount of /var"
@


1.10
log
@Don't mount a md(4) over /dev on DEVFS enabled diskless systems.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.9 2001/04/25 05:46:40 imp Exp $
d32 7
d40 3
d45 1
a45 1
	/sbin/newfs /dev/md$3c
d59 1
a59 1
mount_md ${varsize:=65536} /var 2
d76 5
a80 5
# We assume that /tmp is symlinked to /var/tmp on the shared root
# partition. mount_null seems to have problems.
#if [ ! -h /tmp -a ! -h /var/tmp ]; then
#	mount_null /var/tmp /tmp
#fi
d88 1
a88 1
	mount_mfs -s 4096 -i 512 -T qp120at dummy /dev
@


1.9
log
@Move to using md.
o create a simple wrapper function mount_md that makes it easy to
  move from mount_mfs.

# NOTE: you will need to MAKEDEV md[0123] in order for this to work.

Reviewed by: bsd, keichii
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.8 2001/04/24 07:02:01 imp Exp $
d72 9
a80 5
# extract a list of device entries, then copy them to a writable partition
(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
echo "+++ mount_mfs of /dev"
mount_md 4096 /dev 3
(cd /; cpio -i -H newc -d < /tmp/dev.tmp)
@


1.8
log
@MFS: the MFS still applies to -current until such time as someone fixes
rc.diskless2 to use mdconfig rather than mount_mfs.  These changes are
still relevant to -current.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.7 2000/10/08 19:18:24 obrien Exp $
d32 7
d49 1
a49 1
mount_mfs -s ${varsize:=65536} -T qp120at dummy /var
d75 1
a75 1
mount_mfs -s 4096 -i 512 -T qp120at dummy /dev
@


1.7
log
@Add copyright notices.  Other systems have been barrowing our /etc files
w/o giving any credit.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.6 2000/04/27 08:43:48 sheldonh Exp $
d41 1
d43 12
a54 12
var_dirs="run dev db msgs tmp spool spool/mqueue spool/lpd spool/output \
	spool/output/lpd"
for i in ${var_dirs}
do
    mkdir /var/${i}
done
chmod 755 /var/run
chmod 755 /var/db
chmod 755 /var/spool
chmod 1777 /var/tmp
chown -R root.daemon /var/spool/output
chgrp daemon /var/spool/lpd
d59 5
a63 3
if [ ! -h /tmp -a ! -h /var/tmp ]; then
	mount_null /var/tmp /tmp
fi
d67 1
@


1.6
log
@Add to defaults/rc.conf a new function source_rc_confs which rc
scripts may use to source safely overrides in ${rc_conf_files}
files.

This protects users who insist on the bad practice of copying
/etc/defaults/rc.conf to /etc/rc.conf from a recursive loop
that exhausts available file descriptors.

Several people have expressed interest in breaking this function
out into its own shell script.  Anyone who wants to embark on
such an undertaking would do well to study the attributed PR.

PR:		17595
Reported by:	adrian
Submitted by:	Doug Barton <Doug@@gorean.org>
@
text
@d1 27
a27 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5 2000/01/06 18:17:38 luigi Exp $
@


1.5
log
@Cleanup diskless support in current, mostly aligning it to the one
in the 3.x branch. Also remove the dependency on /usr to find the
boot address/interface.
Mostly-submitted-abd-tested-by: MIHIRA Sanpei Yoshiro <sanpei@@sanpei.org>
@
text
@d1 1
a1 1
# $FreeBSD: src/etc/rc.diskless2,v 1.4 1999/09/13 17:09:07 peter Exp $
d10 1
@


1.5.2.1
log
@MFC:	- add source_rc_confs

Reminded of, while working on the readline MFC, by:
	Mike Harding <mvh@@ix.netcom.com>
@
text
@d1 1
a1 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5 2000/01/06 18:17:38 luigi Exp $
a9 1
	source_rc_confs
@


1.5.2.2
log
@MFC: Add copyright.
@
text
@d1 1
a1 27
# Copyright (c) 1999  Matt Dillon
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#

@


1.5.2.3
log
@MFC: add copyright notices
@
text
@d25 1
a25 27
# Copyright (c) 1999  Matt Dillon
#

# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.2 2000/10/30 10:40:11 obrien Exp $
@


1.5.2.4
log
@Grrr. patch really did a number on me with these.
@
text
@d25 27
a51 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.3 2001/03/06 01:58:45 obrien Exp $
@


1.5.2.5
log
@Fixes for diskless support.
in /etc/rc, let rc.diskless2 do the necessary mounts instead of
running mount -a -t nonfs

in /etc/rc.diskless2, do the various mounts in the right order

Approved-by: jkh
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.4 2001/03/06 02:15:04 obrien Exp $
a40 1
echo "+++ mfs_mount of /var"
a43 1
echo "+++ mfs_mount of /var"
d48 3
a50 1
chmod 755 /var/run /var/db /var/spool
a53 2

mount -a       # chown and chgrp are in /usr
d58 3
a60 5
# We assume that /tmp is symlinked to /var/tmp on the shared root
# partition. mount_null seems to have problems.
#if [ ! -h /tmp -a ! -h /var/tmp ]; then
#	mount_null /var/tmp /tmp
#fi
a63 1
echo "+++ mount_mfs of /dev"
@


1.5.2.6
log
@(This is an intentional direct commit to -stable.  The MFS stuff
 doesn't really apply to -current anymore.)

Populate and set permissions on /var using mtree and
/etc/mtree/BSD.var.dist instead of hardcoding the directories and
permissions within this script.

Create initial log files based on the contents of /etc/newsyslog.conf.

Reviewed by:	luigi
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.5 2001/04/17 15:52:28 luigi Exp $
d43 11
a53 9

echo "+++ populate /var using /etc/mtree/BSD.var.dist"
/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var

echo "+++ create log files based on the contents of /etc/newsyslog.conf"
LOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } ' /etc/newsyslog.conf`
if [ -n "$LOGFILES" ]; then
	/usr/bin/touch $LOGFILES
fi
a55 1

@


1.5.2.7
log
@MFC: /etc bootstrap simplifications, ability to make /tmp a seperate
     memory filesystem, minimize differences between -current and
     releng_4.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.6 2001/04/22 23:14:46 bsd Exp $
a31 14
# Provide a function for normalizing the mounting of memory
# filesystems.  This should allow the rest of the code here to remain
# as close as possible between 5-current and 4-stable.
#   $1 = size
#   $2 = mount point
#   $3 = md unit number (ignored in pre 5.0 systems)
#   $4 = (optional) bytes-per-inode
mount_md() {
	if [ -n "$4" ]; then
		bpi="-i $4"
	fi
	/sbin/mount_mfs -s $1 -T qp120at $bpi dummy $2
}

d42 1
a42 1
mount_md ${varsize:=65536} /var 1
d59 11
a69 15
# If /tmp is a symlink, assume it points to somewhere writable, like
# /var/tmp, otherwise, use a small memory filesystem for /tmp.
if [ ! -h /tmp ]; then
	mount_md ${tmpsize:=20480} /tmp 2
fi

if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
	# we have DEVFS, no worries...
	true
else
	# extract a list of device entries, then copy them to a writable fs
	(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
	mount_md 4096 /dev 3 512
	(cd /; cpio -i -H newc -d < /tmp/dev.tmp)
fi
@


1.5.2.8
log
@Removing old, broken DEVFS from -stable phase one: remove support
code, everything under #ifdef DEVFS (and thus opt_devfs.h), and most
references to the DEVFS routines.  Code that really couldn't be
reached was left alone.  Removal of the actual DEVFS implementation
will come later.

Approved by:	-stable
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.7 2001/05/11 17:46:57 bsd Exp $
d79 9
a87 4
# extract a list of device entries, then copy them to a writable fs
(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
mount_md 4096 /dev 3 512
(cd /; cpio -i -H newc -d < /tmp/dev.tmp)
@


1.5.2.9
log
@MFC Rev 1.13, ensure that /var/log/lastlog exists so that login
doesn't complain.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.8 2001/07/24 09:49:37 dd Exp $
a65 3

echo "+++ create lastlog"
/usr/bin/touch /var/log/lastlog
@


1.5.2.10
log
@Fix the scripts for diskless boot. Apart from various changes in the
comments to reflect reality and explain the boot process a bit better,
the main changes are the following:

rc.diskless1:
	Use -b 4096 -f 1024 as mount parameters, and increase the
	/etc MFS partition size to 8192 blocks.
	Initially populate /etc from /conf/base/etc

rc.diskless2:
	Use -b 4096 -f 1024 as mount parameters, move "mount -a"
	up a bit so various utilities located in /usr can be
	actually run when /usr is not on the same filesystem as /
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.9 2001/11/02 23:20:43 bsd Exp $
d43 1
a43 1
	/sbin/mount_mfs -s $1 -T qp120at -b 4096 -f 1024 $bpi dummy $2
a57 2
mount -a       # chown and chgrp are in /usr

d69 2
@


1.5.2.11
log
@Make the fs use 8k/1k blocks as 4:1 ratios are reported to
give trouble sometimes. Probably 4096/512 would be ok too, but
since i do not have a chance now to test it thoroughly i prefer
to stay on the safe side (8k/1k is what was used before 4.5).

Suggested-by: Warner Losh
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.10 2002/02/12 17:25:11 luigi Exp $
d43 1
a43 1
	/sbin/mount_mfs -s $1 -T qp120at -b 8192 -f 1024 $bpi dummy $2
@


1.5.2.12
log
@Two [minor] performance fixes for diskless configurations:
when copying large trees into /etc and /dev, try to fetch the
content from a cpio archive if there is one available, so the
operation does not take multiple RTTs for each individual file.
clone_root has been updated to generate the cpio archives,
rc.diskless* to make use of them.

Not committed to -current yet because the relevant files are
already slightly different in the two branches, and I would like
to have a chance to test it there first before resyncing the two
versions.
@
text
@d25 1
a25 1
# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.11 2002/02/12 18:36:23 luigi Exp $
d82 2
a83 9
# Extract a list of device entries, then copy them to a writable fs.
# The list can be long, so if there is already a cpio archive prepared
# for us, use that one instead.

if [ -f /conf/dev.cpio.gz ] ; then
	ln -s /conf/dev.cpio.gz /tmp/dev.cpio.gz
else
	(cd /; find -x dev | cpio --create -H newc | gzip) > /tmp/dev.cpio.gz
fi
d85 1
a85 1
(cd /; gzip -dc /tmp/dev.cpio.gz | cpio --extract -H newc -d )
@


1.5.2.13
log
@MFC Rev 1.19: Create sendmail required directories if sendmail is
              enabled.

PR:	misc/39350
@
text
@d25 1
a25 1
# $FreeBSD$
a61 7
case ${sendmail_enable} in
[Nn][Oo][Nn][Ee])
	;;
*)
	/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p /
	;;
esac
@


1.4
log
@Add/adjust some $FreeBSD$ tags.

Noted by:	Doug <Doug@@gorean.org>
@
text
@d1 1
a1 1
# $FreeBSD: src/etc/rc.diskless2,v 1.3 1999/09/13 15:44:18 sheldonh Exp $
d14 7
a20 4
mount_mfs -s ${var_run_sectors:=2048} -T qp120at dummy /var/run
mount_mfs -s ${var_db_sectors:=16384} -T qp120at dummy /var/db
mount_mfs -s ${var_tmp_sectors:=65536} -T qp120at dummy /var/tmp
mount_mfs -s ${var_spool_sectors:=65536} -T qp120at dummy /var/spool
d25 5
d35 1
a35 7
mkdir /var/spool/mqueue
mkdir /var/spool/lpd
mkdir /var/spool/output
mkdir /var/spool/output/lpd
chown -R root.daemon /var/spool/output
chgrp daemon /var/spool/lpd

@


1.3
log
@Apply a consistent style to most of the etc scripts.  Particularly, use
case instead of test where appropriate, since case allows case is a sh
builtin and (as a side-effect) allows case-insensitivity.

Changes discussed on freebsd-hackers.

Submitted by:	Doug Barton <Doug@@gorean.org>
@
text
@d1 1
a1 2
#
#$FreeBSD$
@


1.2
log
@Use /etc/defaults/rc.conf everywhere, falling back to /etc/rc.conf
as necessary (for half-assed upgrades).
@
text
@d1 3
d9 1
a9 1
if [ -f /etc/defaults/rc.conf ]; then
d11 1
a11 1
elif [ -f /etc/rc.conf ]; then
d35 1
a35 1
( cd /; find -x dev | cpio -o -H newc ) > /tmp/dev.tmp
d37 1
a37 2
( cd /; cpio -i -H newc -d < /tmp/dev.tmp )

@


1.2.2.1
log
@MFC: bring support for diskless in RELENG_3
@
text
@d12 4
a15 7
mount_mfs -s ${varsize:=65536} -T qp120at dummy /var
var_dirs="run dev db msgs tmp spool spool/mqueue spool/lpd spool/output \
	spool/output/lpd"
for i in $var_dirs
do
    mkdir /var/$i
done
a19 5
chown -R root.daemon /var/spool/output
chgrp daemon /var/spool/lpd
#
# XXX make sure to create one dir for each printer as requested by lpd
#
d25 7
a31 1
# extract a list of device entries, then copy them to a writable partition
@


1.1
log
@    Revamp rc.diskless.  Split into rc.diskless1 and rc.diskless2.  provide
    more opportunities for overriding.  Clean up /etc/rc ( remove conf_dir,
    remove startup mount special cases, remove other special cases )
@
text
@d6 4
a9 3

if [ -f /etc/rc.conf ]; then
        . /etc/rc.conf
@

