Rewrite bootscripts and Chaper 7

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9574 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Bruce Dubbs 2011-08-02 02:15:42 +00:00
parent 75fe59983c
commit 0cda8984a8
47 changed files with 2093 additions and 2126 deletions

View File

@ -1,3 +1,19 @@
2011-07-14 Bruce Dubbs <bdubbs@linuxfromscratch.org>
* Major rewrite of all LFS scripts
** Move ifup/ifdown to /sbin
** Move functions and network services to /lib/boot
** Remove contrib directory
** Move all READ commands to functions and allow the user to specify
HEADLESS=1 to skip READ commands
** Add /etc/sysconfig/init_params for adding environmental parameters
to all functions used in bootscripts
** Move network configuration to /etc/sysconfig/ifconfig.*. The
ifconfig files can have any extention. Use IFACE parameter to
specify the target network interface within the configuration file.
** Adds an optional parameter, SKIPTMPCLEAN, to skip the removal of
files in /tmp at bootup. Specify the variable in
/etc/sysconfig/init_params.
2011-05-31 DJ Lucas <dj@linuxfromscratch.org> 2011-05-31 DJ Lucas <dj@linuxfromscratch.org>
* lfs/init.d/udev: Add multiple udev triggers for both subsystems and * lfs/init.d/udev: Add multiple udev triggers for both subsystems and
devices per upstream recommendation. devices per upstream recommendation.

View File

@ -1,29 +0,0 @@
Copyright (c) 1999-2002, Gerard Beekmans
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions in any form must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Neither the name of "Linux From Scratch" nor the names of its
contributors may be used to endorse or promote products derived from
this material without specific prior written permission.
* Any material derived from Linux From Scratch must contain a
reference to the "Linux From Scratch" project.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 REGENTS 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.

View File

@ -1,5 +1,6 @@
ETCDIR=/etc ETCDIR=/etc
EXTDIR=${DESTDIR}${ETCDIR} EXTDIR=${DESTDIR}${ETCDIR}
LIBDIR=${DESTDIR}/lib/boot
MODE=754 MODE=754
DIRMODE=755 DIRMODE=755
CONFMODE=644 CONFMODE=644
@ -17,14 +18,13 @@ create-dirs:
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rcsysinit.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rcsysinit.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d
install -d -m ${DIRMODE} ${EXTDIR}/sysconfig install -d -m ${DIRMODE} ${EXTDIR}/sysconfig
install -d -m ${DIRMODE} ${LIBDIR}
create-service-dir: install: create-dirs
install -d -m ${DIRMODE} ${EXTDIR}/sysconfig/network-devices/services
install: create-dirs create-service-dir
install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/
install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/ install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR}
install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/consolelog ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/consolelog ${EXTDIR}/rc.d/init.d/
@ -79,28 +79,29 @@ install: create-dirs create-service-dir
ln -sf ../init.d/console ${EXTDIR}/rc.d/rcsysinit.d/S70console ln -sf ../init.d/console ${EXTDIR}/rc.d/rcsysinit.d/S70console
ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rcsysinit.d/S80localnet ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rcsysinit.d/S80localnet
ln -sf ../init.d/sysctl ${EXTDIR}/rc.d/rcsysinit.d/S90sysctl ln -sf ../init.d/sysctl ${EXTDIR}/rc.d/rcsysinit.d/S90sysctl
if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/; fi if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then \
if [ ! -f ${EXTDIR}/sysconfig/modules ]; then install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/; fi install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/ ;\
if [ ! -f ${EXTDIR}/sysconfig/rc ]; then install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/; fi fi
install -m ${MODE} lfs/sysconfig/network-devices/ifup ${EXTDIR}/sysconfig/network-devices/ if [ ! -f ${EXTDIR}/sysconfig/modules ]; then \
install -m ${MODE} lfs/sysconfig/network-devices/ifdown ${EXTDIR}/sysconfig/network-devices/ install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/ ;\
install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static ${EXTDIR}/sysconfig/network-devices/services/ fi
install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static-route ${EXTDIR}/sysconfig/network-devices/services/ if [ ! -f ${EXTDIR}/sysconfig/rc ]; then \
install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/ ;\
fi
install -m ${MODE} lfs/sysconfig/network-devices/ifup /sbin
install -m ${MODE} lfs/sysconfig/network-devices/ifdown /sbin
install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static ${LIBDIR}
install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static-route ${LIBDIR}
install-consolelog: create-dirs install-consolelog: create-dirs
install -m ${MODE} contrib/init.d/consolelog ${EXTDIR}/rc.d/init.d install -m ${MODE} contrib/init.d/consolelog ${EXTDIR}/rc.d/init.d
ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S00consolelog ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S00consolelog
install-lsb-compliant: minimal: create-dirs
make -C contrib/lsb
install-service-mtu: create-service-dir
install -m ${MODE} contrib/sysconfig/network-devices/services/mtu ${EXTDIR}/sysconfig/network-devices/services
minimal: create-dirs create-service-dir
install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/
install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/ install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR}
install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/
@ -125,8 +126,9 @@ minimal: create-dirs create-service-dir
ln -sf ../init.d/checkfs ${EXTDIR}/rc.d/rcsysinit.d/S30checkfs ln -sf ../init.d/checkfs ${EXTDIR}/rc.d/rcsysinit.d/S30checkfs
ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rcsysinit.d/S40mountfs ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rcsysinit.d/S40mountfs
ln -sf ../init.d/cleanfs ${EXTDIR}/rc.d/rcsysinit.d/S45cleanfs ln -sf ../init.d/cleanfs ${EXTDIR}/rc.d/rcsysinit.d/S45cleanfs
if [ ! -f ${EXTDIR}/sysconfig/rc ]; then install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/; fi if [ ! -f ${EXTDIR}/sysconfig/rc ]; then \
install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/; \
fi
.PHONY: all create-dirs create-service-dir \ .PHONY: all create-dirs install
install install-service-mtu

View File

