diff options
| author | cvs2svn <cvs2svn@FreeBSD.org> | 2003-12-07 03:02:28 +0000 |
|---|---|---|
| committer | cvs2svn <cvs2svn@FreeBSD.org> | 2003-12-07 03:02:28 +0000 |
| commit | a348451bd8bd6d66bcb5b23f2aaec00e74c1292f (patch) | |
| tree | 9ec09934982086efda46b256741376768b702210 /etc | |
| parent | e56b2c57d71d0f9232936aaac58617fed29ac33d (diff) | |
Notes
Diffstat (limited to 'etc')
| -rw-r--r-- | etc/rc.d/lockd | 46 | ||||
| -rw-r--r-- | etc/rc.d/ppp | 48 | ||||
| -rw-r--r-- | etc/rc.d/resolv | 167 | ||||
| -rw-r--r-- | etc/rc.d/statd | 46 | ||||
| -rw-r--r-- | etc/rc.d/tmp | 167 | ||||
| -rw-r--r-- | etc/rc.d/var | 167 | ||||
| -rw-r--r-- | etc/rc.initdiskless | 240 |
7 files changed, 0 insertions, 881 deletions
diff --git a/etc/rc.d/lockd b/etc/rc.d/lockd deleted file mode 100644 index c250f94b9df73..0000000000000 --- a/etc/rc.d/lockd +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $ -# $FreeBSD$ -# - -# PROVIDE: nfslocking -# REQUIRE: nfsserver nfsclient nfsd -# BEFORE: DAEMON -# KEYWORD: FreeBSD NetBSD - -. /etc/rc.subr - -arg=$1 - -case ${OSTYPE} in -FreeBSD) - RCVAR_SERVER="nfs_server_enable" - RCVAR_CLIENT="nfs_client_enable" - RCVAR_STATD="rpc_statd_enable" - RCVAR_LOCKD="rpc_lockd_enable" - ;; -NetBSD) - RCVAR_SERVER="nfs_server" - RCVAR_CLIENT="nfs_client" - RCVAR_STATD="statd" - RCVAR_LOCKD="lockd" - ;; -esac - -start_precmd='checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT} || - [ -n "$rc_force" ]' -stop_precmd=$start_precmd -status_precmd=$start_precmd - -name="statd" -rcvar=${RCVAR_STATD} -command="/usr/sbin/rpc.${name}" -load_rc_config $name -run_rc_command "$arg" - -name="lockd" -rcvar=${RCVAR_LOCKD} -command="/usr/sbin/rpc.${name}" -load_rc_config $name -run_rc_command "$arg" diff --git a/etc/rc.d/ppp b/etc/rc.d/ppp deleted file mode 100644 index fa5c7c82698ef..0000000000000 --- a/etc/rc.d/ppp +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -# $FreeBSD$ -# - -# PROVIDE: ppp-user -# REQUIRE: netif isdnd -# KEYWORD: FreeBSD - -. /etc/rc.subr - -name="ppp" -rcvar="ppp_enable" -start_cmd="ppp_start" -stop_cmd=":" - -ppp_start() -{ - # Establish ppp mode. - # - if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \ - -a "${ppp_mode}" != "dedicated" \ - -a "${ppp_mode}" != "background" ]; then - ppp_mode="auto" - fi - - ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}" - - # Switch on NAT mode? - # - case ${ppp_nat} in - [Yy][Ee][Ss]) - ppp_command="${ppp_command} -nat" - ;; - esac - - ppp_command="${ppp_command} ${ppp_profile}" - - echo "Starting ppp as \"${ppp_user}\"" - su -m ${ppp_user} -c "exec ${ppp_command}" - - # Re-Sync ipfilter so it picks up any new network interfaces - # - /etc/rc.d/ipfilter resync -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/resolv b/etc/rc.d/resolv deleted file mode 100644 index 6e4bcc682e987..0000000000000 --- a/etc/rc.d/resolv +++ /dev/null @@ -1,167 +0,0 @@ -#!/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$ -# - -# PROVIDE: diskless -# REQUIRE: initdiskless rcconf mountcritlocal -# BEFORE: addswap random -# KEYWORD: FreeBSD - -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 -} - -# 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 - -# Now we need the rest of our mounts, particularly /usr -# -mount -a # chown and chgrp are in /usr - -# 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]) - ;; -*) - /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null - ;; -esac - -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 - -echo "+++ create lastlog" -/usr/bin/touch /var/log/lastlog - -# Make sure our aliases database is uptodate, the aliases may have -# been overriden in /conf. -# -/usr/bin/newaliases - -# 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 - diff --git a/etc/rc.d/statd b/etc/rc.d/statd deleted file mode 100644 index c250f94b9df73..0000000000000 --- a/etc/rc.d/statd +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $ -# $FreeBSD$ -# - -# PROVIDE: nfslocking -# REQUIRE: nfsserver nfsclient nfsd -# BEFORE: DAEMON -# KEYWORD: FreeBSD NetBSD - -. /etc/rc.subr - -arg=$1 - -case ${OSTYPE} in -FreeBSD) - RCVAR_SERVER="nfs_server_enable" - RCVAR_CLIENT="nfs_client_enable" - RCVAR_STATD="rpc_statd_enable" - RCVAR_LOCKD="rpc_lockd_enable" - ;; -NetBSD) - RCVAR_SERVER="nfs_server" - RCVAR_CLIENT="nfs_client" - RCVAR_STATD="statd" - RCVAR_LOCKD="lockd" - ;; -esac - -start_precmd='checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT} || - [ -n "$rc_force" ]' -stop_precmd=$start_precmd -status_precmd=$start_precmd - -name="statd" -rcvar=${RCVAR_STATD} -command="/usr/sbin/rpc.${name}" -load_rc_config $name -run_rc_command "$arg" - -name="lockd" -rcvar=${RCVAR_LOCKD} -command="/usr/sbin/rpc.${name}" -load_rc_config $name -run_rc_command "$arg" diff --git a/etc/rc.d/tmp b/etc/rc.d/tmp deleted file mode 100644 index 6e4bcc682e987..0000000000000 --- a/etc/rc.d/tmp +++ /dev/null @@ -1,167 +0,0 @@ -#!/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$ -# - -# PROVIDE: diskless -# REQUIRE: initdiskless rcconf mountcritlocal -# BEFORE: addswap random -# KEYWORD: FreeBSD - -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 -} - -# 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 - -# Now we need the rest of our mounts, particularly /usr -# -mount -a # chown and chgrp are in /usr - -# 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]) - ;; -*) - /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null - ;; -esac - -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 - -echo "+++ create lastlog" -/usr/bin/touch /var/log/lastlog - -# Make sure our aliases database is uptodate, the aliases may have -# been overriden in /conf. -# -/usr/bin/newaliases - -# 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 - diff --git a/etc/rc.d/var b/etc/rc.d/var deleted file mode 100644 index 6e4bcc682e987..0000000000000 --- a/etc/rc.d/var +++ /dev/null @@ -1,167 +0,0 @@ -#!/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$ -# - -# PROVIDE: diskless -# REQUIRE: initdiskless rcconf mountcritlocal -# BEFORE: addswap random -# KEYWORD: FreeBSD - -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 -} - -# 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 - -# Now we need the rest of our mounts, particularly /usr -# -mount -a # chown and chgrp are in /usr - -# 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]) - ;; -*) - /usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null - ;; -esac - -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 - -echo "+++ create lastlog" -/usr/bin/touch /var/log/lastlog - -# Make sure our aliases database is uptodate, the aliases may have -# been overriden in /conf. -# -/usr/bin/newaliases - -# 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 - diff --git a/etc/rc.initdiskless b/etc/rc.initdiskless deleted file mode 100644 index 513052af7ba5b..0000000000000 --- a/etc/rc.initdiskless +++ /dev/null @@ -1,240 +0,0 @@ -#!/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$ -# -# PROVIDE: initdiskless -# KEYWORD: FreeBSD - - -# On entry to this script the entire system consists of a read-only root -# mounted via NFS. We use the contents of /conf to create and populate -# memory filesystems. The kernel has run BOOTP and configured an interface -# (otherwise it would not have been able to mount the NFS root!) -# -# The following directories are scanned. Each sucessive directory overrides -# (is merged into) the previous one. -# -# /conf/base universal base -# /conf/default modified by a secondary universal base -# /conf/${ipba} modified based on the assigned broadcast IP -# /conf/${ip} modified based on the machine's assigned IP -# -# Each of these directories may contain any number of subdirectories which -# represent directories in / on the diskless machine. The existance of -# these subdirectories causes this script to create a MEMORY FILESYSTEM for -# /<sub_directory_name>. For example, if /conf/base/etc exists then a -# memory filesystem will be created for /etc. -# -# If a subdirectory contains the file 'diskless_remount' the contents of -# the file is used to remount the subdirectory prior to it being copied to -# the memory filesystem. For example, if /conf/base/etc/diskless_remount -# contains the string 'my.server.com:/etc' then my.server.com:/etc will be -# mounted in place of the subdirectory. This allows you to avoid making -# duplicates of system directories in /conf. -# -# If a subdirectory contains the file 'md_size', the contents of the -# file is used to determine the size of the memory filesystem, in 512 -# byte sectors. The default is 10240 (5MB). You only have to specify an -# md_size if the default doesn't work for you (i.e. if it is too big or -# too small). For example, /conf/base/etc/md_size might contain '16384'. -# -# If /conf/<special_dir>/SUBDIR.cpio.gz exists, the file is cpio'd into -# the specified /SUBDIR (and a memory filesystem is created for /SUBDIR -# if necessary). -# -# If /conf/<special_dir>/SUBDIR.remove exists, the file contains a list -# of paths which are rm -rf'd relative to /SUBDIR. -# -# You will almost universally want to create a /conf/base/etc containing -# a diskless_remount and possibly an md_size file. You will then almost -# universally want to override rc.conf, rc.local, and fstab by creating -# /conf/default/etc/{rc.conf,rc.local,fstab}. Your fstab should be sure -# to mount a /usr... typically an NFS readonly /usr. -# -# NOTE! /etc/rc.d/diskless will create /var, /tmp, and /dev. -# Those filesystems should not be specified in /conf. At least not yet. - -dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` -[ ${dlv:=0} -eq 0 ] && exit 0 - -# chkerr: -# -# Routine to check for error -# -# checks error code and drops into shell on failure. -# if shell exits, terminates script as well as /etc/rc. -# -chkerr() { - case $1 in - 0) - ;; - *) - echo "$2 failed: dropping into /bin/sh" - /bin/sh - # RESUME - ;; - esac -} - -# Create a generic memory disk -# -mount_md() { - /sbin/mdmfs -i 4096 -s $1 -M md $2 -} - -# Create the memory filesystem if it has not already been created -# -create_md() { - if [ "x`eval echo \\$md_created_$1`" = "x" ]; then - if [ "x`eval echo \\$md_size_$1`" = "x" ]; then - md_size=10240 - else - md_size=`eval echo \\$md_size_$1` - fi - mount_md $md_size /$1 - /bin/chmod 755 /$1 - eval md_created_$1=created - fi -} - -# DEBUGGING -# -# set -v - -# Figure out our interface and IP. -# -bootp_ifc="" -bootp_ipa="" -bootp_ipbca="" -iflist=`ifconfig -l` -for i in ${iflist} ; do - set `ifconfig ${i}` - while [ $# -ge 1 ] ; do - if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then - bootp_ifc=${i} ; bootp_ipa=${2} ; shift - fi - if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then - bootp_ipbca=$2; shift - fi - shift - done - if [ "${bootp_ifc}" != "" ] ; then - break - fi -done -echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}" - -# Figure out our NFS root path -# -set `mount -t nfs` -while [ $# -ge 1 ] ; do - if [ "$2" = "on" -a "$3" = "/" ]; then - nfsroot="$1" - break - fi - shift -done - -# Resolve templates in /conf/base, /conf/default, /conf/${bootp_ipbca}, -# and /conf/${bootp_ipa}. For each subdirectory found within these -# directories: -# -# - calculate memory filesystem sizes. If the subdirectory (prior to -# NFS remounting) contains the file 'md_size', the contents specified -# in 512 byte sectors will be used to size the memory filesystem. Otherwise -# 8192 sectors (4MB) is used. -# -# - handle NFS remounts. If the subdirectory contains the file -# diskless_remount, the contents of the file is NFS mounted over -# the directory. For example /conf/base/etc/diskless_remount -# might contain 'myserver:/etc'. NFS remounts allow you to avoid -# having to dup your system directories in /conf. Your server must -# be sure to export those filesystems -alldirs, however. -# If the diskless_remount file contains a string beginning with a -# '/' it is assumed that the local nfsroot should be prepended to -# it before attemping to the remount. This allows the root to be -# relocated without needing to change the remount files. -# -for i in base default ${bootp_ipbca} ${bootp_ipa} ; do - for j in /conf/$i/* ; do - # memory filesystem size specification - # - subdir=${j##*/} - if [ -d $j -a -f $j/md_size ]; then - eval md_size_$subdir=`cat $j/md_size` - fi - - # NFS remount - # - if [ -d $j -a -f $j/diskless_remount ]; then - nfspt=`/bin/cat $j/diskless_remount` - if [ `expr "$nfspt" : '\(.\)'` = "/" ]; then - nfspt="${nfsroot}${nfspt}" - fi - mount_nfs $nfspt $j - chkerr $? "mount_nfs $nfspt $j" - fi - done -done - -# - Create all required MFS filesystems and populate them from -# our templates. Support both a direct template and a dir.cpio.gz -# archive. Support dir.remove files containing a list of relative -# paths to remove. -# -# TODO: -# + find a way to assign a 'group' identifier to a machine -# so we can use group-specific configurations; - -for i in base default ${bootp_ipbca} ${bootp_ipa} ; do - for j in /conf/$i/* ; do - subdir=${j##*/} - if [ -d $j ]; then - create_md $subdir - cp -Rp $j/* /$subdir - fi - done - for j in /conf/$i/*.cpio.gz ; do - subdir=${j%*.cpio.gz} - subdir=${subdir##*/} - if [ -f $j ]; then - create_md $subdir - echo "Loading /$subdir from cpio archive $j" - (cd / ; /stand/gzip -d < $j | /stand/cpio --extract -d ) - fi - done - for j in /conf/$i/*.remove ; do - subdir=${j%*.remove} - subdir=${subdir##*/} - if [ -f $j ]; then - # doubly sure it is a memory disk before rm -rf'ing - create_md $subdir - (cd /$subdir; rm -rf `/bin/cat $j`) - fi - done -done - |