@ -1,33 +1,34 @@
Network Configuration: Network Configuration:
Script Files: Script Files:
rc.d/init.d/network /etc/rc.d/init.d/network
sysconfig/network-devices/ifup /sbin/ifup
sysconfig/network-devices/ifdown /sbin/ifdown
sysconfig/network-devices/services/* /lib/boot/*/*
Configuration Files: Configuration Files:
sysconfig/network-devices/ifconfig.*/* /etc/sysconfig/ifconfig.*
Note: ifconfig.* could be either a file or directory, Note: ifconfig.* could be either a file or directory,
but the filename extension must be the same name but the filename extension must be the same name
as the network interface you wish it to belong to. as the network interface you wish it to belong to.
The files within the directory will be processed The files within the directory will be processed
in alphanumerical order on boot, and reversed on in alphanumerical order on boot, and reversed on
shutdown. shutdown.
- IFACE: the interface that is being configured (e.g. eth0)
- SERVICE: which script to run in services directory. - SERVICE: which script to run in services directory.
- ONBOOT: if set to yes, this interface will be started on - ONBOOT: if set to yes, this interface will be started on
bootup, and stopped on shutdown bootup, and stopped on shutdown
sysconfig/network /etc/sysconfig/network
- HOSTNAME: Value of the system's hostname - HOSTNAME: Value of the system's hostname
Additional Configuration: Additional Configuration:
sysconfig/network-devices/ifconfig.*
ipv4-static: ipv4-static:
- IP: static IP Address - IP: static IP Address
- GATEWAY: Specifies the IP Address of the gateway server - GATEWAY: Specifies the IP Address of the gateway server
- PREFIX: CIDR prefix of IP Address, defaults to 24 if not set - PREFIX: CIDR prefix of IP Address, defaults to 24 if not set
- PEER: IP Address of peer (for point-to-point connections and tunnels) - PEER: IP Address of peer (for point-to-point connections and tunnels)
- BROADCAST: broadcast address - BROADCAST: broadcast address
ipv4-static-route: ipv4-static-route:
- TYPE: network (default type if not specified), default, host or - TYPE: network (default type if not specified), default, host or
unreachable unreachable
@ -38,17 +39,18 @@ Network Configuration:
SetClock configuration: SetClock configuration:
Script Files: Script Files:
rc.d/init.d/setclock /etc/rc.d/init.d/setclock
- SKIPTMPCLEAN: skips cleaning of /tmp directory
Configuration Files: Configuration Files:
sysconfig/clock /etc/sysconfig/clock
- UTC: 1 assumes hwclock is in UTC - UTC: 1 assumes hwclock is in UTC
0 assumes hwclock is in local time 0 assumes hwclock is in local time
- CLOCKPARAMS: any additional options to be passed to hwclock - CLOCKPARAMS: any additional options to be passed to hwclock
CleanFS configuration: CleanFS configuration:
Script Files: Script Files:
rc.d/init.d/cleanfs /etc/rc.d/init.d/cleanfs
Configuration Files: Configuration Files:
/etc/sysconfig/createfiles /etc/sysconfig/createfiles
@ -74,3 +76,4 @@ CleanFS configuration:
Used by character and block devices. Used by character and block devices.
Minor#: Minor#:
Used by character and block devices. Used by character and block devices.

View File

@ -1,11 +0,0 @@
ETCDIR=/etc
EXTDIR=${DESTDIR}${ETCDIR}
MODE=754
DIRMODE=755
CONFMODE=644
install:
install -d -m ${DIRMODE} ${DESTDIR}/lib/lsb
install -m ${CONFMODE} lib/init-functions ${DESTDIR}/lib/lsb
.PHONY: install

View File

@ -1,348 +0,0 @@
#*******************************************************************************
# Function - start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args]
#
# Purpose: This runs the specified program as a daemon
#
# Inputs: -f, run the program even if it is already running
# -n nicelevel, specifies a nice level. See nice(1).
# -p pidfile, uses the specified pidfile
# pathname, pathname to the specified program
# args, arguments to pass to specified program
#
# Outputs: return 0 - Success
# return 2 - Invalid or excessive number of arguments,
# warning in stdout
# return 4 - Program or service status is unknown
#
# Dependencies: nice
#
# Todo: none
#
#*******************************************************************************
start_daemon()
{
local pidfile=""
local forcestart=""
local nicelevel="0"
while true
do
case "${1}" in
-f)
forcestart="1"
shift 1
;;
-n)
nicelevel="${2}"
shift 2
;;
-p)
pidfile="${2}"
shift 2
;;
-*)
log_failure_msg "Unknown Option: ${1}"
return 2
;;
*)
break
;;
esac
done
if [ -z "${forcestart}" ]; then
if [ -z "${pidfile}" ]; then
pidofproc "${1}" > /dev/null
else
pidofproc -p "${pidfile}" "${1}" > /dev/null
fi
case "${?}" in
0)
log_warning_msg "Unable to continue: ${1} is running"
return 4
;;
1)
log_warning_msg "Unable to continue: ${pidfile} exists"
return 4
;;
3)
;;
*)
log_failure_msg "Unknown error code from pidofproc: ${?}"
return 4
;;
esac
fi
nice -n "${nicelevel}" "${@}"
}
#*******************************************************************************
# Function - killproc [-p pidfile] pathname [signal]
#
# Purpose:
#
# Inputs: -p pidfile, uses the specified pidfile
# pathname, pathname to the specified program
# signal, send this signal to pathname
#
# Outputs: return 0 - Success
# return 1 - Invalid or excessive number of arguments,
# warning in stdout
# return 4 - Unknown Status
#
# Dependencies: kill
#
# Todo: test
#
#*******************************************************************************
killproc()
{
local pidfile=""
local killsig=""
local pidlist=""
while true
do
case "${1}" in
-p)
pidfile="${2}"
shift 2
;;
-*)
log_failure_msg "Unknown Option: ${1}"
return 1
;;
*)
break
;;
esac
done
if [ "${#}" = "2" ]; then
killsig="${2}"
elif [ "${#}" != "1" ]; then
shift 2
log_failure_msg "Excess Arguments: $@"
return 1
fi
if [ -z "${pidfile}" ]; then
pidlist=`pidofproc "${1}"`
else
pidlist=`pidofproc -p "${pidfile}" "${1}"`
fi
for pid in ${pidlist}
do
kill -${killsig:-TERM} ${pid} 2> /dev/null
if [ -z "${killsig}" ]; then
# Wait up to 3 seconds, for ${pid} to terminate
local dtime=3
while [ "${dtime}" != "0" ]
do
kill -0 ${pid} 2> /dev/null || break
sleep 1
dtime=$(( ${dtime} - 1))
done
# If ${pid} is still running, kill it
kill -0 ${pid} 2> /dev/null && kill -KILL ${pid} 2> /dev/null
fi
done
if [ -z "${killsig}" ]; then
pidofproc "${1}" 2>&1 > /dev/null
# Program was terminated
if [ "$?" != "0" ]; then
# Pidfile Exists
if [ -f "${pidfile}" ]; then
rm -f "${pidfile}" 2>&1 > /dev/null
fi
return 0
else # Program is still running
return 4 # Unknown Status
fi
else
if [ -z "${pidfile}" ]; then
pidofproc "${1}" 2> /dev/null
else
pidofproc -p "${pidfile}" "${1}" 2> /dev/null
fi
fi
}
#*******************************************************************************
# Function - pidofproc [-p pidfile] pathname
#
# Purpose: This function returns one or more pid(s) for a particular daemon
#
# Inputs: -p pidfile, use the specified pidfile instead of pidof
# pathname, path to the specified program
#
# Outputs: return 0 - Success, pid's in stdout
# return 1 - Invalid or excessive number of arguments,
# warning in stdout
# return 1 - Program is dead, pidfile exists
# return 3 - Program is not running
#
# Dependencies: pidof, echo
#
# Todo: - Invalid or excessive argments, and program is dead pidfile exists
# conflict with eachother
#
#*******************************************************************************
pidofproc()
{
local pidfile=""
local lpids=""
local pidlist=""
while true
do
case "${1}" in
-p)
pidfile="${2}"
shift 2
;;
-*)
log_failure_msg "Unknown Option: ${1}"
return 1
;;
*)
break
;;
esac
done
if [ "${#}" != "1" ]; then
shift 1
log_failure_msg "Excess Arguments: $@"
return 1
fi
if [ -n "${pidfile}" ]; then
if [ ! -r "${pidfile}" ]; then
return 3 # Program is not running
fi
lpids=`head -n 1 ${pidfile}`
for pid in ${lpids}
do
if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
kill -0 "${pid}" 2> /dev/null &&
pidlist="${pidlist} ${pid}"
fi
echo ${pidlist}
test -z "${pidlist}" && return 1 # Program is dead, pidfile exists
return 0
done
else
pidof "${1}"
fi
if [ "$?" != "0" ]; then
return 3 # Program is not running
fi
}
# Screen Dimentions
if [ -z "${COLUMNS}" ]; then
COLUMNS=$(stty size)
COLUMNS=${COLUMNS##* }
fi
# When using remote connections, such as a serial port, stty size returns 0
if [ "${COLUMNS}" = "0" ]; then
COLUMNS=80
fi
# Measurements for positioning result messages
COL=$((${COLUMNS} - 8))
WCOL=$((${COL} - 2))
# Set Cursur Position Commands, used via echo -e
SET_COL="\\033[${COL}G" # at the $COL char
SET_WCOL="\\033[${WCOL}G" # at the $WCOL char
CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char
# Set color commands, used via echo -e
# Please consult `man console_codes` for more information
# under the "Set Graphics Resolution" section
#
# Warning, when switching from a 8bit to a 9bit font,
# the linux console will reinterpret the bold (1;) to
# the top 256 glyphs of the 9bit font. This does
# not affect framebuffer consoles
NORMAL="\\033[0;39m" # Standard console grey
SUCCESS="\\033[1;32m" # Success is green
WARNING="\\033[1;33m" # Warnings are yellow
FAILURE="\\033[1;31m" # Failures are red
INFO="\\033[1;36m" # Information is light cyan
BRACKET="\\033[1;34m" # Brackets are blue
BOOTMESG_PREFIX=" * " # Text at the beginning of every line
#*******************************************************************************
# Function - log_success_msg "message"
#
# Purpose: Print a success message
#
# Inputs:
#
# Outputs:
#
# Dependencies: echo
#
# Todo: logging
#
#*******************************************************************************
log_success_msg()
{
echo -n -e "${BOOTMESG_PREFIX}${@}"
echo -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}"
return 0
}
#*******************************************************************************
# Function - log_failure_msg "message"
#
# Purpose: Print a failure message
#
# Inputs: $@ - Message
#
# Outputs: Text output to screen
#
# Dependencies: echo
#
# Todo: logging
#
#*******************************************************************************
log_failure_msg() {
echo -n -e "${BOOTMESG_PREFIX}${@}"
echo -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
return 0
}
#*******************************************************************************
# Function - log_warning_msg "message"
#
# Purpose: print a warning message
#
# Inputs: $@ - Message
#
# Outputs: Text output to screen
#
# Dependencies: echo
#
# Todo: logging
#
#*******************************************************************************
log_warning_msg() {
echo -n -e "${BOOTMESG_PREFIX}${@}"
echo -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
return 0
}

View File

@ -1,45 +0,0 @@
#!/bin/sh
########################################################################
# Begin $network_devices/services/mtu
#
# Description : Sets MTU per interface
#
# Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Jim Gifford - jim@linuxfromscratch.org
#
# Version : 00.00
#
# Notes : This sets the maximum amount of bytes that can be
# transmitted within a packet. By default, this
# value is set to 1500.
#
########################################################################
. /etc/sysconfig/rc
. ${rc_functions}
. ${IFCONFIG}
if [ -z "${MTU}" ]
then
boot_mesg "MTU variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
echo_failure
exit 1
fi
case "${2}" in
up)
boot_mesg "Setting the MTU for ${1} to ${MTU}..."
echo "${MTU}" > "/sys/class/net/${1}/mtu"
evaluate_retval
;;
down)
;;
*)
echo "Usage: ${0} [interface] {up|down}"
exit 1
;;
esac
# End $network_devices/services/mtu

View File

@ -1,15 +1,14 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/checkfs # Begin checkfs
# #
# Description : File System Check # Description : File System Check
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# A. Luebke - luebke@users.sourceforge.net # A. Luebke - luebke@users.sourceforge.net
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
# Based on checkfs script from LFS-3.1 and earlier. # Based on checkfs script from LFS-3.1 and earlier.
# #
@ -25,8 +24,20 @@
# #
######################################################################### #########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: checkfs
# Required-Start: udev swap $time
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Checks local filesystems before mounting.
# Description: Checks local filesystmes before mounting.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
@ -50,8 +61,8 @@ case "${1}" in
boot_mesg -n " halted and powered off." boot_mesg -n " halted and powered off."
boot_mesg -n "\n\nPress enter to continue..." ${INFO} boot_mesg -n "\n\nPress enter to continue..." ${INFO}
boot_mesg "" ${NORMAL} boot_mesg "" ${NORMAL}
read ENTER wait_for_user
${rc_base}/init.d/halt stop /etc/rc.d/init.d/halt stop
fi fi
if [ -f /forcefsck ]; then if [ -f /forcefsck ]; then
@ -76,7 +87,7 @@ case "${1}" in
if [ "${error_value}" = 1 ]; then if [ "${error_value}" = 1 ]; then
echo_warning echo_warning
boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING} boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
boot_mesg -n " were found and have been corrected." boot_mesg -n " were found and have been corrected. "
boot_mesg -n " You may want to double-check that" boot_mesg -n " You may want to double-check that"
boot_mesg -n " everything was fixed properly." boot_mesg -n " everything was fixed properly."
boot_mesg "" ${NORMAL} boot_mesg "" ${NORMAL}
@ -92,7 +103,7 @@ case "${1}" in
boot_mesg -n " this system will be rebooted" boot_mesg -n " this system will be rebooted"
boot_mesg -n "\n\nPress Enter to continue..." ${INFO} boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL} boot_mesg "" ${NORMAL}
read ENTER wait_for_user
reboot -f reboot -f
fi fi
@ -109,8 +120,8 @@ case "${1}" in
boot_mesg -n " halted and powered off." boot_mesg -n " halted and powered off."
boot_mesg -n "\n\nPress Enter to continue..." ${INFO} boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL} boot_mesg "" ${NORMAL}
read ENTER wait_for_user
${rc_base}/init.d/halt stop /etc/rc.d/init.d/halt stop
fi fi
if [ "${error_value}" -ge 16 ]; then if [ "${error_value}" -ge 16 ]; then
@ -128,4 +139,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/checkfs # End checkfs

View File

@ -1,19 +1,32 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/cleanfs # Begin cleanfs
# #
# Description : Clean file system # Description : Clean file system
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: cleanfs
# Required-Start: $local_fs
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Cleans temporary directories early in the boot process.
# Description: Cleans temporary directories /var/run, /var/lock, and
# optionally) /tmp. cleanfs also creates /var/run/utmp
# and any files defined in /etc/sysconfig/createfiles.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
# Function to create files/directory on boot. # Function to create files/directory on boot.
create_files() { create_files() {
@ -21,7 +34,6 @@ create_files() {
exec 9>&0 < /etc/sysconfig/createfiles exec 9>&0 < /etc/sysconfig/createfiles
while read name type perm usr grp dtype maj min junk while read name type perm usr grp dtype maj min junk
do do
# Ignore comments and blank lines. # Ignore comments and blank lines.
case "${name}" in case "${name}" in
""|\#*) continue ;; ""|\#*) continue ;;
@ -73,10 +85,11 @@ case "${1}" in
start) start)
boot_mesg -n "Cleaning file systems:" ${INFO} boot_mesg -n "Cleaning file systems:" ${INFO}
if [ "${SKIPTMPCLEAN}" = "" ]; then
boot_mesg -n " /tmp" ${NORMAL} boot_mesg -n " /tmp" ${NORMAL}
cd /tmp && cd /tmp &&
find . -xdev -mindepth 1 ! -name lost+found \ find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
-delete || failed=1 fi
> /var/run/utmp > /var/run/utmp
@ -100,4 +113,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/cleanfs # End cleanfs

View File

@ -1,24 +1,35 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/console # Begin console
# #
# Description : Sets keymap and screen font # Description : Sets keymap and screen font
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Alexander E. Patrakov # Alexander E. Patrakov
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.03 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc . /lib/boot/functions
. ${rc_functions}
### BEGIN INIT INFO
# Provides: console
# Required-Start:
# Should-Start: $local_fs
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Sets up a localised console.
# Description: Sets up fonts and language settings for the user's
# local as defined by /etc/sysconfig/console.
# X-LFS-Provided-By: LFS
### END INIT INFO
# Native English speakers probably don't have /etc/sysconfig/console at all # Native English speakers probably don't have /etc/sysconfig/console at all
if [ -f /etc/sysconfig/console ] if [ -r /etc/sysconfig/console ]; then
then
. /etc/sysconfig/console . /etc/sysconfig/console
else else
exit 0 exit 0
@ -93,4 +104,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/console # End console

View File

@ -1,26 +1,38 @@
#!/bin/sh #!/bin/sh
# Begin $rc_base/init.d/consolelog
######################################################################## ########################################################################
# Begin consolelog
# #
# Description : Set the kernel log level for the console # Description : Set the kernel log level for the console
# #
# Authors : Dan Nicholson - dnicholson@linuxfromscratch.org # Authors : Dan Nicholson - dnicholson@linuxfromscratch.org
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
# #
# Notes : /proc must be mounted before this can run # Notes : /proc must be mounted before this can run
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: consolelog
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Sets the console log level.
# Description: Sets the console log level.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
# set the default loglevel # set the default loglevel
LOGLEVEL=7 LOGLEVEL=7
if [ -r /etc/sysconfig/console ]; then
. /etc/sysconfig/console [ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
fi
case "${1}" in case "${1}" in
start) start)
@ -36,6 +48,7 @@ case "${1}" in
;; ;;
esac esac
;; ;;
status) status)
# Read the current value if possible # Read the current value if possible
if [ -r /proc/sys/kernel/printk ]; then if [ -r /proc/sys/kernel/printk ]; then
@ -47,8 +60,7 @@ case "${1}" in
# Print the value # Print the value
if [ -n "$level" ]; then if [ -n "$level" ]; then
${ECHO} -e "${INFO}The current console log level" \ ${ECHO} -e "${INFO}The current console log level is ${level}${NORMAL}"
"is ${level}${NORMAL}"
fi fi
;; ;;
@ -58,4 +70,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/consolelog # End consolelog

View File

@ -1,18 +1,24 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/functions # Begin boot functions
# #
# Description : Run Level Control Functions # Description : Run Level Control Functions
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
# #
# Notes : With code based on Matthias Benkmann's simpleinit-msb # Notes : With code based on Matthias Benkmann's simpleinit-msb
# http://winterdrache.de/linux/newboot/index.html # http://winterdrache.de/linux/newboot/index.html
# #
# The file should be located in /lib/boot
#
######################################################################## ########################################################################
# Set any needed environment variables e.g. HEADLESS
[ -r /etc/sysconfig/init_params ] && . /etc/sysconfig/init_params
## Environmental setup ## Environmental setup
# Setup default values for environment # Setup default values for environment
umask 022 umask 022
@ -116,6 +122,8 @@ boot_mesg()
# Print the message to the screen # Print the message to the screen
${ECHO} ${ECHOPARM} -e "${2}${1}" ${ECHO} ${ECHOPARM} -e "${2}${1}"
# Log the message
${ECHO} ${ECHOPARM} -e "${2}${1}" >> /run/var/bootlog
} }
boot_mesg_flush() boot_mesg_flush()
@ -124,17 +132,13 @@ boot_mesg_flush()
STRING_LENGTH="0" STRING_LENGTH="0"
} }
boot_log()
{
# Left in for backwards compatibility
:
}
echo_ok() echo_ok()
{ {
${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]" ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]"
${ECHO} -e "${NORMAL}" ${ECHO} -e "${NORMAL}"
boot_mesg_flush boot_mesg_flush
${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]" >> /run/var/bootlog
${ECHO} -e "${NORMAL}" >> /run/var/bootlog
} }
echo_failure() echo_failure()
@ -142,6 +146,8 @@ echo_failure()
${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]"
${ECHO} -e "${NORMAL}" ${ECHO} -e "${NORMAL}"
boot_mesg_flush boot_mesg_flush
${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" >> /run/var/bootlog
${ECHO} -e "${NORMAL}" >> /run/var/bootlog
} }
echo_warning() echo_warning()
@ -149,41 +155,23 @@ echo_warning()
${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
${ECHO} -e "${NORMAL}" ${ECHO} -e "${NORMAL}"
boot_mesg_flush boot_mesg_flush
${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" >> /run/var/bootlog
${ECHO} -e "${NORMAL}" >> /run/var/bootlog
} }
print_error_msg() echo_skipped()
{ {
echo_failure ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]"
# $i is inherited by the rc script ${ECHO} -e "${NORMAL}"
boot_mesg -n "FAILURE:\n\nYou should not be reading this error message.\n\n" ${FAILURE}
boot_mesg -n " It means that an unforeseen error took"
boot_mesg -n " place in ${i}, which exited with a return value of"
boot_mesg " ${error_value}.\n"
boot_mesg_flush boot_mesg_flush
boot_mesg -n "If you're able to track this" ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]" >> /run/var/bootlog
boot_mesg -n " error down to a bug in one of the files provided by" ${ECHO} -e "${NORMAL}" >> /run/var/bootlog
boot_mesg -n " the LFS book, please be so kind to inform us at"
boot_mesg " lfs-dev@linuxfromscratch.org.\n"
boot_mesg_flush
boot_mesg -n "Press Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL}
read ENTER
} }
check_script_status() wait_for_user()
{ {
# $i is inherited by the rc script # Wait for the user by default
if [ ! -f ${i} ]; then [ "${HEADLESS=0}" = "0" ] && read ENTER
boot_mesg "${i} is not a valid symlink." ${WARNING}
echo_warning
continue
fi
if [ ! -x ${i} ]; then
boot_mesg "${i} is not executable, skipping." ${WARNING}
echo_warning
continue
fi
} }
evaluate_retval() evaluate_retval()
@ -725,6 +713,9 @@ log_success_msg()
{ {
${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}" ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}"
${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" >> /run/var/bootlog
${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}" \
>> /run/var/bootlog
return 0 return 0
} }
@ -745,6 +736,9 @@ log_success_msg()
log_failure_msg() { log_failure_msg() {
${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" >> /run/var/bootlog
${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" \
>> /run/var/bootlog
return 0 return 0
} }
@ -765,7 +759,33 @@ log_failure_msg() {
log_warning_msg() { log_warning_msg() {
${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" >> /run/var/bootlog
${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" \
>> /run/var/bootlog
return 0 return 0
} }
# End $rc_base/init.d/functions #*******************************************************************************
# Function - log_skipped_msg "message"
#
# Purpose: print a message that the script was skipped
#
# Inputs: $@ - Message
#
# Outputs: Text output to screen
#
# Dependencies: echo
#
# Todo: logging
#
#*******************************************************************************
log_skipped_msg() {
${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" SKIP ""${BRACKET}""]""${NORMAL}"
${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" >> /run/var/bootlog
${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" SKIP ""${BRACKET}""]""${NORMAL}" \
>> /run/var/bootlog
return 0
}
# End boot functions

View File

@ -1,28 +1,38 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/halt # Begin halt
# #
# Description : Halt Script # Description : Halt Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: halt
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 0
# Default-Stop:
# Short-Description: Halts the system.
# Description: Halts the System.
# X-LFS-Provided-By: LFS
### END INIT INFO
case "${1}" in case "${1}" in
stop) stop)
halt -d -f -i -p halt -d -f -i -p
;; ;;
*) *)
echo "Usage: {stop}" echo "Usage: {stop}"
exit 1 exit 1
;; ;;
esac esac
# End $rc_base/init.d/halt # End halt

View File

@ -1,19 +1,31 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/localnet # Begin localnet
# #
# Description : Loopback device # Description : Loopback device
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: localnet
# Required-Start: $local_fs
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Starts the local network.
# Description: Sets the hostname of the machine and starts the
# loopback interface.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
. /etc/sysconfig/network . /etc/sysconfig/network
case "${1}" in case "${1}" in
@ -51,4 +63,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/localnet # End localnet

View File

@ -1,26 +1,36 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/modules # Begin modules
# #
# Description : Module auto-loading script # Description : Module auto-loading script
# #
# Authors : Zack Winkles # Authors : Zack Winkles
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: modules
# Required-Start: mountvirtfs sysctl
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Loads required modules.
# Description: Loads modules listed in /etc/sysconfig/modules.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
# Assure that the kernel has module support. # Assure that the kernel has module support.
[ -e /proc/ksyms -o -e /proc/modules ] || exit 0 [ -e /proc/ksyms -o -e /proc/modules ] || exit 0
case "${1}" in case "${1}" in
start) start)
# Exit if there's no modules file or there are no # Exit if there's no modules file or there are no
# valid entries # valid entries
[ -r /etc/sysconfig/modules ] && [ -r /etc/sysconfig/modules ] &&
@ -63,10 +73,11 @@ case "${1}" in
echo_failure echo_failure
fi fi
;; ;;
*) *)
echo "Usage: ${0} {start}" echo "Usage: ${0} {start}"
exit 1 exit 1
;; ;;
esac esac
# End $rc_base/init.d/modules # End modules

View File

@ -1,19 +1,33 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/mountfs # Begin mountfs
# #
# Description : File System Mount Script # Description : File System Mount Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: $local_fs
# Required-Start: udev checkfs
# Should-Start:
# Required-Stop: swap
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Mounts/unmounts local filesystems defined in /etc/fstab.
# Description: Remounts root filesystem read/write and mounts all
# remaining local filesystems defined in /etc/fstab on
# start. Remounts root filesystem read-only and unmounts
# remaining filesystems on stop.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
@ -53,4 +67,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/mountfs # End mountfs

View File

@ -1,23 +1,42 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/mountvirtfs # Begin mountvirtfs
# #
# Description : Mount proc, sysfs, and run # Description : Mount proc, sysfs, and run
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: mountvirtfs
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Mounts /sys and /proc virtual (kernel) filesystems.
# Mounts /run tmpfs.
# Description: Mounts /sys and /proc virtual (kernel) filesystems.
# Mounts /run tmpfs.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
mkdir -p /run
mount -n /run || failed=1
mkdir -p /run/{var,lock,shm}
boot_mesg -n "Mounting virtual file systems:" ${INFO} boot_mesg -n "Mounting virtual file systems:" ${INFO}
boot_mesg -n " /run" ${NORMAL}
if ! mountpoint /proc >/dev/null; then if ! mountpoint /proc >/dev/null; then
boot_mesg -n " /proc" ${NORMAL} boot_mesg -n " /proc" ${NORMAL}
@ -29,12 +48,6 @@ case "${1}" in
mount -n /sys || failed=1 mount -n /sys || failed=1
fi fi
if ! mountpoint /run >/dev/null; then
boot_mesg -n " /run" ${NORMAL}
mount -n /run || failed=1
mkdir /run/{var,lock,shm}
fi
boot_mesg "" ${NORMAL} boot_mesg "" ${NORMAL}
(exit ${failed}) (exit ${failed})
@ -47,4 +60,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/mountvertfs # End mountvertfs

View File

@ -1,27 +1,35 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/network # Begin network
# #
# Description : Network Control Script # Description : Network Control Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Nathan Coulson - nathan@linuxfromscratch.org # Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org # Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: $network
. /etc/sysconfig/network # Required-Start: $local_fs swap localnet
# Should-Start: $syslog
# Required-Stop: $local_fs swap localnet
# Should-Stop: $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts and configures network interfaces.
# Description: Starts and configures network interfaces.
# X-LFS-Provided-By: LFS
### END INIT INFO
case "${1}" in case "${1}" in
start) start)
# Start all network interfaces # Start all network interfaces
for file in ${network_devices}/ifconfig.* for file in /etc/sysconfig/ifconfig.*
do do
interface=${file##*/ifconfig.} interface=${file##*/ifconfig.}
@ -31,14 +39,14 @@ case "${1}" in
continue continue
fi fi
IN_BOOT=1 ${network_devices}/ifup ${interface} /sbin/ifup ${interface}
done done
;; ;;
stop) stop)
# Reverse list # Reverse list
FILES="" FILES=""
for file in ${network_devices}/ifconfig.* for file in /etc/sysconfig/ifconfig.*
do do
FILES="${file} ${FILES}" FILES="${file} ${FILES}"
done done
@ -54,7 +62,7 @@ case "${1}" in
continue continue
fi fi
IN_BOOT=1 ${network_devices}/ifdown ${interface} /sbin/ifdown ${interface}
done done
;; ;;
@ -70,4 +78,4 @@ case "${1}" in
;; ;;
esac esac
# End /etc/rc.d/init.d/network # End network

View File

@ -1,19 +1,52 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/rc # Begin rc
# #
# Description : Main Run Level Control Script # Description : Main Run Level Control Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc . /lib/boot/functions
. ${rc_functions}
print_error_msg()
{
echo_failure
# $i is set when called
boot_mesg -n "FAILURE:\n\nYou should not be reading this error message.\n\n" ${FAILURE}
boot_mesg -n " It means that an unforeseen error took"
boot_mesg -n " place in ${i}, which exited with a return value of"
boot_mesg " ${error_value}.\n"
boot_mesg_flush
boot_mesg -n "If you're able to track this"
boot_mesg -n " error down to a bug in one of the files provided by"
boot_mesg -n " the LFS book, please be so kind to inform us at"
boot_mesg " lfs-dev@linuxfromscratch.org.\n"
boot_mesg_flush
boot_mesg -n "Press Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL}
wait_for_user
}
check_script_status()
{
# $i is set when called
if [ ! -f ${i} ]; then
boot_mesg "${i} is not a valid symlink." ${WARNING}
echo_warning
continue
fi
if [ ! -x ${i} ]; then
boot_mesg "${i} is not executable, skipping." ${WARNING}
echo_warning
continue
fi
}
# This sets a few default terminal options. # This sets a few default terminal options.
stty sane stty sane
@ -31,22 +64,21 @@ fi
previous=${PREVLEVEL} previous=${PREVLEVEL}
[ "${previous}" = "" ] && previous=N [ "${previous}" = "" ] && previous=N
if [ ! -d ${rc_base}/rc${runlevel}.d ]; then if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then
boot_mesg "${rc_base}/rc${runlevel}.d does not exist." ${WARNING} boot_mesg "/etc/rc.d/rc${runlevel}.d does not exist."
boot_mesg_flush
exit 1 exit 1
fi fi
# Attempt to stop all service started by previous runlevel, # Attempt to stop all services started by the previous runlevel,
# and killed in this runlevel # and killed in this runlevel
if [ "${previous}" != "N" ]; then if [ "${previous}" != "N" ]; then
for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null) for i in $(ls -v /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null)
do do
check_script_status check_script_status
suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]} suffix=${i#/etc/rc.d/rc$runlevel.d/K[0-9][0-9]}
prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix
sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix sysinit_start=/etc/rc.d/rcsysinit.d/S[0-9][0-9]$suffix
if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then
if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
@ -68,13 +100,15 @@ if [ "${previous}" != "N" ]; then
done done
fi fi
[ "${previous}" = "N" ] && IN_BOOT=1
#Start all functions in this runlevel #Start all functions in this runlevel
for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null) for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null)
do do
if [ "${previous}" != "N" ]; then if [ "${previous}" != "N" ]; then
suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]} suffix=${i#/etc/rc.d/rc$runlevel.d/S[0-9][0-9]}
stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix stop=/etc/rc.d/rc$runlevel.d/K[0-9][0-9]$suffix
prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix
[ -f ${prev_start} ] && [ ! -f ${stop} ] && continue [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue
fi fi
@ -96,4 +130,4 @@ do
fi fi
done done
# End $rc_base/init.d/rc # End rc

View File

@ -1,19 +1,30 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/reboot # Begin reboot
# #
# Description : Reboot Scripts # Description : Reboot Scripts
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: reboot
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 6
# Default-Stop:
# Short-Description: Reboots the system.
# Description: Reboots the System.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
stop) stop)
@ -28,4 +39,4 @@ case "${1}" in
esac esac
# End $rc_base/init.d/reboot # End reboot

View File

@ -1,19 +1,30 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/sendsignals # Begin sendsignals
# #
# Description : Sendsignals Script # Description : Sendsignals Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: sendsignals
# Required-Start:
# Should-Start:
# Required-Stop: $local_fs swap localnet
# Should-Stop:
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Attempts to kill remaining processes.
# Description: Attempts to kill remaining processes.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot//functions
case "${1}" in case "${1}" in
stop) stop)
@ -49,4 +60,4 @@ case "${1}" in
esac esac
# End $rc_base/init.d/sendsignals # End sendsignals

View File

@ -1,20 +1,34 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/setclock # Begin setclock
# #
# Description : Setting Linux Clock # Description : Setting Linux Clock
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: $time
. /etc/sysconfig/clock # Required-Start:
# Should-Start: modules
# Required-Stop:
# Should-Stop: $syslog
# Default-Start: S
# Default-Stop:
# Short-Description: Stores and restores time from the hardware clock
# Description: On boot, system time is obtained from hwclock. The
# hardware clock can also be set on shutdown.
# X-LFS-Provided-By: LFS BLFS
### END INIT INFO
. /lib/boot/functions
[ -r /etc/sysconfig/clock ] && . /etc/sysconfig/clock
case "${UTC}" in case "${UTC}" in
yes|true|1) yes|true|1)

View File

@ -1,19 +1,31 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/swap # Begin swap
# #
# Description : Swap Control Script # Description : Swap Control Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: swap
# Required-Start: udev
# Should-Start: modules
# Required-Stop: localnet
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Mounts and unmounts swap partitions.
# Description: Mounts and unmounts swap partitions defined in
# /etc/fstab.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
@ -47,4 +59,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/swap # End swap

View File

@ -1,21 +1,33 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/sysctl # Begin sysctl
# #
# Description : File uses /etc/sysctl.conf to set kernel runtime # Description : File uses /etc/sysctl.conf to set kernel runtime
# parameters # parameters
# #
# Authors : Nathan Coulson (nathan@linuxfromscratch.org) # Authors : Nathan Coulson (nathan@linuxfromscratch.org)
# Matthew Burgress (matthew@linuxfromscratch.org) # Matthew Burgress (matthew@linuxfromscratch.org)
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: sysctl
# Required-Start: mountkernfs
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Makes changes to the proc filesystem
# Description: Makes changes to the proc filesystem as defined in
# /etc/sysctl.conf. See 'man sysctl(8)'.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
@ -36,4 +48,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/sysctl # End sysctl

View File

@ -1,24 +1,37 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/sysklogd # Begin sysklogd
# #
# Description : Sysklogd loader # Description : Sysklogd loader
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: $syslog
# Required-Start: localnet
# Should-Start:
# Required-Stop: $local_fs sendsignals
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts kernel and system log daemons.
# Description: Starts kernel and system log daemons.
# /etc/fstab.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
boot_mesg "Starting system log daemon..." boot_mesg "Starting system log daemon..."
loadproc syslogd -m 0 PARMS=${SYSKLOGD_PARMS=-'-m 0'}
loadproc syslogd $PARMS
boot_mesg "Starting kernel log daemon..." boot_mesg "Starting kernel log daemon..."
loadproc klogd loadproc klogd
@ -54,4 +67,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/sysklogd # End sysklogd

View File

@ -1,19 +1,31 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/ # Begin scriptname
# #
# Description : # Description :
# #
# Authors : # Authors :
# #
# Version : 00.00 # Version : LFS x.x
# #
# Notes : # Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: template
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description:
# Description:
# X-LFS-Provided-By:
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
@ -47,4 +59,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/ # End scriptname

View File

@ -1,19 +1,31 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/udev # Begin udev
# #
# Description : Udev cold-plugging script # Description : Udev cold-plugging script
# #
# Authors : Zack Winkles, Alexander E. Patrakov # Authors : Zack Winkles, Alexander E. Patrakov
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.02 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: udev
# Required-Start:
# Should-Start: modules
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Populates /dev with device nodes.
# Description: Mounts a tempfs on /dev and starts the udevd daemon.
# Device nodes are created as defined by udev.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
@ -26,7 +38,7 @@ case "${1}" in
boot_mesg -n " will be halted and powered off." boot_mesg -n " will be halted and powered off."
boot_mesg -n "\n\nPress Enter to continue..." ${INFO} boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL} boot_mesg "" ${NORMAL}
read ENTER wait_for_user
/etc/rc.d/init.d/halt stop /etc/rc.d/init.d/halt stop
fi fi
@ -45,7 +57,7 @@ case "${1}" in
boot_mesg -n " will be halted and powered off." boot_mesg -n " will be halted and powered off."
boot_mesg -n "\n\nPress Enter to continue..." ${INFO} boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL} boot_mesg "" ${NORMAL}
read ENTER wait_for_user
/etc/rc.d/init.d/halt stop /etc/rc.d/init.d/halt stop
fi fi
@ -71,7 +83,6 @@ case "${1}" in
# Now wait for udevd to process the uevents we triggered # Now wait for udevd to process the uevents we triggered
/sbin/udevadm settle /sbin/udevadm settle
evaluate_retval evaluate_retval
;; ;;
*) *)
@ -80,4 +91,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/udev # End udev

View File

@ -1,27 +1,42 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $rc_base/init.d/udev_retry # Begin udev_retry
# #
# Description : Udev cold-plugging script (retry) # Description : Udev cold-plugging script (retry)
# #
# Authors : Alexander E. Patrakov # Authors : Alexander E. Patrakov
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.02 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc ### BEGIN INIT INFO
. ${rc_functions} # Provides: udev_retry
# Required-Start: udev
# Should-Start: $local_fs
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Replays failed uevents and creates additonal devices.
# Description: Replays any failed uevents that were skipped due to
# slow hardware initialization, and creates those needed
# device nodes
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/boot/functions
case "${1}" in case "${1}" in
start) start)
boot_mesg "Retrying failed uevents, if any..." boot_mesg "Retrying failed uevents, if any..."
RUNDIR=$(/sbin/udevadm info --run)
# From Debian: "copy the rules generated before / was mounted # From Debian: "copy the rules generated before / was mounted
# read-write": # read-write":
for file in /dev/.udev/tmp-rules--*; do
for file in ${RUNDIR}/tmp-rules--*; do
dest=${file##*tmp-rules--} dest=${file##*tmp-rules--}
[ "$dest" = '*' ] && break [ "$dest" = '*' ] && break
cat $file >> /etc/udev/rules.d/$dest cat $file >> /etc/udev/rules.d/$dest
@ -42,4 +57,4 @@ case "${1}" in
;; ;;
esac esac
# End $rc_base/init.d/udev_retry # End udev_retry

View File

@ -1,95 +1,66 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $network_devices/ifdown # Begin /sbin/ifdown
# #
# Description : Interface Down # Description : Interface Down
# #
# Authors : Nathan Coulson - nathan@linuxfromscratch.org # Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org # Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.01 # Version : LFS 7.0
# #
# Notes : the IFCONFIG variable is passed to the scripts found # Notes : the IFCONFIG variable is passed to the scripts found
# in the services directory, to indicate what file the # in the /lib/boot directory, to indicate what file the
# service should source to get environmental variables. # service should source to get environmental variables.
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc file=/etc/sysconfig/ifconfig.${1}
. ${rc_functions}
# Collect a list of configuration files for our interface # Skip backup files
if [ -n "${2}" ]; then [ "${file}" = "${file%""~""}" ] || exit 0
for file in ${@#$1}; do # All parameters except $1
FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}" . /lib/boot/functions
done
elif [ -d "${network_devices}/ifconfig.${1}" ]; then if [ ! -r "${file}" ]; then
FILES=`echo ${network_devices}/ifconfig.${1}/*` boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
else echo_warning
FILES="${network_devices}/ifconfig.${1}" exit 1
fi fi
# Reverse the order configuration files are processed in . ${file}
for file in ${FILES}; do
FILES2="${file} ${FILES2}"
done
FILES=${FILES2}
# Process each configuration file if [ "$IFACE" = "" ]; then
for file in ${FILES}; do boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE}
# skip backup files echo_failure
if [ "${file}" != "${file%""~""}" ]; then exit 1
continue fi
fi
if [ ! -f "${file}" ]; then # This will run the service script, if SERVICE is set
boot_mesg "${file} is not a network configuration file or directory." ${WARNING} if [ -n "${SERVICE}" -a -x "/lib/boot/${SERVICE}" ]; then
echo_warning if ip link show ${IFACE} > /dev/null 2>&1; then
continue IFCONFIG=${file} /lib/boot/${SERVICE} ${IFACE} down
fi
(
. ${file}
# Will not process this service if started by boot, and ONBOOT
# is not set to yes
if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
continue
fi
# Will not process this service if started by hotplug, and
# ONHOTPLUG is not set to yes
if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" ]; then
continue
fi
# This will run the service script, if SERVICE is set
if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then
if ip link show ${1} > /dev/null 2>&1
then
IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} down
else else
boot_mesg "Interface ${1} doesn't exist." ${WARNING} boot_mesg "Interface ${1} doesn't exist." ${WARNING}
echo_warning echo_warning
fi fi
else else
boot_mesg -n "Unable to process ${file}. Either" ${FAILURE} boot_mesg "Unable to process ${file}. Either" ${FAILURE}
boot_mesg -n " the SERVICE variable was not set," boot_mesg "the SERVICE variable was not set"
boot_mesg " or the specified service cannot be executed." boot_mesg "or the specified service cannot be executed."
echo_failure echo_failure
continue exit 1
fi fi
)
done
if [ -z "${2}" ]; then link_status=`ip link show ${IFACE} 2>/dev/null`
link_status=`ip link show $1 2>/dev/null`
if [ -n "${link_status}" ]; then if [ -n "${link_status}" ]; then
if echo "${link_status}" | grep -q UP; then if echo "${link_status}" | grep -q UP; then
boot_mesg "Bringing down the ${1} interface..." boot_mesg "Bringing down the ${IFACE} interface..."
ip link set ${1} down ip link set ${IFACE} down
evaluate_retval evaluate_retval
fi fi
fi
fi fi
# End $network_devices/ifdown # End /sbin/ifdown

View File

@ -1,90 +1,82 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $network_devices/ifup # Begin /sbin/ifup
# #
# Description : Interface Up # Description : Interface Up
# #
# Authors : Nathan Coulson - nathan@linuxfromscratch.org # Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org # Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
# #
# Notes : the IFCONFIG variable is passed to the scripts found # Notes : The IFCONFIG variable is passed to the SERVICE script
# in the services directory, to indicate what file the # in the /lib/boot directory, to indicate what file the
# service should source to get environmental variables. # service should source to get environmental variables.
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc file=/etc/sysconfig/ifconfig.${1}
. ${rc_functions}
# Collect a list of configuration files for our interface # Skip backup files
if [ -n "${2}" ]; then [ "${file}" = "${file%""~""}" ] || exit 0
for file in ${@#$1} # All parameters except $1
do . /lib/boot/functions
FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
done
elif [ -d "${network_devices}/ifconfig.${1}" ]; then
FILES=`echo ${network_devices}/ifconfig.${1}/*`
else
FILES="${network_devices}/ifconfig.${1}"
fi
boot_mesg "Bringing up the ${1} interface..." boot_mesg "Bringing up the ${1} interface..."
boot_mesg_flush boot_mesg_flush
# Process each configruation file if [ ! -r "${file}" ]; then
for file in ${FILES}; do boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
# skip backup files
if [ "${file}" != "${file%""~""}" ]; then
continue
fi
if [ ! -f "${file}" ]; then
boot_mesg "${file} is not a network configuration file or directory." ${WARNING}
echo_warning echo_warning
continue exit 1
fi fi
( . $file
. ${file}
# Will not process this service if started by boot, and ONBOOT if [ "$IFACE" = "" ]; then
# is not set to yes boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE}
if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then echo_failure
continue exit 1
fi fi
# Will not process this service if started by hotplug, and
# ONHOTPLUG is not set to yes # Do not process this service if started by boot, and ONBOOT
if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" \ # is not set to yes
-a "${HOSTNAME}" != "(none)" ]; then continue if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
fi echo_skipped
exit 0
fi
if [ -n "${SERVICE}" -a -x "/lib/boot/${SERVICE}" ]; then
if [ -z "${CHECK_LINK}" -o \
"${CHECK_LINK}" = "y" -o \
"${CHECK_LINK}" = "yes" -o \
"${CHECK_LINK}" = "1" ]; then
# Bring up the interface
if ip link show ${IFACE} > /dev/null 2>&1; then
link_status=`ip link show ${IFACE}`
if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then
if [ -z "${CHECK_LINK}" -o "${CHECK_LINK}" = "y" \
-o "${CHECK_LINK}" = "yes" -o "${CHECK_LINK}" = "1" ]; then
if ip link show ${1} > /dev/null 2>&1; then
link_status=`ip link show ${1}`
if [ -n "${link_status}" ]; then if [ -n "${link_status}" ]; then
if ! echo "${link_status}" | grep -q UP; then if ! echo "${link_status}" | grep -q UP; then
ip link set ${1} up ip link set ${IFACE} up
fi fi
fi fi
else
boot_mesg "Interface ${1} doesn't exist." ${WARNING}
echo_warning
continue
fi
fi
IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} up
else
boot_mesg "Unable to process ${file}. Either" ${FAILURE}
boot_mesg " the SERVICE variable was not set,"
boot_mesg " or the specified service cannot be executed."
echo_failure
continue
fi
)
done
# End $network_devices/ifup else
boot_mesg "Interface ${IFACE} doesn't exist." ${WARNING}
echo_warning
fi
fi
IFCONFIG=${file} /lib/boot/${SERVICE} ${IFACE} up
else
boot_mesg "Unable to process ${file}. Either" ${FAILURE}
boot_mesg "the SERVICE variable was not set"
boot_mesg "or the specified service cannot be executed."
echo_failure
exit 1
fi
# End /sbin/ifup

View File

@ -1,20 +1,18 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $network_devices/services/ipv4-static # Begin /lib/boot/ipv4-static
# #
# Description : IPV4 Static Boot Script # Description : IPV4 Static Boot Script
# #
# Authors : Nathan Coulson - nathan@linuxfromscratch.org # Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org # Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc . /lib/boot/functions
. ${rc_functions}
. ${IFCONFIG} . ${IFCONFIG}
if [ -z "${IP}" ]; then if [ -z "${IP}" ]; then
@ -29,12 +27,15 @@ if [ -z "${PREFIX}" -a -z "${PEER}" ]; then
echo_warning echo_warning
PREFIX=24 PREFIX=24
args="${args} ${IP}/${PREFIX}" args="${args} ${IP}/${PREFIX}"
elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then
boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE} boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE}
echo_failure echo_failure
exit 1 exit 1
elif [ -n "${PREFIX}" ]; then elif [ -n "${PREFIX}" ]; then
args="${args} ${IP}/${PREFIX}" args="${args} ${IP}/${PREFIX}"
elif [ -n "${PEER}" ]; then elif [ -n "${PEER}" ]; then
args="${args} ${IP} peer ${PEER}" args="${args} ${IP} peer ${PEER}"
fi fi
@ -79,4 +80,4 @@ case "${2}" in
;; ;;
esac esac
# End $network_devices/services/ipv4-static # End /lib/boot/ipv4-static

View File

@ -1,19 +1,17 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin $network_devices/services/ipv4-static-route # Begin /lib/boot/ipv4-static-route
# #
# Description : IPV4 Static Route Script # Description : IPV4 Static Route Script
# #
# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org # Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : 00.00 # Version : LFS 7.0
#
# Notes :
# #
######################################################################## ########################################################################
. /etc/sysconfig/rc . /lib/boot/functions
. ${rc_functions}
. ${IFCONFIG} . ${IFCONFIG}
case "${TYPE}" in case "${TYPE}" in
@ -94,4 +92,4 @@ case "${2}" in
;; ;;
esac esac
# End $network_devices/services/ipv4-static-route # End /bib/boot/ipv4-static-route

View File

@ -36,6 +36,27 @@
</listitem> </listitem>
--> -->
<listitem>
<para>2011-08-01</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Rewrite bootscripts and Chaper 7.</para>
<itemizedlist>
<listitem><para>Make scripts compatible with initd format (see BLFS).</para></listitem>
<listitem><para>Move functions and services to /lib/boot.</para></listitem>
<listitem><para>Log boot messages to /run/var/bootlog.</para></listitem>
<listitem><para>Move ifup/ifdown to /sbin.</para></listitem>
<listitem><para>Move network device configuration files to
/etc/sysconfig/ifconfig.*.</para></listitem>
<listitem><para>Add IFACE variable to network configuration files.
</para></listitem>
<listitem><para>Read optional configuration file /etc/sysconfig/init_params
in functions.</para></listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</listitem>
<listitem> <listitem>
<para>2011-07-17</para> <para>2011-07-17</para>
<itemizedlist> <itemizedlist>

View File

@ -74,52 +74,6 @@
</sect2> </sect2>
<sect2 id="conf-sysvinit" role="configuration">
<title>Configuring Sysvinit</title>
<indexterm zone="conf-sysvinit">
<primary sortas="a-Sysvinit">Sysvinit</primary>
<secondary>configuring</secondary>
</indexterm>
<indexterm zone="conf-sysvinit">
<primary sortas="e-/etc/inittab">/etc/inittab</primary>
</indexterm>
<para>Create a new file <filename>/etc/inittab</filename> by running the
following:</para>
<screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
<literal># Begin /etc/inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc sysinit
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016:once:/sbin/sulogin
1:2345:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600
# End /etc/inittab</literal>
EOF</userinput></screen>
</sect2>
<sect2 id="contents-sysvinit" role="content"> <sect2 id="contents-sysvinit" role="content">
<title>Contents of Sysvinit</title> <title>Contents of Sysvinit</title>

View File

@ -49,7 +49,6 @@
<sect2 id="contents-bootscripts" role="content"> <sect2 id="contents-bootscripts" role="content">
<title>Contents of LFS-Bootscripts</title> <title>Contents of LFS-Bootscripts</title>
<segmentedlist> <segmentedlist>
<segtitle>Installed scripts</segtitle> <segtitle>Installed scripts</segtitle>
<segtitle>Installed directories</segtitle> <segtitle>Installed directories</segtitle>
@ -59,7 +58,7 @@
ifup, localnet, modules, mountfs, mountkernfs, network, rc, reboot, ifup, localnet, modules, mountfs, mountkernfs, network, rc, reboot,
sendsignals, setclock, static, swap, sysctl, sysklogd, template, sendsignals, setclock, static, swap, sysctl, sysklogd, template,
udev, and udev_retry</seg> udev, and udev_retry</seg>
<seg>/etc/rc.d, /etc/sysconfig</seg> <seg>/etc/rc.d, /etc/sysconfig, /lib/boot</seg>
</seglistitem> </seglistitem>
</segmentedlist> </segmentedlist>
@ -140,7 +139,7 @@
<varlistentry id="ifdown-bootscripts"> <varlistentry id="ifdown-bootscripts">
<term><command>ifdown</command></term> <term><command>ifdown</command></term>
<listitem> <listitem>
<para>Assists the network script with stopping network devices</para> <para>Stops a network device</para>
<indexterm zone="ch-scripts-bootscripts ifdown-bootscripts"> <indexterm zone="ch-scripts-bootscripts ifdown-bootscripts">
<primary sortas="d-ifdown">ifdown</primary> <primary sortas="d-ifdown">ifdown</primary>
</indexterm> </indexterm>
@ -150,7 +149,7 @@
<varlistentry id="ifup-bootscripts"> <varlistentry id="ifup-bootscripts">
<term><command>ifup</command></term> <term><command>ifup</command></term>
<listitem> <listitem>
<para>Assists the network script with starting network devices</para> <para>Initializes a network device</para>
<indexterm zone="ch-scripts-bootscripts ifup-bootscripts"> <indexterm zone="ch-scripts-bootscripts ifup-bootscripts">
<primary sortas="d-ifup">ifup</primary> <primary sortas="d-ifup">ifup</primary>
</indexterm> </indexterm>
@ -325,7 +324,7 @@
<term><command>udev_retry</command></term> <term><command>udev_retry</command></term>
<listitem> <listitem>
<para>Retries failed udev uevents, and copies generated rules <para>Retries failed udev uevents, and copies generated rules
files from <filename class="directory">/dev/.udev</filename> to files from to
<filename class="directory">/etc/udev/rules.d</filename> if required</para> <filename class="directory">/etc/udev/rules.d</filename> if required</para>
<indexterm zone="ch-scripts-bootscripts udev-retry-bootscripts"> <indexterm zone="ch-scripts-bootscripts udev-retry-bootscripts">
<primary sortas="d-udev-retry">udev_retry</primary> <primary sortas="d-udev-retry">udev_retry</primary>

View File

@ -12,17 +12,17 @@
<title>Setting Up System Bootscripts</title> <title>Setting Up System Bootscripts</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hosts.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostname.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostname.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hosts.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
</chapter> </chapter>

View File

@ -8,10 +8,10 @@
<sect1 id="ch-scripts-hostname"> <sect1 id="ch-scripts-hostname">
<?dbhtml filename="hostname.html"?> <?dbhtml filename="hostname.html"?>
<title>Configuring the localnet Script</title> <title>Configuring the system hostname</title>
<indexterm zone="ch-scripts-hostname"> <indexterm zone="ch-scripts-hostname">
<primary sortas="d-localnet">localnet</primary> <primary sortas="d-hostname">hostname</primary>
<secondary>configuring</secondary> <secondary>configuring</secondary>
</indexterm> </indexterm>
@ -26,7 +26,6 @@
<para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the name given <para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the name given
to the computer. Do not enter the Fully Qualified Domain Name (FQDN) here. That to the computer. Do not enter the Fully Qualified Domain Name (FQDN) here. That
information will be put in the <filename>/etc/hosts</filename> file in the next information is put in the <filename>/etc/hosts</filename> file.</para>
section.</para>
</sect1> </sect1>

View File

@ -61,7 +61,7 @@ EOF</userinput></screen>
<para>The <replaceable>&lt;192.168.1.1&gt;</replaceable> and <para>The <replaceable>&lt;192.168.1.1&gt;</replaceable> and
<replaceable>&lt;HOSTNAME.example.org&gt;</replaceable> <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable>
values need to be changed for specific users or requirements (if values need to be changed for specific uses or requirements (if
assigned an IP address by a network/system administrator and the assigned an IP address by a network/system administrator and the
machine will be connected to an existing network). The optional alias machine will be connected to an existing network). The optional alias
name(s) can be omitted.</para> name(s) can be omitted.</para>

View File

@ -10,18 +10,81 @@
<title>Introduction</title> <title>Introduction</title>
<para>This chapter details how to install and configure the LFS-Bootscripts <para>This chapter discusses configuration files and boot scripts.
package. Most of these scripts will work without modification, but a few require First, the general configuration files needed to set up networking are
additional configuration files because they deal with hardware-dependent presented.</para>
information.</para>
<itemizedlist>
<listitem>
<para><xref linkend="ch-scripts-network" role="."/></para>
</listitem>
<listitem>
<para><xref linkend="ch-scripts-hosts" role="."/></para>
</listitem>
</itemizedlist>
<para>Second, issues that affect the proper setup of devices diescussed.</para>
<itemizedlist>
<listitem>
<para><xref linkend="ch-scripts-udev" role="."/></para>
</listitem>
<listitem>
<para><xref linkend="ch-scripts-symlinks" role="."/></para>
</listitem>
</itemizedlist>
<para>The next sections detail how to install and configure the LFS system
scripts needed during the boot process. Most of these scripts will work
without modification, but a few require additional configuration files
because they deal with hardware-dependent information.</para>
<para>System-V style init scripts are employed in this book because they are <para>System-V style init scripts are employed in this book because they are
widely used. For additional options, a hint detailing the BSD style init setup widely used and relatively simple. For additional options, a hint detailing
is available at <ulink url="&hints-root;bsd-init.txt"/>. the BSD style init setup is available at <ulink
Searching the LFS mailing lists for <quote>depinit</quote> will also offer url="&hints-root;bsd-init.txt"/>. Searching the LFS mailing lists for
additional choices.</para> <quote>depinit</quote>, <quote>upstart</quote>, or <quote>systemd</quote>
will also offer additional information.</para>
<para>If using an alternative style of init scripts, skip these sections.</para>
<para>A listing of the boot scripts are found in <xref linkend="scripts"
role="."/>.</para>
<itemizedlist>
<listitem>
<para><xref linkend="ch-scripts-bootscripts" role="."/></para>
</listitem>
<listitem>
<para><xref linkend="ch-scripts-usage" role="."/></para>
</listitem>
<listitem>
<para><xref linkend="ch-scripts-hostname" role="."/></para>
</listitem>
<listitem>
<para><xref linkend="ch-scripts-setclock" role="."/></para>
</listitem>
<listitem>
<para><xref linkend="ch-scripts-console" role="."/></para>
</listitem>
<listitem>
<para><xref linkend="ch-scripts-sysklogd" role="."/></para>
</listitem>
</itemizedlist>
<para>Finally, there is a brief introduction to the scripts and configuration
files used when the user logs into the system.</para>
<itemizedlist>
<listitem>
<para><xref linkend="ch-scripts-profile" role="."/></para>
</listitem>
<listitem>
<para><xref linkend="ch-scripts-inputrc" role="."/></para>
</listitem>
</itemizedlist>
<para>If using an alternative style of init scripts, skip this chapter
and move on to <xref linkend="chapter-bootable"/>.</para>
</sect1> </sect1>

View File

@ -8,7 +8,7 @@
<sect1 id="ch-scripts-network"> <sect1 id="ch-scripts-network">
<?dbhtml filename="network.html"?> <?dbhtml filename="network.html"?>
<title>Configuring the network Script</title> <title>General Network Configuration</title>
<indexterm zone="ch-scripts-network"> <indexterm zone="ch-scripts-network">
<primary sortas="d-network">network</primary> <primary sortas="d-network">network</primary>
@ -26,6 +26,11 @@
<sect2> <sect2>
<title>Creating stable names for network interfaces</title> <title>Creating stable names for network interfaces</title>
<para>If there is only one network interface in the system to be
configured, this section is optional, although it will never be wrong to do
it. In many cases (e.g. a laptop with a wireless and a wired interface),
accomplishing the configuration in this section is necessary.</para>
<para>With Udev and modular network drivers, the network interface numbering <para>With Udev and modular network drivers, the network interface numbering
is not persistent across reboots by default, because the drivers are loaded is not persistent across reboots by default, because the drivers are loaded
in parallel and, thus, in random order. For example, on a computer having in parallel and, thus, in random order. For example, on a computer having
@ -112,21 +117,22 @@ done</userinput></screen>
<title>Creating Network Interface Configuration Files</title> <title>Creating Network Interface Configuration Files</title>
<para>Which interfaces are brought up and down by the network script <para>Which interfaces are brought up and down by the network script
depends on the files and directories in the <filename depends on the files in <filename
class="directory">/etc/sysconfig/network-devices</filename> hierarchy. class="directory">/etc/sysconfig/</filename>. This directory should
This directory should contain a sub-directory for each interface to be contain a file for each interface to be configured, such as
configured, such as <filename>ifconfig.xyz</filename>, where <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is is
<quote>xyz</quote> is a network interface name. Inside this directory meaningful to the administrator such as the device name (e.g. eth0).
would be files defining the attributes to this interface, such as its IP Inside this file are attributes to this interface, such as its IP
address(es), subnet masks, and so forth.</para> address(es), subnet masks, and so forth. It is necessary that
the stem of the filename be <emphasis>ifconfig</emphasis>.</para>
<para>The following command creates a sample <filename>ipv4</filename> <para>The following command creates a sample file for the
file for the <emphasis>eth0</emphasis> device:</para> <emphasis>eth0</emphasis> device with a static IP address:</para>
<screen><userinput>cd /etc/sysconfig/network-devices <screen><userinput>cd /etc/sysconfig/
mkdir -v ifconfig.eth0 cat &gt; ifconfig.eth0 &lt;&lt; "EOF"
cat &gt; ifconfig.eth0/ipv4 &lt;&lt; "EOF"
<literal>ONBOOT=yes <literal>ONBOOT=yes
IFACE=eth0
SERVICE=ipv4-static SERVICE=ipv4-static
IP=192.168.1.1 IP=192.168.1.1
GATEWAY=192.168.1.2 GATEWAY=192.168.1.2
@ -135,19 +141,25 @@ BROADCAST=192.168.1.255</literal>
EOF</userinput></screen> EOF</userinput></screen>
<para>The values of these variables must be changed in every file to match <para>The values of these variables must be changed in every file to match
the proper setup. If the <envar>ONBOOT</envar> variable is set to the proper setup.</para>
<quote>yes</quote> the network script will bring up the Network Interface
Card (NIC) during booting of the system. If set to anything but <para>If the <envar>ONBOOT</envar> variable is set to <quote>yes</quote> the
<quote>yes</quote> the NIC will be ignored by the network script and not network script will bring up the Network Interface Card (NIC) during
be brought up.</para> booting of the system. If set to anything but <quote>yes</quote> the NIC
will be ignored by the network script and not be automatically brought up.
The interface can be manually started or stopped with the
<command>ifup</command> and <command>ifdown</command> commands.</para>
<para>The <envar>IFACE</envar> variable defines the interface name,
for example, eth0. It is required for all network device configuration
files. </para>
<para>The <envar>SERVICE</envar> variable defines the method used for <para>The <envar>SERVICE</envar> variable defines the method used for
obtaining the IP address. The LFS-Bootscripts package has a modular IP obtaining the IP address. The LFS-Bootscripts package has a modular IP
assignment format, and creating additional files in the <filename assignment format, and creating additional files in the <filename
class="directory">/etc/sysconfig/network-devices/services</filename> class="directory">/lib/boot/</filename> directory allows other IP
directory allows other IP assignment methods. This is commonly used for assignment methods. This is commonly used for Dynamic Host Configuration
Dynamic Host Configuration Protocol (DHCP), which is addressed in the Protocol (DHCP), which is addressed in the BLFS book.</para>
BLFS book.</para>
<para>The <envar>GATEWAY</envar> variable should contain the default <para>The <envar>GATEWAY</envar> variable should contain the default
gateway IP address, if one is present. If not, then comment out the gateway IP address, if one is present. If not, then comment out the
@ -189,6 +201,10 @@ nameserver <replaceable>&lt;IP address of your secondary nameserver&gt;</replace
# End /etc/resolv.conf</literal> # End /etc/resolv.conf</literal>
EOF</userinput></screen> EOF</userinput></screen>
<para>The <varname>domain</varname> statement can be omitted
or replaced with a <varname>search</varname> statement. See the man page for
resolv.conf for more details.</para>
<para>Replace <replaceable>&lt;IP address of the nameserver&gt;</replaceable> <para>Replace <replaceable>&lt;IP address of the nameserver&gt;</replaceable>
with the IP address of the DNS most appropriate for the setup. There will with the IP address of the DNS most appropriate for the setup. There will
often be more than one entry (requirements demand secondary servers for often be more than one entry (requirements demand secondary servers for
@ -196,6 +212,8 @@ EOF</userinput></screen>
second <emphasis>nameserver</emphasis> line from the file. The IP address second <emphasis>nameserver</emphasis> line from the file. The IP address
may also be a router on the local network.</para> may also be a router on the local network.</para>
<note><para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para></note>
</sect2> </sect2>
</sect1> </sect1>

View File

@ -62,4 +62,7 @@ EOF</userinput></screen>
at <ulink url="&hints-root;time.txt"/>. It explains issues such as at <ulink url="&hints-root;time.txt"/>. It explains issues such as
time zones, UTC, and the <envar>TZ</envar> environment variable.</para> time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
<note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set
in the <filename>/etc/sysconfig/init_params</filename> file.</para></note>
</sect1> </sect1>

View File

@ -16,11 +16,16 @@
</indexterm> </indexterm>
<para>The <filename>sysklogd</filename> script invokes the <para>The <filename>sysklogd</filename> script invokes the
<command>syslogd</command> program with the <parameter>-m 0</parameter> option. <command>syslogd</command> program with the <parameter>-m 0</parameter>
This option turns off the periodic timestamp mark that option. This option turns off the periodic timestamp mark that
<command>syslogd</command> writes to the log files every 20 minutes by default. <command>syslogd</command> writes to the log files every 20 minutes by
If you want to turn on this periodic timestamp mark, edit the default. If you want to turn on this periodic timestamp mark, create or edit
<filename>sysklogd</filename> script and make the changes accordingly. See <filename>/etc/sysconfig/init_params</filename> and define the variable
<userinput>man syslogd</userinput> for more information.</para> SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
set the variable to a null value:</para>
<screen role="nodump">SYSKLOGD_PARMS=</screen>
<para>See <userinput>man syslogd</userinput> for more options.</para>
</sect1> </sect1>

View File

@ -95,7 +95,7 @@
<sect3> <sect3>
<title>Udev Bootscript</title> <title>Udev Bootscript</title>
<para>The <command>S10udev</command> initscript takes care of creating <para>The <command>/etc/rc.d/init.d/udev</command> initscript takes care of creating
device nodes when Linux is booted. The script unsets the uevent handler device nodes when Linux is booted. The script unsets the uevent handler
from the default of <command>/sbin/hotplug</command>. This is done from the default of <command>/sbin/hotplug</command>. This is done
because the kernel no longer needs to call out to an external binary. because the kernel no longer needs to call out to an external binary.
@ -200,7 +200,7 @@
class="filesystem">sysfs</systemitem>. In other cases, one should class="filesystem">sysfs</systemitem>. In other cases, one should
arrange module loading by other means. With Linux-&linux-version;, Udev is arrange module loading by other means. With Linux-&linux-version;, Udev is
known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI,
SERIO and FireWire devices.</para> SERIO, and FireWire devices.</para>
<para>To determine if the device driver you require has the necessary <para>To determine if the device driver you require has the necessary
support for Udev, run <command>modinfo</command> with the module name as support for Udev, run <command>modinfo</command> with the module name as
@ -243,7 +243,7 @@
/sbin/modprobe snd-pcm-oss ; true</literal></screen> /sbin/modprobe snd-pcm-oss ; true</literal></screen>
<para>If the module in question is not a wrapper and is useful by itself, <para>If the module in question is not a wrapper and is useful by itself,
configure the <command>S05modules</command> bootscript to load this configure the <command>modules</command> bootscript to load this
module on system boot. To do this, add the module name to the module on system boot. To do this, add the module name to the
<filename>/etc/sysconfig/modules</filename> file on a separate line. <filename>/etc/sysconfig/modules</filename> file on a separate line.
This works for wrapper modules too, but is suboptimal in that case.</para> This works for wrapper modules too, but is suboptimal in that case.</para>
@ -306,7 +306,7 @@
documentation or the documentation provided by the third party driver documentation or the documentation provided by the third party driver
vendor). The static device node will be copied to vendor). The static device node will be copied to
<filename class="directory">/dev</filename> by the <filename class="directory">/dev</filename> by the
<command>S10udev</command> bootscript.</para> <command>udev</command> bootscript.</para>
</sect3> </sect3>

View File

@ -37,7 +37,80 @@
5: same as 4, it is usually used for GUI login (like X's <command>xdm</command> or KDE's <command>kdm</command>) 5: same as 4, it is usually used for GUI login (like X's <command>xdm</command> or KDE's <command>kdm</command>)
6: reboot the computer</literallayout> 6: reboot the computer</literallayout>
<para>The command used to change run-levels is <command>init <sect2 id="conf-sysvinit" role="configuration">
<title>Configuring Sysvinit</title>
<indexterm zone="conf-sysvinit">
<primary sortas="a-Sysvinit">Sysvinit</primary>
<secondary>configuring</secondary>
</indexterm>
<indexterm zone="conf-sysvinit">
<primary sortas="e-/etc/inittab">/etc/inittab</primary>
</indexterm>
<para>During the kernel initialization, the first program that is run
is either specified on the command line or, by default
<command>init</command>. This program reads the initialization file
<filename>/etc/inittab</filename>. Create this file with:</para>
<screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
<literal># Begin /etc/inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc sysinit
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016:once:/sbin/sulogin
1:2345:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600
# End /etc/inittab</literal>
EOF</userinput></screen>
<para>An explanation of this initialization file is in the man page for
<emphasis>inittab</emphasis>. For LFS, the key command that is run is
<command>rc</command>. The intialization file above will instruct
<command>rc</command> to run all the scripts starting with an S in the
<filename class="directory">/etc/rc.d/rcsysinit.d</filename> directory
followed by all the scripts starting with an S in the <filename
class="directory">/etc/rc.d/rc?.d</filename> directory where the question
mark is specified by the initdefault value.</para>
<para>As a convenience, the <command>rc</command> script reads a library of
functions in <filename class="directory">/lib/boot/functions</filename>.
This library also reads an optional configuration file,
<filename>/etc/sysconfig/init_params</filename>. Any of the system
configuration file parameters described in subsequent sections can be
alternatively placed in this file allowing consolidation of all system
parameters in thsi one file.</para>
<para>As a debugging convenience, the functions script also logs all output
to <filename>/run/var/bootlog</filename>. Since the <filename
class="directory">/run</filename> directory is a tmpfs, this file is not
persistent across boots.</para>
</sect2>
<sect2 id="init-levels" >
<title>Changing Run Levels</title>
<para>Changing run-levels is done with <command>init
<replaceable>&lt;runlevel&gt;</replaceable></command>, where <replaceable>&lt;runlevel&gt;</replaceable></command>, where
<replaceable>&lt;runlevel&gt;</replaceable> is the target run-level. For example, to <replaceable>&lt;runlevel&gt;</replaceable> is the target run-level. For example, to
reboot the computer, a user could issue the <command>init 6</command> command, reboot the computer, a user could issue the <command>init 6</command> command,
@ -59,7 +132,7 @@
<para>The real scripts are in <filename <para>The real scripts are in <filename
class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and
the symlinks all point to them. Killing links and starting links point to the symlinks all point to them. K links and S links point to
the same script in <filename class="directory">/etc/rc.d/init.d</filename>. the same script in <filename class="directory">/etc/rc.d/init.d</filename>.
This is because the scripts can be called with different parameters like This is because the scripts can be called with different parameters like
<parameter>start</parameter>, <parameter>stop</parameter>, <parameter>start</parameter>, <parameter>stop</parameter>,
@ -126,4 +199,6 @@
it is your own LFS system). The files given here are an example of how it is your own LFS system). The files given here are an example of how
it can be done.</para> it can be done.</para>
</sect2>
</sect1> </sect1>

View File

@ -1,7 +1,7 @@
<!ENTITY version "SVN-20110717"> <!ENTITY version "SVN-20110801">
<!ENTITY releasedate "July 17, 2011"> <!ENTITY releasedate "Aug 1, 2011">
<!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not &ndash; --> <!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not &ndash; -->
<!ENTITY milestone "6.9"> <!ENTITY milestone "7.0">
<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->
<!ENTITY lfs-root "http://www.linuxfromscratch.org/"> <!ENTITY lfs-root "http://www.linuxfromscratch.org/">

View File

@ -297,7 +297,7 @@
<!ENTITY less-ch6-du "3.5 MB"> <!ENTITY less-ch6-du "3.5 MB">
<!ENTITY less-ch6-sbu "less than 0.1 SBU"> <!ENTITY less-ch6-sbu "less than 0.1 SBU">
<!ENTITY lfs-bootscripts-version "20110531"> <!-- Scripts depend on this format --> <!ENTITY lfs-bootscripts-version "20110801"> <!-- Scripts depend on this format -->
<!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB"> <!-- Updated in Makefile --> <!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB"> <!-- Updated in Makefile -->
<!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2"> <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2">
<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!-- Updated in Makefile --> <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!-- Updated in Makefile -->

View File

@ -111,8 +111,8 @@
<varlistentry> <varlistentry>
<term><emphasis>LSB Core:</emphasis></term> <term><emphasis>LSB Core:</emphasis></term>
<listitem> <listitem>
<para>Bc, Cpio, Ed, Fcrontab, PAM, Sendmail (or Postfix or Exim) <para>Bc, Cpio, Ed, Fcrontab, Initd-tools, PAM,
</para> Sendmail (or Postfix or Exim) </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -164,7 +164,7 @@
<varlistentry> <varlistentry>
<term><emphasis>LSB Core:</emphasis></term> <term><emphasis>LSB Core:</emphasis></term>
<listitem> <listitem>
<para>At, Batch, Install_initd, Lsb_release, Remove_initd, Test <para>At, Batch, Lsb_release
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>