aboutsummaryrefslogtreecommitdiffstats
path: root/bootscripts
diff options
context:
space:
mode:
Diffstat (limited to 'bootscripts')
-rw-r--r--bootscripts/ChangeLog26
-rw-r--r--bootscripts/LICENSE29
-rw-r--r--bootscripts/Makefile60
-rw-r--r--bootscripts/README133
-rw-r--r--bootscripts/contrib/lsb/Makefile11
-rw-r--r--bootscripts/contrib/lsb/lib/init-functions348
-rw-r--r--bootscripts/contrib/sysconfig/network-devices/services/mtu45
-rw-r--r--bootscripts/lfs/init.d/checkfs201
-rw-r--r--bootscripts/lfs/init.d/cleanfs37
-rw-r--r--bootscripts/lfs/init.d/console157
-rwxr-xr-xbootscripts/lfs/init.d/consolelog96
-rw-r--r--bootscripts/lfs/init.d/functions1024
-rw-r--r--bootscripts/lfs/init.d/halt38
-rw-r--r--bootscripts/lfs/init.d/localnet90
-rw-r--r--bootscripts/lfs/init.d/modules105
-rw-r--r--bootscripts/lfs/init.d/mountfs98
-rw-r--r--bootscripts/lfs/init.d/mountvirtfs85
-rw-r--r--bootscripts/lfs/init.d/network110
-rw-r--r--bootscripts/lfs/init.d/rc162
-rw-r--r--bootscripts/lfs/init.d/reboot41
-rw-r--r--bootscripts/lfs/init.d/sendsignals73
-rw-r--r--bootscripts/lfs/init.d/setclock70
-rw-r--r--bootscripts/lfs/init.d/swap84
-rw-r--r--bootscripts/lfs/init.d/sysctl54
-rw-r--r--bootscripts/lfs/init.d/sysklogd99
-rw-r--r--bootscripts/lfs/init.d/template80
-rw-r--r--bootscripts/lfs/init.d/udev133
-rw-r--r--bootscripts/lfs/init.d/udev_retry77
-rw-r--r--bootscripts/lfs/sysconfig/network-devices/ifdown115
-rw-r--r--bootscripts/lfs/sysconfig/network-devices/ifup126
-rw-r--r--bootscripts/lfs/sysconfig/network-devices/services/ipv4-static111
-rw-r--r--bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route126
32 files changed, 1937 insertions, 2107 deletions
diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog
index 00e35927e..92601ef59 100644
--- a/bootscripts/ChangeLog
+++ b/bootscripts/ChangeLog
@@ -1,21 +1,37 @@
-2011-05-31 DJ Lucas <dj@linuxfromscratch.org>
+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>
* lfs/init.d/udev: Add multiple udev triggers for both subsystems and
devices per upstream recommendation.
-2011-04-19 Bruce Dubbs <bdubbs@linuxfromscratch.org>
+2011-04-19 Bruce Dubbs <bdubbs@linuxfromscratch.org>
* lfs/init.d/mountvirtfs: Add creation of /run/{var,lock,shm}.
* lfs/init.d/udev: Add /dev/shm -> /run/shm symlink.
-2011-04-18 Bruce Dubbs <bdubbs@linuxfromscratch.org>
+2011-04-18 Bruce Dubbs <bdubbs@linuxfromscratch.org>
* lfs/init.d/mountvirtfs: Change name from mountkernfs to mountvirtfs.
Add mounting of /run filesystem.
-2010-05-29 Matt Burgess <matthew@linuxfromscratch.org>
+2010-05-29 Matt Burgess <matthew@linuxfromscratch.org>
* lfs/init.d/udev: Only copy /lib/udev/devices/null, as Udev >= 155 copies
devices from /lib/udev/devices to /dev itself. Udevd still needs /dev/null
present before starting up though.
-2010-04-20 Bryan Kadzban <bryan@linuxfromscratch.org>
+2010-04-20 Bryan Kadzban <bryan@linuxfromscratch.org>
* lfs/init.d/udev, lfs/init.d/udev_retry: Add --action=add, to handle udev
version 152 and newer, which send "change" events by default in udevtrigger
now.
diff --git a/bootscripts/LICENSE b/bootscripts/LICENSE
deleted file mode 100644
index 8beeec4bd..000000000
--- a/bootscripts/LICENSE
+++ /dev/null
@@ -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.
-
diff --git a/bootscripts/Makefile b/bootscripts/Makefile
index 54b8f6562..2dfde6ed3 100644
--- a/bootscripts/Makefile
+++ b/bootscripts/Makefile
@@ -1,5 +1,6 @@
ETCDIR=/etc
EXTDIR=${DESTDIR}${ETCDIR}
+LIBDIR=${DESTDIR}/lib/boot
MODE=754
DIRMODE=755
CONFMODE=644
@@ -17,14 +18,13 @@ create-dirs:
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rcsysinit.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d
install -d -m ${DIRMODE} ${EXTDIR}/sysconfig
+ install -d -m ${DIRMODE} ${LIBDIR}
-create-service-dir:
- install -d -m ${DIRMODE} ${EXTDIR}/sysconfig/network-devices/services
-
-install: create-dirs create-service-dir
+install: create-dirs
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 ${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/console ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/consolelog ${EXTDIR}/rc.d/init.d/
@@ -37,31 +37,31 @@ install: create-dirs create-service-dir
install -m ${MODE} lfs/init.d/reboot ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/sendsignals ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/setclock ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/sysklogd ${EXTDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/sysklogd ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/swap ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/sysctl ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/template ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/udev ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/udev_retry ${EXTDIR}/rc.d/init.d/
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc0.d/K80network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc0.d/K90sysklogd
+ ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc0.d/K90sysklogd
ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals
ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc0.d/S70mountfs
ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc0.d/S80swap
ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rc0.d/S90localnet
ln -sf ../init.d/halt ${EXTDIR}/rc.d/rc0.d/S99halt
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc1.d/K80network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc1.d/K90sysklogd
+ ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc1.d/K90sysklogd
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc2.d/K80network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc2.d/K90sysklogd
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc3.d/S10sysklogd
+ ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc2.d/K90sysklogd
+ ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc3.d/S10sysklogd
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc3.d/S20network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc4.d/S10sysklogd
+ ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc4.d/S10sysklogd
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc4.d/S20network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc5.d/S10sysklogd
+ ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc5.d/S10sysklogd
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc5.d/S20network
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc6.d/K80network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc6.d/K90sysklogd
+ ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc6.d/K90sysklogd
ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc6.d/S60sendsignals
ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc6.d/S70mountfs
ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc6.d/S80swap
@@ -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/localnet ${EXTDIR}/rc.d/rcsysinit.d/S80localnet
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/modules ]; then install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/; fi
- if [ ! -f ${EXTDIR}/sysconfig/rc ]; then install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/; fi
- install -m ${MODE} lfs/sysconfig/network-devices/ifup ${EXTDIR}/sysconfig/network-devices/
- install -m ${MODE} lfs/sysconfig/network-devices/ifdown ${EXTDIR}/sysconfig/network-devices/
- install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static ${EXTDIR}/sysconfig/network-devices/services/
- install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static-route ${EXTDIR}/sysconfig/network-devices/services/
+ if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/ ;\
+ fi
+ if [ ! -f ${EXTDIR}/sysconfig/modules ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/ ;\
+ fi
+ 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 -m ${MODE} contrib/init.d/consolelog ${EXTDIR}/rc.d/init.d
ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S00consolelog
-install-lsb-compliant:
- 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
+minimal: create-dirs
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 ${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/localnet ${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/mountfs ${EXTDIR}/rc.d/rcsysinit.d/S40mountfs
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 \
- install install-service-mtu
+.PHONY: all create-dirs install
diff --git a/bootscripts/README b/bootscripts/README
index 4b908dc4a..726fa1747 100644
--- a/bootscripts/README
+++ b/bootscripts/README
@@ -1,76 +1,79 @@
Network Configuration:
- Script Files:
- rc.d/init.d/network
- sysconfig/network-devices/ifup
- sysconfig/network-devices/ifdown
- sysconfig/network-devices/services/*
+ Script Files:
+ /etc/rc.d/init.d/network
+ /sbin/ifup
+ /sbin/ifdown
+ /lib/boot/*/*
- Configuration Files:
- sysconfig/network-devices/ifconfig.*/*
- Note: ifconfig.* could be either a file or directory,
- but the filename extension must be the same name
- as the network interface you wish it to belong to.
- The files within the directory will be processed
- in alphanumerical order on boot, and reversed on
- shutdown.
- - SERVICE: which script to run in services directory.
- - ONBOOT: if set to yes, this interface will be started on
- bootup, and stopped on shutdown
+ Configuration Files:
+ /etc/sysconfig/ifconfig.*
+ Note: ifconfig.* could be either a file or directory,
+ but the filename extension must be the same name
+ as the network interface you wish it to belong to.
+ The files within the directory will be processed
+ in alphanumerical order on boot, and reversed on
+ shutdown.
+ - IFACE: the interface that is being configured (e.g. eth0)
+ - SERVICE: which script to run in services directory.
+ - ONBOOT: if set to yes, this interface will be started on
+ bootup, and stopped on shutdown
- sysconfig/network
- - HOSTNAME: Value of the system's hostname
+ /etc/sysconfig/network
+ - HOSTNAME: Value of the system's hostname
- Additional Configuration:
- sysconfig/network-devices/ifconfig.*
- ipv4-static:
- - IP: static IP Address
- - GATEWAY: Specifies the IP Address of the gateway server
- - PREFIX: CIDR prefix of IP Address, defaults to 24 if not set
- - PEER: IP Address of peer (for point-to-point connections and tunnels)
- - BROADCAST: broadcast address
- ipv4-static-route:
- - TYPE: network (default type if not specified), default, host or
- unreachable
- - IP: IP Address of target (for network, host and unreachable)
- - PREFIX: CIDR prefix of target (for network, host and unreachable)
- - GATEWAY: IP Address of gateway to reach target (for network and default)
+ Additional Configuration:
+ ipv4-static:
+ - IP: static IP Address
+ - GATEWAY: Specifies the IP Address of the gateway server
+ - PREFIX: CIDR prefix of IP Address, defaults to 24 if not set
+ - PEER: IP Address of peer (for point-to-point connections and tunnels)
+ - BROADCAST: broadcast address
+
+ ipv4-static-route:
+ - TYPE: network (default type if not specified), default, host or
+ unreachable
+ - IP: IP Address of target (for network, host and unreachable)
+ - PREFIX: CIDR prefix of target (for network, host and unreachable)
+ - GATEWAY: IP Address of gateway to reach target (for network and default)
SetClock configuration:
- Script Files:
- rc.d/init.d/setclock
+ Script Files:
+ /etc/rc.d/init.d/setclock
+ - SKIPTMPCLEAN: skips cleaning of /tmp directory
- Configuration Files:
- sysconfig/clock
- - UTC: 1 assumes hwclock is in UTC
- 0 assumes hwclock is in local time
- - CLOCKPARAMS: any additional options to be passed to hwclock
+ Configuration Files:
+ /etc/sysconfig/clock
+ - UTC: 1 assumes hwclock is in UTC
+ 0 assumes hwclock is in local time
+ - CLOCKPARAMS: any additional options to be passed to hwclock
CleanFS configuration:
- Script Files:
- rc.d/init.d/cleanfs
+ Script Files:
+ /etc/rc.d/init.d/cleanfs
+
+ Configuration Files:
+ /etc/sysconfig/createfiles
+ Each line is parsed, using space as a deliminator.
+ [NAME] [TYPE] [PERMISSIONS] [USER] [GROUP]
+ The below fields are currently only used on dev type.
+ ([DEV TYPE] [MAJOR#] [MINOR#])
+ Name:
+ File/Directory/Device name
+ Type:
+ dir: creates a directory
+ file: creates a file
+ dev: creates a device
+ Permissions:
+ chmod the created file
+ User/Group:
+ chown the created file/dir to this user/group
+ Dev Type:
+ char: character [needs MAJOR#, MINOR#]
+ block: block [needs MAJOR#, MINOR#]
+ pipe: pipe
+ Major#:
+ Used by character and block devices.
+ Minor#:
+ Used by character and block devices.
- Configuration Files:
- /etc/sysconfig/createfiles
- Each line is parsed, using space as a deliminator.
- [NAME] [TYPE] [PERMISSIONS] [USER] [GROUP]
- The below fields are currently only used on dev type.
- ([DEV TYPE] [MAJOR#] [MINOR#])
- Name:
- File/Directory/Device name
- Type:
- dir: creates a directory
- file: creates a file
- dev: creates a device
- Permissions:
- chmod the created file
- User/Group:
- chown the created file/dir to this user/group
- Dev Type:
- char: character [needs MAJOR#, MINOR#]
- block: block [needs MAJOR#, MINOR#]
- pipe: pipe
- Major#:
- Used by character and block devices.
- Minor#:
- Used by character and block devices.
diff --git a/bootscripts/contrib/lsb/Makefile b/bootscripts/contrib/lsb/Makefile
deleted file mode 100644
index 445608164..000000000
--- a/bootscripts/contrib/lsb/Makefile
+++ /dev/null
@@ -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
diff --git a/bootscripts/contrib/lsb/lib/init-functions b/bootscripts/contrib/lsb/lib/init-functions
deleted file mode 100644
index 3f1ec2400..000000000
--- a/bootscripts/contrib/lsb/lib/init-functions
+++ /dev/null
@@ -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
-}
-
diff --git a/bootscripts/contrib/sysconfig/network-devices/services/mtu b/bootscripts/contrib/sysconfig/network-devices/services/mtu
deleted file mode 100644
index 5a7de080e..000000000
--- a/bootscripts/contrib/sysconfig/network-devices/services/mtu
+++ /dev/null
@@ -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
diff --git a/bootscripts/lfs/init.d/checkfs b/bootscripts/lfs/init.d/checkfs
index 268598c37..2ad3e1921 100644
--- a/bootscripts/lfs/init.d/checkfs
+++ b/bootscripts/lfs/init.d/checkfs
@@ -1,15 +1,14 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/checkfs
+# Begin checkfs
#
# Description : File System Check
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# A. Luebke - luebke@users.sourceforge.net
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
# Based on checkfs script from LFS-3.1 and earlier.
#
@@ -25,107 +24,119 @@
#
#########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- start)
- if [ -f /fastboot ]; then
- boot_mesg -n "/fastboot found, will not perform" ${INFO}
- boot_mesg " file system checks as requested."
- echo_ok
- exit 0
- fi
+ start)
+ if [ -f /fastboot ]; then
+ boot_mesg -n "/fastboot found, will not perform" ${INFO}
+ boot_mesg " file system checks as requested."
+ echo_ok
+ exit 0
+ fi
- boot_mesg "Mounting root file system in read-only mode..."
- mount -n -o remount,ro / >/dev/null
- evaluate_retval
+ boot_mesg "Mounting root file system in read-only mode..."
+ mount -n -o remount,ro / >/dev/null
+ evaluate_retval
- if [ ${?} != 0 ]; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE}
- boot_mesg -n " filesystem because it could not be mounted"
- boot_mesg -n " in read-only mode.\n\nAfter you"
- boot_mesg -n " press Enter, this system will be"
- boot_mesg -n " halted and powered off."
- boot_mesg -n "\n\nPress enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
- read ENTER
- ${rc_base}/init.d/halt stop
- fi
+ if [ ${?} != 0 ]; then
+ echo_failure
+ boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE}
+ boot_mesg -n " filesystem because it could not be mounted"
+ boot_mesg -n " in read-only mode.\n\nAfter you"
+ boot_mesg -n " press Enter, this system will be"
+ boot_mesg -n " halted and powered off."
+ boot_mesg -n "\n\nPress enter to continue..." ${INFO}
+ boot_mesg "" ${NORMAL}
+ wait_for_user
+ /etc/rc.d/init.d/halt stop
+ fi
- if [ -f /forcefsck ]; then
- boot_mesg -n "/forcefsck found, forcing file" ${INFO}
- boot_mesg " system checks as requested."
- echo_ok
- options="-f"
- else
- options=""
- fi
+ if [ -f /forcefsck ]; then
+ boot_mesg -n "/forcefsck found, forcing file" ${INFO}
+ boot_mesg " system checks as requested."
+ echo_ok
+ options="-f"
+ else
+ options=""
+ fi
- boot_mesg "Checking file systems..."
- # Note: -a option used to be -p; but this fails e.g.
- # on fsck.minix
- fsck ${options} -a -A -C -T
- error_value=${?}
+ boot_mesg "Checking file systems..."
+ # Note: -a option used to be -p; but this fails e.g.
+ # on fsck.minix
+ fsck ${options} -a -A -C -T
+ error_value=${?}
- if [ "${error_value}" = 0 ]; then
- echo_ok
- fi
+ if [ "${error_value}" = 0 ]; then
+ echo_ok
+ fi
- if [ "${error_value}" = 1 ]; then
- echo_warning
- boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
- boot_mesg -n " were found and have been corrected."
- boot_mesg -n " You may want to double-check that"
- boot_mesg -n " everything was fixed properly."
- boot_mesg "" ${NORMAL}
- fi
+ if [ "${error_value}" = 1 ]; then
+ echo_warning
+ boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
+ boot_mesg -n " were found and have been corrected. "
+ boot_mesg -n " You may want to double-check that"
+ boot_mesg -n " everything was fixed properly."
+ boot_mesg "" ${NORMAL}
+ fi
- if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
- echo_warning
- boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
- boot_mesg -n " were found and have been been"
- boot_mesg -n " corrected, but the nature of the"
- boot_mesg -n " errors require this system to be"
- boot_mesg -n " rebooted.\n\nAfter you press enter,"
- boot_mesg -n " this system will be rebooted"
- boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
- read ENTER
- reboot -f
- fi
+ if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
+ echo_warning
+ boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
+ boot_mesg -n " were found and have been been"
+ boot_mesg -n " corrected, but the nature of the"
+ boot_mesg -n " errors require this system to be"
+ boot_mesg -n " rebooted.\n\nAfter you press enter,"
+ boot_mesg -n " this system will be rebooted"
+ boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+ boot_mesg "" ${NORMAL}
+ wait_for_user
+ reboot -f
+ fi
- if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE}
- boot_mesg -n " were encountered that could not be"
- boot_mesg -n " fixed automatically. This system"
- boot_mesg -n " cannot continue to boot and will"
- boot_mesg -n " therefore be halted until those"
- boot_mesg -n " errors are fixed manually by a"
- boot_mesg -n " System Administrator.\n\nAfter you"
- boot_mesg -n " press Enter, this system will be"
- boot_mesg -n " halted and powered off."
- boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
- read ENTER
- ${rc_base}/init.d/halt stop
- fi
+ if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
+ echo_failure
+ boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE}
+ boot_mesg -n " were encountered that could not be"
+ boot_mesg -n " fixed automatically. This system"
+ boot_mesg -n " cannot continue to boot and will"
+ boot_mesg -n " therefore be halted until those"
+ boot_mesg -n " errors are fixed manually by a"
+ boot_mesg -n " System Administrator.\n\nAfter you"
+ boot_mesg -n " press Enter, this system will be"
+ boot_mesg -n " halted and powered off."
+ boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+ boot_mesg "" ${NORMAL}
+ wait_for_user
+ /etc/rc.d/init.d/halt stop
+ fi
- if [ "${error_value}" -ge 16 ]; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE}
- boot_mesg -n " running fsck. Exited with error"
- boot_mesg -n " code: ${error_value}."
- boot_mesg "" ${NORMAL}
- exit ${error_value}
- fi
- ;;
- *)
- echo "Usage: ${0} {start}"
- exit 1
- ;;
+ if [ "${error_value}" -ge 16 ]; then
+ echo_failure
+ boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE}
+ boot_mesg -n " running fsck. Exited with error"
+ boot_mesg -n " code: ${error_value}."
+ boot_mesg "" ${NORMAL}
+ exit ${error_value}
+ fi
+ ;;
+ *)
+ echo "Usage: ${0} {start}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/checkfs
+# End checkfs
diff --git a/bootscripts/lfs/init.d/cleanfs b/bootscripts/lfs/init.d/cleanfs
index e88ea5bac..09fd4d449 100644
--- a/bootscripts/lfs/init.d/cleanfs
+++ b/bootscripts/lfs/init.d/cleanfs
@@ -1,19 +1,32 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/cleanfs
+# Begin cleanfs
#
# Description : Clean file system
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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.
create_files() {
@@ -21,7 +34,6 @@ create_files() {
exec 9>&0 < /etc/sysconfig/createfiles
while read name type perm usr grp dtype maj min junk
do
-
# Ignore comments and blank lines.
case "${name}" in
""|\#*) continue ;;
@@ -73,10 +85,11 @@ case "${1}" in
start)
boot_mesg -n "Cleaning file systems:" ${INFO}
- boot_mesg -n " /tmp" ${NORMAL}
- cd /tmp &&
- find . -xdev -mindepth 1 ! -name lost+found \
- -delete || failed=1
+ if [ "${SKIPTMPCLEAN}" = "" ]; then
+ boot_mesg -n " /tmp" ${NORMAL}
+ cd /tmp &&
+ find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
+ fi
> /var/run/utmp
@@ -100,4 +113,4 @@ case "${1}" in
;;
esac
-# End $rc_base/init.d/cleanfs
+# End cleanfs
diff --git a/bootscripts/lfs/init.d/console b/bootscripts/lfs/init.d/console
index aa6232e0a..9929f5429 100644
--- a/bootscripts/lfs/init.d/console
+++ b/bootscripts/lfs/init.d/console
@@ -1,96 +1,107 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/console
+# Begin console
#
# Description : Sets keymap and screen font
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
-# Alexander E. Patrakov
+# Alexander E. Patrakov
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.03
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+. /lib/boot/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
-if [ -f /etc/sysconfig/console ]
-then
- . /etc/sysconfig/console
+if [ -r /etc/sysconfig/console ]; then
+ . /etc/sysconfig/console
else
- exit 0
+ exit 0
fi
is_true() {
- [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
+ [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
}
failed=0
case "${1}" in
- start)
- boot_mesg "Setting up Linux console..."
- # There should be no bogus failures below this line!
-
- # Figure out if a framebuffer console is used
- [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
-
- # Figure out the command to set the console into the
- # desired mode
- is_true "${UNICODE}" &&
- MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" ||
- MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a"
-
- # On framebuffer consoles, font has to be set for each vt in
- # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
-
- ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
- MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
-
- # Apply that command to all consoles mentioned in
- # /etc/inittab. Important: in the UTF-8 mode this should
- # happen before setfont, otherwise a kernel bug will
- # show up and the unicode map of the font will not be
- # used.
- # FIXME: Fedora Core also initializes two spare consoles
- # - do we want that?
-
- for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
- grep -o '\btty[[:digit:]]*\b'`
- do
- openvt -f -w -c ${TTY#tty} -- \
- /bin/sh -c "${MODE_COMMAND}" || failed=1
- done
-
- # Set the font (if not already set above) and the keymap
- is_true "${USE_FB}" || [ -z "${FONT}" ] ||
- setfont $FONT ||
- failed=1
- [ -z "${KEYMAP}" ] ||
- loadkeys ${KEYMAP} >/dev/null 2>&1 ||
- failed=1
- [ -z "${KEYMAP_CORRECTIONS}" ] ||
- loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
- failed=1
-
- # Convert the keymap from $LEGACY_CHARSET to UTF-8
- [ -z "$LEGACY_CHARSET" ] ||
- dumpkeys -c "$LEGACY_CHARSET" |
- loadkeys -u >/dev/null 2>&1 ||
- failed=1
-
- # If any of the commands above failed, the trap at the
- # top would set $failed to 1
- ( exit $failed )
- evaluate_retval
- ;;
- *)
- echo $"Usage:" "${0} {start}"
- exit 1
- ;;
+ start)
+ boot_mesg "Setting up Linux console..."
+ # There should be no bogus failures below this line!
+
+ # Figure out if a framebuffer console is used
+ [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
+
+ # Figure out the command to set the console into the
+ # desired mode
+ is_true "${UNICODE}" &&
+ MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" ||
+ MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a"
+
+ # On framebuffer consoles, font has to be set for each vt in
+ # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
+
+ ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
+ MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
+
+ # Apply that command to all consoles mentioned in
+ # /etc/inittab. Important: in the UTF-8 mode this should
+ # happen before setfont, otherwise a kernel bug will
+ # show up and the unicode map of the font will not be
+ # used.
+ # FIXME: Fedora Core also initializes two spare consoles
+ # - do we want that?
+
+ for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
+ grep -o '\btty[[:digit:]]*\b'`
+ do
+ openvt -f -w -c ${TTY#tty} -- \
+ /bin/sh -c "${MODE_COMMAND}" || failed=1
+ done
+
+ # Set the font (if not already set above) and the keymap
+ is_true "${USE_FB}" || [ -z "${FONT}" ] ||
+ setfont $FONT ||
+ failed=1
+ [ -z "${KEYMAP}" ] ||
+ loadkeys ${KEYMAP} >/dev/null 2>&1 ||
+ failed=1
+ [ -z "${KEYMAP_CORRECTIONS}" ] ||
+ loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
+ failed=1
+
+ # Convert the keymap from $LEGACY_CHARSET to UTF-8
+ [ -z "$LEGACY_CHARSET" ] ||
+ dumpkeys -c "$LEGACY_CHARSET" |
+ loadkeys -u >/dev/null 2>&1 ||
+ failed=1
+
+ # If any of the commands above failed, the trap at the
+ # top would set $failed to 1
+ ( exit $failed )
+ evaluate_retval
+ ;;
+ *)
+ echo $"Usage:" "${0} {start}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/console
+# End console
diff --git a/bootscripts/lfs/init.d/consolelog b/bootscripts/lfs/init.d/consolelog
index 34b416195..389e86f9f 100755
--- a/bootscripts/lfs/init.d/consolelog
+++ b/bootscripts/lfs/init.d/consolelog
@@ -1,61 +1,73 @@
#!/bin/sh
-# Begin $rc_base/init.d/consolelog
-
########################################################################
+# Begin consolelog
#
# Description : Set the kernel log level for the console
#
# 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
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
LOGLEVEL=7
-if [ -r /etc/sysconfig/console ]; then
- . /etc/sysconfig/console
-fi
+
+[ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
case "${1}" in
- start)
- case "$LOGLEVEL" in
- [1-8])
- boot_mesg "Setting the console log level to ${LOGLEVEL}..."
- dmesg -n $LOGLEVEL
- evaluate_retval
- ;;
- *)
- boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
- echo_failure
- ;;
- esac
- ;;
- status)
- # Read the current value if possible
- if [ -r /proc/sys/kernel/printk ]; then
- read level line < /proc/sys/kernel/printk
- else
- boot_mesg "Can't read the current console log level" ${FAILURE}
- echo_failure
- fi
-
- # Print the value
- if [ -n "$level" ]; then
- ${ECHO} -e "${INFO}The current console log level" \
- "is ${level}${NORMAL}"
- fi
- ;;
-
- *)
- echo "Usage: ${0} {start|status}"
- exit 1
- ;;
+ start)
+ case "$LOGLEVEL" in
+ [1-8])
+ boot_mesg "Setting the console log level to ${LOGLEVEL}..."
+ dmesg -n $LOGLEVEL
+ evaluate_retval
+ ;;
+ *)
+ boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
+ echo_failure
+ ;;
+ esac
+ ;;
+
+ status)
+ # Read the current value if possible
+ if [ -r /proc/sys/kernel/printk ]; then
+ read level line < /proc/sys/kernel/printk
+ else
+ boot_mesg "Can't read the current console log level" ${FAILURE}
+ echo_failure
+ fi
+
+ # Print the value
+ if [ -n "$level" ]; then
+ ${ECHO} -e "${INFO}The current console log level is ${level}${NORMAL}"
+ fi
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|status}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/consolelog
+# End consolelog
diff --git a/bootscripts/lfs/init.d/functions b/bootscripts/lfs/init.d/functions
index 77d3e5cfe..e91ce5b5a 100644
--- a/bootscripts/lfs/init.d/functions
+++ b/bootscripts/lfs/init.d/functions
@@ -1,18 +1,24 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/functions
+# Begin boot functions
#
# Description : Run Level Control Functions
#
# 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
-# 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
# Setup default values for environment
umask 022
@@ -27,13 +33,13 @@ KILLDELAY="3"
## Screen Dimensions
# Find current screen size
if [ -z "${COLUMNS}" ]; then
- COLUMNS=$(stty size)
- COLUMNS=${COLUMNS##* }
+ 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
+ COLUMNS=80
fi
## Measurements for positioning result messages
@@ -43,12 +49,12 @@ WCOL=$((${COL} - 2))
## Provide an echo that supports -e and -n
# If formatting is needed, $ECHO should be used
case "`echo -e -n test`" in
- -[en]*)
- ECHO=/bin/echo
- ;;
- *)
- ECHO=echo
- ;;
+ -[en]*)
+ ECHO=/bin/echo
+ ;;
+ *)
+ ECHO=echo
+ ;;
esac
## Set Cursor Position Commands, used via $ECHO
@@ -84,300 +90,282 @@ STRING_LENGTH="0" # the length of the current message
# Outputs: Standard Output
#
# Dependencies: - sed for parsing strings.
-# - grep for counting string length.
+# - grep for counting string length.
#
# Todo:
#*******************************************************************************
boot_mesg()
{
- local ECHOPARM=""
-
- while true
- do
- case "${1}" in
- -n)
- ECHOPARM=" -n "
- shift 1
- ;;
- -*)
- echo "Unknown Option: ${1}"
- return 1
- ;;
- *)
- break
- ;;
- esac
- done
-
- ## Figure out the length of what is to be printed to be used
- ## for warning messages.
- STRING_LENGTH=$((${#1} + 1))
-
- # Print the message to the screen
- ${ECHO} ${ECHOPARM} -e "${2}${1}"
-
+ local ECHOPARM=""
+
+ while true
+ do
+ case "${1}" in
+ -n)
+ ECHOPARM=" -n "
+ shift 1
+ ;;
+ -*)
+ echo "Unknown Option: ${1}"
+ return 1
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
+ ## Figure out the length of what is to be printed to be used
+ ## for warning messages.
+ STRING_LENGTH=$((${#1} + 1))
+
+ # Print the message to the screen
+ ${ECHO} ${ECHOPARM} -e "${2}${1}"
+
+ # Log the message
+ ${ECHO} ${ECHOPARM} -e "${2}${1}" >> /run/var/bootlog
}
boot_mesg_flush()
{
- # Reset STRING_LENGTH for next message
- STRING_LENGTH="0"
-}
-
-boot_log()
-{
- # Left in for backwards compatibility
- :
+ # Reset STRING_LENGTH for next message
+ STRING_LENGTH="0"
}
echo_ok()
{
- ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]"
- ${ECHO} -e "${NORMAL}"
+ ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]"
+ ${ECHO} -e "${NORMAL}"
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} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]"
- ${ECHO} -e "${NORMAL}"
+ ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]"
+ ${ECHO} -e "${NORMAL}"
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} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
- ${ECHO} -e "${NORMAL}"
+ ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
+ ${ECHO} -e "${NORMAL}"
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
- # $i is inherited by the rc script
- 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}
- read ENTER
+ ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]"
+ ${ECHO} -e "${NORMAL}"
+ boot_mesg_flush
+ ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]" >> /run/var/bootlog
+ ${ECHO} -e "${NORMAL}" >> /run/var/bootlog
}
-check_script_status()
+wait_for_user()
{
- # $i is inherited by the rc script
- 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
+ # Wait for the user by default
+ [ "${HEADLESS=0}" = "0" ] && read ENTER
}
evaluate_retval()
{
- error_value="${?}"
+ error_value="${?}"
- if [ ${error_value} = 0 ]; then
- echo_ok
- else
- echo_failure
- fi
+ if [ ${error_value} = 0 ]; then
+ echo_ok
+ else
+ echo_failure
+ fi
- # This prevents the 'An Unexpected Error Has Occurred' from trivial
- # errors.
- return 0
+ # This prevents the 'An Unexpected Error Has Occurred' from trivial
+ # errors.
+ return 0
}
print_status()
{
- if [ "${#}" = "0" ]; then
- echo "Usage: ${0} {success|warning|failure}"
- return 1
- fi
-
- case "${1}" in
-
- success)
- echo_ok
- ;;
-
- warning)
- # Leave this extra case in because old scripts
- # may call it this way.
- case "${2}" in
- running)
- ${ECHO} -e -n "${CURS_UP}"
- ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
- boot_mesg "Already running." ${WARNING}
- echo_warning
- ;;
- not_running)
- ${ECHO} -e -n "${CURS_UP}"
- ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
- boot_mesg "Not running." ${WARNING}
- echo_warning
- ;;
- not_available)
- ${ECHO} -e -n "${CURS_UP}"
- ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
- boot_mesg "Not available." ${WARNING}
- echo_warning
- ;;
- *)
- # This is how it is supposed to
- # be called
- echo_warning
- ;;
- esac
- ;;
-
- failure)
- echo_failure
- ;;
-
- esac
+ if [ "${#}" = "0" ]; then
+ echo "Usage: ${0} {success|warning|failure}"
+ return 1
+ fi
+
+ case "${1}" in
+
+ success)
+ echo_ok
+ ;;
+
+ warning)
+ # Leave this extra case in because old scripts
+ # may call it this way.
+ case "${2}" in
+ running)
+ ${ECHO} -e -n "${CURS_UP}"
+ ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
+ boot_mesg "Already running." ${WARNING}
+ echo_warning
+ ;;
+ not_running)
+ ${ECHO} -e -n "${CURS_UP}"
+ ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
+ boot_mesg "Not running." ${WARNING}
+ echo_warning
+ ;;
+ not_available)
+ ${ECHO} -e -n "${CURS_UP}"
+ ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
+ boot_mesg "Not available." ${WARNING}
+ echo_warning
+ ;;
+ *)
+ # This is how it is supposed to
+ # be called
+ echo_warning
+ ;;
+ esac
+ ;;
+
+ failure)
+ echo_failure
+ ;;
+
+ esac
}
reloadproc()
{
- local pidfile=""
- local failure=0
-
- while true
- do
- case "${1}" in
- -p)
- pidfile="${2}"
- shift 2
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" -lt "1" ]; then
- log_failure_msg "Usage: reloadproc [-p pidfile] pathname"
- return 2
- fi
-
- # This will ensure compatibility with previous LFS Bootscripts
- if [ -n "${PIDFILE}" ]; then
- pidfile="${PIDFILE}"
- fi
-
- # Is the process running?
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- # Warn about stale pid file
- if [ "$?" = 1 ]; then
- boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING}
- rm -f "${pidfile}"
- fi
-
- if [ -n "${pidlist}" ]; then
- for pid in ${pidlist}
- do
- kill -"${RELOADSIG}" "${pid}" || failure="1"
- done
-
- (exit ${failure})
- evaluate_retval
-
- else
- boot_mesg "Process ${1} not running." ${WARNING}
- echo_warning
- fi
+ local pidfile=""
+ local failure=0
+
+ while true
+ do
+ case "${1}" in
+ -p)
+ pidfile="${2}"
+ shift 2
+ ;;
+ -*)
+ log_failure_msg "Unknown Option: ${1}"
+ return 2
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
+ if [ "${#}" -lt "1" ]; then
+ log_failure_msg "Usage: reloadproc [-p pidfile] pathname"
+ return 2
+ fi
+
+ # This will ensure compatibility with previous LFS Bootscripts
+ if [ -n "${PIDFILE}" ]; then
+ pidfile="${PIDFILE}"
+ fi
+
+ # Is the process running?
+ if [ -z "${pidfile}" ]; then
+ pidofproc -s "${1}"
+ else
+ pidofproc -s -p "${pidfile}" "${1}"
+ fi
+
+ # Warn about stale pid file
+ if [ "$?" = 1 ]; then
+ boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING}
+ rm -f "${pidfile}"
+ fi
+
+ if [ -n "${pidlist}" ]; then
+ for pid in ${pidlist}
+ do
+ kill -"${RELOADSIG}" "${pid}" || failure="1"
+ done
+
+ (exit ${failure})
+ evaluate_retval
+
+ else
+ boot_mesg "Process ${1} not running." ${WARNING}
+ echo_warning
+ fi
}
statusproc()
{
- local pidfile=""
- local base=""
- local ret=""
-
- while true
- do
- case "${1}" in
- -p)
- pidfile="${2}"
- shift 2
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" != "1" ]; then
- shift 1
- log_failure_msg "Usage: statusproc [-p pidfile] pathname"
- return 2
- fi
-
- # Get the process basename
- base="${1##*/}"
-
- # This will ensure compatibility with previous LFS Bootscripts
- if [ -n "${PIDFILE}" ]; then
- pidfile="${PIDFILE}"
- fi
-
- # Is the process running?
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- # Store the return status
- ret=$?
-
- if [ -n "${pidlist}" ]; then
- ${ECHO} -e "${INFO}${base} is running with Process"\
- "ID(s) ${pidlist}.${NORMAL}"
- else
- if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
- ${ECHO} -e "${WARNING}${1} is not running but"\
- "/var/run/${base}.pid exists.${NORMAL}"
- else
- if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
- ${ECHO} -e "${WARNING}${1} is not running"\
- "but ${pidfile} exists.${NORMAL}"
- else
- ${ECHO} -e "${INFO}${1} is not running.${NORMAL}"
- fi
- fi
- fi
-
- # Return the status from pidofproc
- return $ret
+ local pidfile=""
+ local base=""
+ local ret=""
+
+ while true
+ do
+ case "${1}" in
+ -p)
+ pidfile="${2}"
+ shift 2
+ ;;
+ -*)
+ log_failure_msg "Unknown Option: ${1}"
+ return 2
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
+ if [ "${#}" != "1" ]; then
+ shift 1
+ log_failure_msg "Usage: statusproc [-p pidfile] pathname"
+ return 2
+ fi
+
+ # Get the process basename
+ base="${1##*/}"
+
+ # This will ensure compatibility with previous LFS Bootscripts
+ if [ -n "${PIDFILE}" ]; then
+ pidfile="${PIDFILE}"
+ fi
+
+ # Is the process running?
+ if [ -z "${pidfile}" ]; then
+ pidofproc -s "${1}"
+ else
+ pidofproc -s -p "${pidfile}" "${1}"
+ fi
+
+ # Store the return status
+ ret=$?
+
+ if [ -n "${pidlist}" ]; then
+ ${ECHO} -e "${INFO}${base} is running with Process"\
+ "ID(s) ${pidlist}.${NORMAL}"
+ else
+ if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
+ ${ECHO} -e "${WARNING}${1} is not running but"\
+ "/var/run/${base}.pid exists.${NORMAL}"
+ else
+ if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
+ ${ECHO} -e "${WARNING}${1} is not running"\
+ "but ${pidfile} exists.${NORMAL}"
+ else
+ ${ECHO} -e "${INFO}${1} is not running.${NORMAL}"
+ fi
+ fi
+ fi
+
+ # Return the status from pidofproc
+ return $ret
}
# The below functions are documented in the LSB-generic 2.1.0
@@ -405,82 +393,82 @@ statusproc()
#*******************************************************************************
pidofproc()
{
- local pidfile=""
- local lpids=""
- local silent=""
- pidlist=""
- while true
- do
- case "${1}" in
- -p)
- pidfile="${2}"
- shift 2
- ;;
-
- -s)
- # Added for legacy opperation of getpids
- # eliminates several '> /dev/null'
- silent="1"
- shift 1
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" != "1" ]; then
- shift 1
- log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname"
- return 2
- 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
-
- if [ "${silent}" != "1" ]; then
- echo "${pidlist}"
- fi
-
- test -z "${pidlist}" &&
- # Program is dead, pidfile exists
- return 1
- # else
- return 0
- done
-
- else
- pidlist=`pidof -o $$ -o $PPID -x "$1"`
- if [ "${silent}" != "1" ]; then
- echo "${pidlist}"
- fi
-
- # Get provide correct running status
- if [ -n "${pidlist}" ]; then
- return 0
- else
- return 3
- fi
-
- fi
-
- if [ "$?" != "0" ]; then
- return 3 # Program is not running
- fi
+ local pidfile=""
+ local lpids=""
+ local silent=""
+ pidlist=""
+ while true
+ do
+ case "${1}" in
+ -p)
+ pidfile="${2}"
+ shift 2
+ ;;
+
+ -s)
+ # Added for legacy opperation of getpids
+ # eliminates several '> /dev/null'
+ silent="1"
+ shift 1
+ ;;
+ -*)
+ log_failure_msg "Unknown Option: ${1}"
+ return 2
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
+ if [ "${#}" != "1" ]; then
+ shift 1
+ log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname"
+ return 2
+ 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
+
+ if [ "${silent}" != "1" ]; then
+ echo "${pidlist}"
+ fi
+
+ test -z "${pidlist}" &&
+ # Program is dead, pidfile exists
+ return 1
+ # else
+ return 0
+ done
+
+ else
+ pidlist=`pidof -o $$ -o $PPID -x "$1"`
+ if [ "${silent}" != "1" ]; then
+ echo "${pidlist}"
+ fi
+
+ # Get provide correct running status
+ if [ -n "${pidlist}" ]; then
+ return 0
+ else
+ return 3
+ fi
+
+ fi
+
+ if [ "$?" != "0" ]; then
+ return 3 # Program is not running
+ fi
}
#*******************************************************************************
@@ -510,74 +498,74 @@ pidofproc()
#*******************************************************************************
loadproc()
{
- local pidfile=""
- local forcestart=""
- local nicelevel="10"
+ local pidfile=""
+ local forcestart=""
+ local nicelevel="10"
# This will ensure compatibility with previous LFS Bootscripts
- if [ -n "${PIDFILE}" ]; then
- pidfile="${PIDFILE}"
- fi
+ if [ -n "${PIDFILE}" ]; then
+ pidfile="${PIDFILE}"
+ fi
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 #invalid or excess argument(s)
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" = "0" ]; then
- log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
- return 2 #invalid or excess argument(s)
- fi
-
- if [ -z "${forcestart}" ]; then
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- case "${?}" in
- 0)
- log_warning_msg "Unable to continue: ${1} is running"
- return 0 # 4
- ;;
- 1)
- boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING}
- rm -f "${pidfile}"
- ;;
- 3)
- ;;
- *)
- log_failure_msg "Unknown error code from pidofproc: ${?}"
- return 4
- ;;
- esac
- fi
-
- nice -n "${nicelevel}" "${@}"
- evaluate_retval # This is "Probably" not LSB compliant,
+ 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 #invalid or excess argument(s)
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
+ if [ "${#}" = "0" ]; then
+ log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
+ return 2 #invalid or excess argument(s)
+ fi
+
+ if [ -z "${forcestart}" ]; then
+ if [ -z "${pidfile}" ]; then
+ pidofproc -s "${1}"
+ else
+ pidofproc -s -p "${pidfile}" "${1}"
+ fi
+
+ case "${?}" in
+ 0)
+ log_warning_msg "Unable to continue: ${1} is running"
+ return 0 # 4
+ ;;
+ 1)
+ boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING}
+ rm -f "${pidfile}"
+ ;;
+ 3)
+ ;;
+ *)
+ log_failure_msg "Unknown error code from pidofproc: ${?}"
+ return 4
+ ;;
+ esac
+ fi
+
+ nice -n "${nicelevel}" "${@}"
+ evaluate_retval # This is "Probably" not LSB compliant,
# but required to be compatible with older bootscripts
- return 0
+ return 0
}
#*******************************************************************************
@@ -603,106 +591,106 @@ loadproc()
#*******************************************************************************
killproc()
{
- local pidfile=""
- local killsig=TERM # default signal is SIGTERM
- pidlist=""
-
- # This will ensure compatibility with previous LFS Bootscripts
- if [ -n "${PIDFILE}" ]; then
- pidfile="${PIDFILE}"
- fi
-
- while true
- do
- case "${1}" in
- -p)
- pidfile="${2}"
- shift 2
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" = "2" ]; then
- killsig="${2}"
- elif [ "${#}" != "1" ]; then
- shift 2
- log_failure_msg "Usage: killproc [-p pidfile] pathname [signal]"
- return 2
- fi
-
- # Is the process running?
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- # Remove stale pidfile
- if [ "$?" = 1 ]; then
- boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING}
- rm -f "${pidfile}"
- fi
+ local pidfile=""
+ local killsig=TERM # default signal is SIGTERM
+ pidlist=""
+
+ # This will ensure compatibility with previous LFS Bootscripts
+ if [ -n "${PIDFILE}" ]; then
+ pidfile="${PIDFILE}"
+ fi
+
+ while true
+ do
+ case "${1}" in
+ -p)
+ pidfile="${2}"
+ shift 2
+ ;;
+ -*)
+ log_failure_msg "Unknown Option: ${1}"
+ return 2
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
+ if [ "${#}" = "2" ]; then
+ killsig="${2}"
+ elif [ "${#}" != "1" ]; then
+ shift 2
+ log_failure_msg "Usage: killproc [-p pidfile] pathname [signal]"
+ return 2
+ fi
+
+ # Is the process running?
+ if [ -z "${pidfile}" ]; then
+ pidofproc -s "${1}"
+ else
+ pidofproc -s -p "${pidfile}" "${1}"
+ fi
+
+ # Remove stale pidfile
+ if [ "$?" = 1 ]; then
+ boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING}
+ rm -f "${pidfile}"
+ fi
# If running, send the signal
if [ -n "${pidlist}" ]; then
- for pid in ${pidlist}
- do
- kill -${killsig} ${pid} 2>/dev/null
-
- # Wait up to 3 seconds, for ${pid} to terminate
- case "${killsig}" in
- TERM|SIGTERM|KILL|SIGKILL)
- # sleep in 1/10ths of seconds and
- # multiply KILLDELAY by 10
- local dtime="${KILLDELAY}0"
- while [ "${dtime}" != "0" ]
- do
- kill -0 ${pid} 2>/dev/null || break
- sleep 0.1
- dtime=$(( ${dtime} - 1))
- done
- # If ${pid} is still running, kill it
- kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null
- ;;
- esac
- done
-
- # Check if the process is still running if we tried to stop it
- case "${killsig}" in
- TERM|SIGTERM|KILL|SIGKILL)
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- # Program was terminated
- if [ "$?" != "0" ]; then
- # Remove the pidfile if necessary
- if [ -f "${pidfile}" ]; then
- rm -f "${pidfile}"
- fi
- echo_ok
- return 0
- else # Program is still running
- echo_failure
- return 4 # Unknown Status
- fi
- ;;
- *)
- # Just see if the kill returned successfully
- evaluate_retval
- ;;
- esac
+ for pid in ${pidlist}
+ do
+ kill -${killsig} ${pid} 2>/dev/null
+
+ # Wait up to 3 seconds, for ${pid} to terminate
+ case "${killsig}" in
+ TERM|SIGTERM|KILL|SIGKILL)
+ # sleep in 1/10ths of seconds and
+ # multiply KILLDELAY by 10
+ local dtime="${KILLDELAY}0"
+ while [ "${dtime}" != "0" ]
+ do
+ kill -0 ${pid} 2>/dev/null || break
+ sleep 0.1
+ dtime=$(( ${dtime} - 1))
+ done
+ # If ${pid} is still running, kill it
+ kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null
+ ;;
+ esac
+ done
+
+ # Check if the process is still running if we tried to stop it
+ case "${killsig}" in
+ TERM|SIGTERM|KILL|SIGKILL)
+ if [ -z "${pidfile}" ]; then
+ pidofproc -s "${1}"
+ else
+ pidofproc -s -p "${pidfile}" "${1}"
+ fi
+
+ # Program was terminated
+ if [ "$?" != "0" ]; then
+ # Remove the pidfile if necessary
+ if [ -f "${pidfile}" ]; then
+ rm -f "${pidfile}"
+ fi
+ echo_ok
+ return 0
+ else # Program is still running
+ echo_failure
+ return 4 # Unknown Status
+ fi
+ ;;
+ *)
+ # Just see if the kill returned successfully
+ evaluate_retval
+ ;;
+ esac
else # process not running
- print_status warning not_running
+ print_status warning not_running
fi
}
@@ -723,9 +711,12 @@ killproc()
#*******************************************************************************
log_success_msg()
{
- ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
- ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}"
- return 0
+ ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
+ ${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
}
#*******************************************************************************
@@ -743,9 +734,12 @@ log_success_msg()
#
#*******************************************************************************
log_failure_msg() {
- ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
- ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
- return 0
+ ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
+ ${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
}
#*******************************************************************************
@@ -763,9 +757,35 @@ log_failure_msg() {
#
#*******************************************************************************
log_warning_msg() {
- ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
- ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
- return 0
+ ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
+ ${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
+}
+
+#*******************************************************************************
+# 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 $rc_base/init.d/functions
+# End boot functions
diff --git a/bootscripts/lfs/init.d/halt b/bootscripts/lfs/init.d/halt
index f3b016c38..3b8b78fa2 100644
--- a/bootscripts/lfs/init.d/halt
+++ b/bootscripts/lfs/init.d/halt
@@ -1,28 +1,38 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/halt
+# Begin halt
#
# Description : Halt Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- stop)
- halt -d -f -i -p
- ;;
- *)
- echo "Usage: {stop}"
- exit 1
- ;;
+ stop)
+ halt -d -f -i -p
+ ;;
+
+ *)
+ echo "Usage: {stop}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/halt
+# End halt
diff --git a/bootscripts/lfs/init.d/localnet b/bootscripts/lfs/init.d/localnet
index 4e5010229..f7e8fc6dd 100644
--- a/bootscripts/lfs/init.d/localnet
+++ b/bootscripts/lfs/init.d/localnet
@@ -1,54 +1,66 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/localnet
+# Begin localnet
#
# Description : Loopback device
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
case "${1}" in
- start)
- boot_mesg "Bringing up the loopback interface..."
- ip addr add 127.0.0.1/8 label lo dev lo
- ip link set lo up
- evaluate_retval
-
- boot_mesg "Setting hostname to ${HOSTNAME}..."
- hostname ${HOSTNAME}
- evaluate_retval
- ;;
-
- stop)
- boot_mesg "Bringing down the loopback interface..."
- ip link set lo down
- evaluate_retval
- ;;
-
- restart)
- ${0} stop
- sleep 1
- ${0} start
- ;;
-
- status)
- echo "Hostname is: $(hostname)"
- ip link show lo
- ;;
-
- *)
- echo "Usage: ${0} {start|stop|restart|status}"
- exit 1
- ;;
+ start)
+ boot_mesg "Bringing up the loopback interface..."
+ ip addr add 127.0.0.1/8 label lo dev lo
+ ip link set lo up
+ evaluate_retval
+
+ boot_mesg "Setting hostname to ${HOSTNAME}..."
+ hostname ${HOSTNAME}
+ evaluate_retval
+ ;;
+
+ stop)
+ boot_mesg "Bringing down the loopback interface..."
+ ip link set lo down
+ evaluate_retval
+ ;;
+
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
+
+ status)
+ echo "Hostname is: $(hostname)"
+ ip link show lo
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop|restart|status}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/localnet
+# End localnet
diff --git a/bootscripts/lfs/init.d/modules b/bootscripts/lfs/init.d/modules
index e8fbdfa9e..71698ac37 100644
--- a/bootscripts/lfs/init.d/modules
+++ b/bootscripts/lfs/init.d/modules
@@ -1,72 +1,83 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/modules
+# Begin modules
#
# Description : Module auto-loading script
#
# Authors : Zack Winkles
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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.
[ -e /proc/ksyms -o -e /proc/modules ] || exit 0
case "${1}" in
- start)
+ start)
+ # Exit if there's no modules file or there are no
+ # valid entries
+ [ -r /etc/sysconfig/modules ] &&
+ egrep -qv '^($|#)' /etc/sysconfig/modules ||
+ exit 0
- # Exit if there's no modules file or there are no
- # valid entries
- [ -r /etc/sysconfig/modules ] &&
- egrep -qv '^($|#)' /etc/sysconfig/modules ||
- exit 0
+ boot_mesg -n "Loading modules:" ${INFO}
- boot_mesg -n "Loading modules:" ${INFO}
+ # Only try to load modules if the user has actually given us
+ # some modules to load.
+ while read module args; do
- # Only try to load modules if the user has actually given us
- # some modules to load.
- while read module args; do
+ # Ignore comments and blank lines.
+ case "$module" in
+ ""|"#"*) continue ;;
+ esac
- # Ignore comments and blank lines.
- case "$module" in
- ""|"#"*) continue ;;
- esac
+ # Attempt to load the module, making
+ # sure to pass any arguments provided.
+ modprobe ${module} ${args} >/dev/null
- # Attempt to load the module, making
- # sure to pass any arguments provided.
- modprobe ${module} ${args} >/dev/null
+ # Print the module name if successful,
+ # otherwise take note.
+ if [ $? -eq 0 ]; then
+ boot_mesg -n " ${module}" ${NORMAL}
+ else
+ failedmod="${failedmod} ${module}"
+ fi
+ done < /etc/sysconfig/modules
- # Print the module name if successful,
- # otherwise take note.
- if [ $? -eq 0 ]; then
- boot_mesg -n " ${module}" ${NORMAL}
- else
- failedmod="${failedmod} ${module}"
- fi
- done < /etc/sysconfig/modules
+ boot_mesg "" ${NORMAL}
+ # Print a message about successfully loaded
+ # modules on the correct line.
+ echo_ok
- boot_mesg "" ${NORMAL}
- # Print a message about successfully loaded
- # modules on the correct line.
- echo_ok
+ # Print a failure message with a list of any
+ # modules that may have failed to load.
+ if [ -n "${failedmod}" ]; then
+ boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
+ echo_failure
+ fi
+ ;;
- # Print a failure message with a list of any
- # modules that may have failed to load.
- if [ -n "${failedmod}" ]; then
- boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
- echo_failure
- fi
- ;;
- *)
- echo "Usage: ${0} {start}"
- exit 1
- ;;
+ *)
+ echo "Usage: ${0} {start}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/modules
+# End modules
diff --git a/bootscripts/lfs/init.d/mountfs b/bootscripts/lfs/init.d/mountfs
index f7053ac10..b0e6d2737 100644
--- a/bootscripts/lfs/init.d/mountfs
+++ b/bootscripts/lfs/init.d/mountfs
@@ -1,56 +1,70 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/mountfs
+# Begin mountfs
#
# Description : File System Mount Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- start)
- boot_mesg "Remounting root file system in read-write mode..."
- mount -n -o remount,rw / >/dev/null
- evaluate_retval
-
- # Remove fsck-related file system watermarks.
- rm -f /fastboot /forcefsck
-
- boot_mesg "Recording existing mounts in /etc/mtab..."
- > /etc/mtab
-
- mount -f / || failed=1
- mount -f /proc || failed=1
- mount -f /sys || failed=1
- mount -f /run || failed=1
- (exit ${failed})
- evaluate_retval
-
- # This will mount all filesystems that do not have _netdev in
- # their option list. _netdev denotes a network filesystem.
- boot_mesg "Mounting remaining file systems..."
- mount -a -O no_netdev >/dev/null
- evaluate_retval
- ;;
-
- stop)
- boot_mesg "Unmounting all other currently mounted file systems..."
- umount -a -d -r >/dev/null
- evaluate_retval
- ;;
-
- *)
- echo "Usage: ${0} {start|stop}"
- exit 1
- ;;
+ start)
+ boot_mesg "Remounting root file system in read-write mode..."
+ mount -n -o remount,rw / >/dev/null
+ evaluate_retval
+
+ # Remove fsck-related file system watermarks.
+ rm -f /fastboot /forcefsck
+
+ boot_mesg "Recording existing mounts in /etc/mtab..."
+ > /etc/mtab
+
+ mount -f / || failed=1
+ mount -f /proc || failed=1
+ mount -f /sys || failed=1
+ mount -f /run || failed=1
+ (exit ${failed})
+ evaluate_retval
+
+ # This will mount all filesystems that do not have _netdev in
+ # their option list. _netdev denotes a network filesystem.
+ boot_mesg "Mounting remaining file systems..."
+ mount -a -O no_netdev >/dev/null
+ evaluate_retval
+ ;;
+
+ stop)
+ boot_mesg "Unmounting all other currently mounted file systems..."
+ umount -a -d -r >/dev/null
+ evaluate_retval
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/mountfs
+# End mountfs
diff --git a/bootscripts/lfs/init.d/mountvirtfs b/bootscripts/lfs/init.d/mountvirtfs
index efc7c2128..2c23248b7 100644
--- a/bootscripts/lfs/init.d/mountvirtfs
+++ b/bootscripts/lfs/init.d/mountvirtfs
@@ -1,50 +1,63 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/mountvirtfs
+# Begin mountvirtfs
#
# Description : Mount proc, sysfs, and run
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- start)
- boot_mesg -n "Mounting virtual file systems:" ${INFO}
-
- if ! mountpoint /proc >/dev/null; then
- boot_mesg -n " /proc" ${NORMAL}
- mount -n /proc || failed=1
- fi
-
- if ! mountpoint /sys >/dev/null; then
- boot_mesg -n " /sys" ${NORMAL}
- mount -n /sys || failed=1
- 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}
-
- (exit ${failed})
- evaluate_retval
- ;;
-
- *)
- echo "Usage: ${0} {start}"
- exit 1
- ;;
+ 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 " /run" ${NORMAL}
+
+ if ! mountpoint /proc >/dev/null; then
+ boot_mesg -n " /proc" ${NORMAL}
+ mount -n /proc || failed=1
+ fi
+
+ if ! mountpoint /sys >/dev/null; then
+ boot_mesg -n " /sys" ${NORMAL}
+ mount -n /sys || failed=1
+ fi
+
+ boot_mesg "" ${NORMAL}
+
+ (exit ${failed})
+ evaluate_retval
+ ;;
+
+ *)
+ echo "Usage: ${0} {start}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/mountvertfs
+# End mountvertfs
diff --git a/bootscripts/lfs/init.d/network b/bootscripts/lfs/init.d/network
index b99ecfdb9..622a2a40d 100644
--- a/bootscripts/lfs/init.d/network
+++ b/bootscripts/lfs/init.d/network
@@ -1,73 +1,81 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/network
+# Begin network
#
# Description : Network Control Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
-# Nathan Coulson - nathan@linuxfromscratch.org
-# Kevin P. Fleming - kpfleming@linuxfromscratch.org
+# Nathan Coulson - nathan@linuxfromscratch.org
+# Kevin P. Fleming - kpfleming@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
-. /etc/sysconfig/network
+### BEGIN INIT INFO
+# Provides: $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
- start)
- # Start all network interfaces
- for file in ${network_devices}/ifconfig.*
- do
- interface=${file##*/ifconfig.}
+ start)
+ # Start all network interfaces
+ for file in /etc/sysconfig/ifconfig.*
+ do
+ interface=${file##*/ifconfig.}
- # skip if $file is * (because nothing was found)
- if [ "${interface}" = "*" ]
- then
- continue
- fi
+ # skip if $file is * (because nothing was found)
+ if [ "${interface}" = "*" ]
+ then
+ continue
+ fi
- IN_BOOT=1 ${network_devices}/ifup ${interface}
- done
- ;;
+ /sbin/ifup ${interface}
+ done
+ ;;
- stop)
- # Reverse list
- FILES=""
- for file in ${network_devices}/ifconfig.*
- do
- FILES="${file} ${FILES}"
- done
+ stop)
+ # Reverse list
+ FILES=""
+ for file in /etc/sysconfig/ifconfig.*
+ do
+ FILES="${file} ${FILES}"
+ done
- # Stop all network interfaces
- for file in ${FILES}
- do
- interface=${file##*/ifconfig.}
+ # Stop all network interfaces
+ for file in ${FILES}
+ do
+ interface=${file##*/ifconfig.}
- # skip if $file is * (because nothing was found)
- if [ "${interface}" = "*" ]
- then
- continue
- fi
+ # skip if $file is * (because nothing was found)
+ if [ "${interface}" = "*" ]
+ then
+ continue
+ fi
- IN_BOOT=1 ${network_devices}/ifdown ${interface}
- done
- ;;
+ /sbin/ifdown ${interface}
+ done
+ ;;
- restart)
- ${0} stop
- sleep 1
- ${0} start
- ;;
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
- *)
- echo "Usage: ${0} {start|stop|restart}"
- exit 1
- ;;
+ *)
+ echo "Usage: ${0} {start|stop|restart}"
+ exit 1
+ ;;
esac
-# End /etc/rc.d/init.d/network
+# End network
diff --git a/bootscripts/lfs/init.d/rc b/bootscripts/lfs/init.d/rc
index 38d4ae2df..4cd3ef0c1 100644
--- a/bootscripts/lfs/init.d/rc
+++ b/bootscripts/lfs/init.d/rc
@@ -1,19 +1,52 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/rc
+# Begin rc
#
# Description : Main Run Level Control Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+. /lib/boot/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.
stty sane
@@ -24,76 +57,77 @@ trap "" INT QUIT TSTP
[ "${1}" != "" ] && runlevel=${1}
if [ "${runlevel}" = "" ]; then
- echo "Usage: ${0} <runlevel>" >&2
- exit 1
+ echo "Usage: ${0} <runlevel>" >&2
+ exit 1
fi
previous=${PREVLEVEL}
[ "${previous}" = "" ] && previous=N
-if [ ! -d ${rc_base}/rc${runlevel}.d ]; then
- boot_mesg "${rc_base}/rc${runlevel}.d does not exist." ${WARNING}
- boot_mesg_flush
- exit 1
+if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then
+ boot_mesg "/etc/rc.d/rc${runlevel}.d does not exist."
+ exit 1
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
if [ "${previous}" != "N" ]; then
- for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null)
- do
- check_script_status
-
- suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]}
- prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
- sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix
-
- if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then
- if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
- boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING}
- boot_mesg -n " executed because it was not"
- boot_mesg -n " not started in the previous"
- boot_mesg -n " runlevel (${previous})."
- boot_mesg "" ${NORMAL}
- boot_mesg_flush
- continue
- fi
- fi
- ${i} stop
- error_value=${?}
-
- if [ "${error_value}" != "0" ]; then
- print_error_msg
- fi
- done
+ for i in $(ls -v /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null)
+ do
+ check_script_status
+
+ suffix=${i#/etc/rc.d/rc$runlevel.d/K[0-9][0-9]}
+ prev_start=/etc/rc.d/rc$previous.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 [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
+ boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING}
+ boot_mesg -n " executed because it was not"
+ boot_mesg -n " not started in the previous"
+ boot_mesg -n " runlevel (${previous})."
+ boot_mesg "" ${NORMAL}
+ boot_mesg_flush
+ continue
+ fi
+ fi
+ ${i} stop
+ error_value=${?}
+
+ if [ "${error_value}" != "0" ]; then
+ print_error_msg
+ fi
+ done
fi
+[ "${previous}" = "N" ] && IN_BOOT=1
+
#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
- if [ "${previous}" != "N" ]; then
- suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]}
- stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix
- prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
-
- [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue
- fi
-
- check_script_status
-
- case ${runlevel} in
- 0|6)
- ${i} stop
- ;;
- *)
- ${i} start
- ;;
- esac
- error_value=${?}
-
- if [ "${error_value}" != "0" ]; then
- print_error_msg
- fi
+ if [ "${previous}" != "N" ]; then
+ suffix=${i#/etc/rc.d/rc$runlevel.d/S[0-9][0-9]}
+ stop=/etc/rc.d/rc$runlevel.d/K[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
+ fi
+
+ check_script_status
+
+ case ${runlevel} in
+ 0|6)
+ ${i} stop
+ ;;
+ *)
+ ${i} start
+ ;;
+ esac
+ error_value=${?}
+
+ if [ "${error_value}" != "0" ]; then
+ print_error_msg
+ fi
done
-# End $rc_base/init.d/rc
+# End rc
diff --git a/bootscripts/lfs/init.d/reboot b/bootscripts/lfs/init.d/reboot
index fec0c1f6f..a7cfd82cf 100644
--- a/bootscripts/lfs/init.d/reboot
+++ b/bootscripts/lfs/init.d/reboot
@@ -1,31 +1,42 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/reboot
+# Begin reboot
#
# Description : Reboot Scripts
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- stop)
- boot_mesg "Restarting system..."
- reboot -d -f -i
- ;;
+ stop)
+ boot_mesg "Restarting system..."
+ reboot -d -f -i
+ ;;
- *)
- echo "Usage: ${0} {stop}"
- exit 1
- ;;
+ *)
+ echo "Usage: ${0} {stop}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/reboot
+# End reboot
diff --git a/bootscripts/lfs/init.d/sendsignals b/bootscripts/lfs/init.d/sendsignals
index f34b8f4d4..016650c6b 100644
--- a/bootscripts/lfs/init.d/sendsignals
+++ b/bootscripts/lfs/init.d/sendsignals
@@ -1,52 +1,63 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/sendsignals
+# Begin sendsignals
#
# Description : Sendsignals Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- stop)
- boot_mesg "Sending all processes the TERM signal..."
- killall5 -15
- error_value=${?}
+ stop)
+ boot_mesg "Sending all processes the TERM signal..."
+ killall5 -15
+ error_value=${?}
- sleep ${KILLDELAY}
+ sleep ${KILLDELAY}
- if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
- echo_ok
- else
- echo_failure
- fi
+ if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
+ echo_ok
+ else
+ echo_failure
+ fi
- boot_mesg "Sending all processes the KILL signal..."
- killall5 -9
- error_value=${?}
+ boot_mesg "Sending all processes the KILL signal..."
+ killall5 -9
+ error_value=${?}
- sleep ${KILLDELAY}
+ sleep ${KILLDELAY}
- if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
- echo_ok
- else
- echo_failure
- fi
- ;;
+ if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
+ echo_ok
+ else
+ echo_failure
+ fi
+ ;;
- *)
- echo "Usage: ${0} {stop}"
- exit 1
- ;;
+ *)
+ echo "Usage: ${0} {stop}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/sendsignals
+# End sendsignals
diff --git a/bootscripts/lfs/init.d/setclock b/bootscripts/lfs/init.d/setclock
index c786acec5..19cbb1447 100644
--- a/bootscripts/lfs/init.d/setclock
+++ b/bootscripts/lfs/init.d/setclock
@@ -1,47 +1,61 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/setclock
+# Begin setclock
#
# Description : Setting Linux Clock
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
-. /etc/sysconfig/clock
+### BEGIN INIT INFO
+# Provides: $time
+# 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
- yes|true|1)
- CLOCKPARAMS="${CLOCKPARAMS} --utc"
- ;;
+ yes|true|1)
+ CLOCKPARAMS="${CLOCKPARAMS} --utc"
+ ;;
- no|false|0)
- CLOCKPARAMS="${CLOCKPARAMS} --localtime"
- ;;
+ no|false|0)
+ CLOCKPARAMS="${CLOCKPARAMS} --localtime"
+ ;;
esac
case ${1} in
- start)
- boot_mesg "Setting system clock..."
- hwclock --hctosys ${CLOCKPARAMS} >/dev/null
- evaluate_retval
- ;;
-
- stop)
- boot_mesg "Setting hardware clock..."
- hwclock --systohc ${CLOCKPARAMS} >/dev/null
- evaluate_retval
- ;;
-
- *)
- echo "Usage: ${0} {start|stop}"
- ;;
+ start)
+ boot_mesg "Setting system clock..."
+ hwclock --hctosys ${CLOCKPARAMS} >/dev/null
+ evaluate_retval
+ ;;
+
+ stop)
+ boot_mesg "Setting hardware clock..."
+ hwclock --systohc ${CLOCKPARAMS} >/dev/null
+ evaluate_retval
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop}"
+ ;;
esac
diff --git a/bootscripts/lfs/init.d/swap b/bootscripts/lfs/init.d/swap
index edc63f3b0..d042e723f 100644
--- a/bootscripts/lfs/init.d/swap
+++ b/bootscripts/lfs/init.d/swap
@@ -1,50 +1,62 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/swap
+# Begin swap
#
# Description : Swap Control Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- start)
- boot_mesg "Activating all swap files/partitions..."
- swapon -a
- evaluate_retval
- ;;
-
- stop)
- boot_mesg "Deactivating all swap files/partitions..."
- swapoff -a
- evaluate_retval
- ;;
-
- restart)
- ${0} stop
- sleep 1
- ${0} start
- ;;
-
- status)
- boot_mesg "Retrieving swap status." ${INFO}
- echo_ok
- echo
- swapon -s
- ;;
-
- *)
- echo "Usage: ${0} {start|stop|restart|status}"
- exit 1
- ;;
+ start)
+ boot_mesg "Activating all swap files/partitions..."
+ swapon -a
+ evaluate_retval
+ ;;
+
+ stop)
+ boot_mesg "Deactivating all swap files/partitions..."
+ swapoff -a
+ evaluate_retval
+ ;;
+
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
+
+ status)
+ boot_mesg "Retrieving swap status." ${INFO}
+ echo_ok
+ echo
+ swapon -s
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop|restart|status}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/swap
+# End swap
diff --git a/bootscripts/lfs/init.d/sysctl b/bootscripts/lfs/init.d/sysctl
index 0d0b5c1b3..b37d51e42 100644
--- a/bootscripts/lfs/init.d/sysctl
+++ b/bootscripts/lfs/init.d/sysctl
@@ -1,39 +1,51 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/sysctl
+# Begin sysctl
#
# Description : File uses /etc/sysctl.conf to set kernel runtime
# parameters
#
# Authors : Nathan Coulson (nathan@linuxfromscratch.org)
# Matthew Burgress (matthew@linuxfromscratch.org)
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- start)
- if [ -f "/etc/sysctl.conf" ]; then
- boot_mesg "Setting kernel runtime parameters..."
- sysctl -q -p
- evaluate_retval
- fi
- ;;
+ start)
+ if [ -f "/etc/sysctl.conf" ]; then
+ boot_mesg "Setting kernel runtime parameters..."
+ sysctl -q -p
+ evaluate_retval
+ fi
+ ;;
- status)
- sysctl -a
- ;;
+ status)
+ sysctl -a
+ ;;
- *)
- echo "Usage: ${0} {start|status}"
- exit 1
- ;;
+ *)
+ echo "Usage: ${0} {start|status}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/sysctl
+# End sysctl
diff --git a/bootscripts/lfs/init.d/sysklogd b/bootscripts/lfs/init.d/sysklogd
index e0a568ce6..fdb9380cb 100644
--- a/bootscripts/lfs/init.d/sysklogd
+++ b/bootscripts/lfs/init.d/sysklogd
@@ -1,57 +1,70 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/sysklogd
+# Begin sysklogd
#
# Description : Sysklogd loader
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- start)
- boot_mesg "Starting system log daemon..."
- loadproc syslogd -m 0
-
- boot_mesg "Starting kernel log daemon..."
- loadproc klogd
- ;;
-
- stop)
- boot_mesg "Stopping kernel log daemon..."
- killproc klogd
-
- boot_mesg "Stopping system log daemon..."
- killproc syslogd
- ;;
-
- reload)
- boot_mesg "Reloading system log daemon config file..."
- reloadproc syslogd
- ;;
-
- restart)
- ${0} stop
- sleep 1
- ${0} start
- ;;
-
- status)
- statusproc syslogd
- statusproc klogd
- ;;
-
- *)
- echo "Usage: ${0} {start|stop|reload|restart|status}"
- exit 1
- ;;
+ start)
+ boot_mesg "Starting system log daemon..."
+ PARMS=${SYSKLOGD_PARMS=-'-m 0'}
+ loadproc syslogd $PARMS
+
+ boot_mesg "Starting kernel log daemon..."
+ loadproc klogd
+ ;;
+
+ stop)
+ boot_mesg "Stopping kernel log daemon..."
+ killproc klogd
+
+ boot_mesg "Stopping system log daemon..."
+ killproc syslogd
+ ;;
+
+ reload)
+ boot_mesg "Reloading system log daemon config file..."
+ reloadproc syslogd
+ ;;
+
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
+
+ status)
+ statusproc syslogd
+ statusproc klogd
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop|reload|restart|status}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/sysklogd
+# End sysklogd
diff --git a/bootscripts/lfs/init.d/template b/bootscripts/lfs/init.d/template
index 69dc2a6a2..dbb3aa837 100644
--- a/bootscripts/lfs/init.d/template
+++ b/bootscripts/lfs/init.d/template
@@ -1,50 +1,62 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/
+# Begin scriptname
#
# Description :
#
# Authors :
#
-# Version : 00.00
+# Version : LFS x.x
#
# Notes :
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- start)
- boot_mesg "Starting..."
- loadproc
- ;;
-
- stop)
- boot_mesg "Stopping..."
- killproc
- ;;
-
- reload)
- boot_mesg "Reloading..."
- reloadproc
- ;;
-
- restart)
- ${0} stop
- sleep 1
- ${0} start
- ;;
-
- status)
- statusproc
- ;;
-
- *)
- echo "Usage: ${0} {start|stop|reload|restart|status}"
- exit 1
- ;;
+ start)
+ boot_mesg "Starting..."
+ loadproc
+ ;;
+
+ stop)
+ boot_mesg "Stopping..."
+ killproc
+ ;;
+
+ reload)
+ boot_mesg "Reloading..."
+ reloadproc
+ ;;
+
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
+
+ status)
+ statusproc
+ ;;
+
+ *)
+ echo "Usage: ${0} {start|stop|reload|restart|status}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/
+# End scriptname
diff --git a/bootscripts/lfs/init.d/udev b/bootscripts/lfs/init.d/udev
index 7e68fdf7b..63cde4273 100644
--- a/bootscripts/lfs/init.d/udev
+++ b/bootscripts/lfs/init.d/udev
@@ -1,83 +1,94 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/udev
+# Begin udev
#
# Description : Udev cold-plugging script
#
# Authors : Zack Winkles, Alexander E. Patrakov
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.02
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
-case "${1}" in
- start)
- boot_mesg "Populating /dev with device nodes..."
- if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
- boot_mesg -n " devices without a SysFS filesystem"
- boot_mesg -n "\n\nAfter you press Enter, this system"
- boot_mesg -n " will be halted and powered off."
- boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
- read ENTER
- /etc/rc.d/init.d/halt stop
- fi
+. /lib/boot/functions
- # Mount a temporary file system over /dev, so that any devices
- # made or removed during this boot don't affect the next one.
- # The reason we don't write to mtab is because we don't ever
- # want /dev to be unavailable (such as by `umount -a').
- if ! mountpoint /dev > /dev/null; then
- mount -n -t tmpfs tmpfs /dev -o mode=755
- fi
- if [ ${?} != 0 ]; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
- boot_mesg -n " onto /dev, this system will be halted."
- boot_mesg -n "\n\nAfter you press Enter, this system"
- boot_mesg -n " will be halted and powered off."
- boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
- read ENTER
- /etc/rc.d/init.d/halt stop
- fi
+case "${1}" in
+ start)
+ boot_mesg "Populating /dev with device nodes..."
+ if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
+ echo_failure
+ boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
+ boot_mesg -n " devices without a SysFS filesystem"
+ boot_mesg -n "\n\nAfter you press Enter, this system"
+ boot_mesg -n " will be halted and powered off."
+ boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+ boot_mesg "" ${NORMAL}
+ wait_for_user
+ /etc/rc.d/init.d/halt stop
+ fi
- ln -s /run/shm /dev/shm
+ # Mount a temporary file system over /dev, so that any devices
+ # made or removed during this boot don't affect the next one.
+ # The reason we don't write to mtab is because we don't ever
+ # want /dev to be unavailable (such as by `umount -a').
+ if ! mountpoint /dev > /dev/null; then
+ mount -n -t tmpfs tmpfs /dev -o mode=755
+ fi
+ if [ ${?} != 0 ]; then
+ echo_failure
+ boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
+ boot_mesg -n " onto /dev, this system will be halted."
+ boot_mesg -n "\n\nAfter you press Enter, this system"
+ boot_mesg -n " will be halted and powered off."
+ boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
+ boot_mesg "" ${NORMAL}
+ wait_for_user
+ /etc/rc.d/init.d/halt stop
+ fi
- # Udev handles uevents itself, so we don't need to have
- # the kernel call out to any binary in response to them
- echo > /proc/sys/kernel/hotplug
+ ln -s /run/shm /dev/shm
- # Copy the only static device node that Udev >= 155 doesn't
- # handle to /dev
- cp -a /lib/udev/devices/null /dev
+ # Udev handles uevents itself, so we don't need to have
+ # the kernel call out to any binary in response to them
+ echo > /proc/sys/kernel/hotplug
- # Start the udev daemon to continually watch for, and act on,
- # uevents
- /sbin/udevd --daemon
+ # Copy the only static device node that Udev >= 155 doesn't
+ # handle to /dev
+ cp -a /lib/udev/devices/null /dev
- # Now traverse /sys in order to "coldplug" devices that have
- # already been discovered
- /sbin/udevadm trigger --action=add --type=subsystems
- /sbin/udevadm trigger --action=add --type=devices
+ # Start the udev daemon to continually watch for, and act on,
+ # uevents
+ /sbin/udevd --daemon
- # Now wait for udevd to process the uevents we triggered
- /sbin/udevadm settle
- evaluate_retval
+ # Now traverse /sys in order to "coldplug" devices that have
+ # already been discovered
+ /sbin/udevadm trigger --action=add --type=subsystems
+ /sbin/udevadm trigger --action=add --type=devices
- ;;
+ # Now wait for udevd to process the uevents we triggered
+ /sbin/udevadm settle
+ evaluate_retval
+ ;;
- *)
- echo "Usage ${0} {start}"
- exit 1
- ;;
+ *)
+ echo "Usage ${0} {start}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/udev
+# End udev
diff --git a/bootscripts/lfs/init.d/udev_retry b/bootscripts/lfs/init.d/udev_retry
index e44b8afa0..faad2a4c9 100644
--- a/bootscripts/lfs/init.d/udev_retry
+++ b/bootscripts/lfs/init.d/udev_retry
@@ -1,45 +1,60 @@
#!/bin/sh
########################################################################
-# Begin $rc_base/init.d/udev_retry
+# Begin udev_retry
#
# Description : Udev cold-plugging script (retry)
#
# Authors : Alexander E. Patrakov
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.02
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+### BEGIN INIT INFO
+# 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
- start)
- boot_mesg "Retrying failed uevents, if any..."
-
- # From Debian: "copy the rules generated before / was mounted
- # read-write":
- for file in /dev/.udev/tmp-rules--*; do
- dest=${file##*tmp-rules--}
- [ "$dest" = '*' ] && break
- cat $file >> /etc/udev/rules.d/$dest
- rm -f $file
- done
-
- # Re-trigger the failed uevents in hope they will succeed now
- /sbin/udevadm trigger --type=failed --action=add
-
- # Now wait for udevd to process the uevents we triggered
- /sbin/udevadm settle
- evaluate_retval
- ;;
-
- *)
- echo "Usage ${0} {start}"
- exit 1
- ;;
+ start)
+ boot_mesg "Retrying failed uevents, if any..."
+
+ RUNDIR=$(/sbin/udevadm info --run)
+ # From Debian: "copy the rules generated before / was mounted
+ # read-write":
+
+ for file in ${RUNDIR}/tmp-rules--*; do
+ dest=${file##*tmp-rules--}
+ [ "$dest" = '*' ] && break
+ cat $file >> /etc/udev/rules.d/$dest
+ rm -f $file
+ done
+
+ # Re-trigger the failed uevents in hope they will succeed now
+ /sbin/udevadm trigger --type=failed --action=add
+
+ # Now wait for udevd to process the uevents we triggered
+ /sbin/udevadm settle
+ evaluate_retval
+ ;;
+
+ *)
+ echo "Usage ${0} {start}"
+ exit 1
+ ;;
esac
-# End $rc_base/init.d/udev_retry
+# End udev_retry
diff --git a/bootscripts/lfs/sysconfig/network-devices/ifdown b/bootscripts/lfs/sysconfig/network-devices/ifdown
index 1fb69aa44..8ca91268a 100644
--- a/bootscripts/lfs/sysconfig/network-devices/ifdown
+++ b/bootscripts/lfs/sysconfig/network-devices/ifdown
@@ -1,95 +1,66 @@
#!/bin/sh
########################################################################
-# Begin $network_devices/ifdown
+# Begin /sbin/ifdown
#
# Description : Interface Down
#
# Authors : Nathan Coulson - nathan@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
-# 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.
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+file=/etc/sysconfig/ifconfig.${1}
-# Collect a list of configuration files for our interface
-if [ -n "${2}" ]; then
- for file in ${@#$1}; do # All parameters except $1
- 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
+# Skip backup files
+[ "${file}" = "${file%""~""}" ] || exit 0
-# Reverse the order configuration files are processed in
-for file in ${FILES}; do
- FILES2="${file} ${FILES2}"
-done
-FILES=${FILES2}
+. /lib/boot/functions
-# Process each configuration file
-for file in ${FILES}; do
- # skip backup files
- if [ "${file}" != "${file%""~""}" ]; then
- continue
- fi
+if [ ! -r "${file}" ]; then
+ boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
+ echo_warning
+ exit 1
+fi
- if [ ! -f "${file}" ]; then
- boot_mesg "${file} is not a network configuration file or directory." ${WARNING}
- echo_warning
- continue
- fi
- (
- . ${file}
+. ${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
+if [ "$IFACE" = "" ]; then
+ boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE}
+ echo_failure
+ exit 1
+fi
+
+# This will run the service script, if SERVICE is set
+if [ -n "${SERVICE}" -a -x "/lib/boot/${SERVICE}" ]; then
+ if ip link show ${IFACE} > /dev/null 2>&1; then
+ IFCONFIG=${file} /lib/boot/${SERVICE} ${IFACE} down
+ else
+ boot_mesg "Interface ${1} doesn't exist." ${WARNING}
+ echo_warning
+ fi
+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
- # 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
- boot_mesg "Interface ${1} doesn't exist." ${WARNING}
- echo_warning
- fi
- else
- boot_mesg -n "Unable to process ${file}. Either" ${FAILURE}
- boot_mesg -n " the SERVICE variable was not set,"
- boot_mesg " or the specified service cannot be executed."
- echo_failure
- continue
- fi
- )
-done
+link_status=`ip link show ${IFACE} 2>/dev/null`
-if [ -z "${2}" ]; then
- link_status=`ip link show $1 2>/dev/null`
- if [ -n "${link_status}" ]; then
- if echo "${link_status}" | grep -q UP; then
- boot_mesg "Bringing down the ${1} interface..."
- ip link set ${1} down
- evaluate_retval
- fi
- fi
+if [ -n "${link_status}" ]; then
+ if echo "${link_status}" | grep -q UP; then
+ boot_mesg "Bringing down the ${IFACE} interface..."
+ ip link set ${IFACE} down
+ evaluate_retval
+ fi
fi
-# End $network_devices/ifdown
+# End /sbin/ifdown
diff --git a/bootscripts/lfs/sysconfig/network-devices/ifup b/bootscripts/lfs/sysconfig/network-devices/ifup
index 369443309..3049a5c3d 100644
--- a/bootscripts/lfs/sysconfig/network-devices/ifup
+++ b/bootscripts/lfs/sysconfig/network-devices/ifup
@@ -1,90 +1,82 @@
#!/bin/sh
########################################################################
-# Begin $network_devices/ifup
+# Begin /sbin/ifup
#
# Description : Interface Up
#
# Authors : Nathan Coulson - nathan@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
-# in the services directory, to indicate what file the
+# Notes : The IFCONFIG variable is passed to the SERVICE script
+# in the /lib/boot directory, to indicate what file the
# service should source to get environmental variables.
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+file=/etc/sysconfig/ifconfig.${1}
-# Collect a list of configuration files for our interface
-if [ -n "${2}" ]; then
- for file in ${@#$1} # All parameters except $1
- do
- 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
+# Skip backup files
+[ "${file}" = "${file%""~""}" ] || exit 0
+
+. /lib/boot/functions
boot_mesg "Bringing up the ${1} interface..."
boot_mesg_flush
-# Process each configruation file
-for file in ${FILES}; do
- # skip backup files
- if [ "${file}" != "${file%""~""}" ]; then
- continue
- fi
+if [ ! -r "${file}" ]; then
+ boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
+ echo_warning
+ exit 1
+fi
+
+. $file
- if [ ! -f "${file}" ]; then
- boot_mesg "${file} is not a network configuration file or directory." ${WARNING}
- echo_warning
- continue
- fi
+if [ "$IFACE" = "" ]; then
+ boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE}
+ echo_failure
+ exit 1
+fi
- (
- . ${file}
+# Do not process this service if started by boot, and ONBOOT
+# is not set to yes
+if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
+ echo_skipped
+ exit 0
+fi
- # 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" \
- -a "${HOSTNAME}" != "(none)" ]; then continue
- 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
- 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 ! echo "${link_status}" | grep -q UP; then
- ip link set ${1} up
- 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
+ # Bring up the interface
+ if ip link show ${IFACE} > /dev/null 2>&1; then
+ link_status=`ip link show ${IFACE}`
+
+ if [ -n "${link_status}" ]; then
+ if ! echo "${link_status}" | grep -q UP; then
+ ip link set ${IFACE} up
+ fi
+ fi
+
+ 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 $network_devices/ifup
+# End /sbin/ifup
diff --git a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static
index a550d3d2a..aeb5c1a9a 100644
--- a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static
+++ b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static
@@ -1,82 +1,83 @@
#!/bin/sh
########################################################################
-# Begin $network_devices/services/ipv4-static
+# Begin /lib/boot/ipv4-static
#
# Description : IPV4 Static Boot Script
#
# 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
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+. /lib/boot/functions
. ${IFCONFIG}
if [ -z "${IP}" ]; then
- boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
- exit 1
+ boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
+ echo_failure
+ exit 1
fi
if [ -z "${PREFIX}" -a -z "${PEER}" ]; then
- boot_mesg -n "PREFIX variable missing from ${IFCONFIG}," ${WARNING}
- boot_mesg " assuming 24."
- echo_warning
- PREFIX=24
- args="${args} ${IP}/${PREFIX}"
+ boot_mesg -n "PREFIX variable missing from ${IFCONFIG}," ${WARNING}
+ boot_mesg " assuming 24."
+ echo_warning
+ PREFIX=24
+ args="${args} ${IP}/${PREFIX}"
+
elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then
- boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
- exit 1
+ boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE}
+ echo_failure
+ exit 1
+
elif [ -n "${PREFIX}" ]; then
- args="${args} ${IP}/${PREFIX}"
+ args="${args} ${IP}/${PREFIX}"
+
elif [ -n "${PEER}" ]; then
- args="${args} ${IP} peer ${PEER}"
+ args="${args} ${IP} peer ${PEER}"
fi
if [ -n "${BROADCAST}" ]; then
- args="${args} broadcast ${BROADCAST}"
+ args="${args} broadcast ${BROADCAST}"
fi
case "${2}" in
- up)
- boot_mesg "Adding IPv4 address ${IP} to the ${1} interface..."
- ip addr add ${args} dev ${1}
- evaluate_retval
-
- if [ -n "${GATEWAY}" ]; then
- if ip route | grep -q default; then
- boot_mesg "Gateway already setup; skipping." ${WARNING}
- echo_warning
- else
- boot_mesg "Setting up default gateway..."
- ip route add default via ${GATEWAY} dev ${1}
- evaluate_retval
- fi
- fi
- ;;
-
- down)
- if [ -n "${GATEWAY}" ]; then
- boot_mesg "Removing default gateway..."
- ip route del default
- evaluate_retval
- fi
-
- boot_mesg "Removing IPv4 address ${IP} from the ${1} interface..."
- ip addr del ${args} dev ${1}
- evaluate_retval
- ;;
-
- *)
- echo "Usage: ${0} [interface] {up|down}"
- exit 1
- ;;
+ up)
+ boot_mesg "Adding IPv4 address ${IP} to the ${1} interface..."
+ ip addr add ${args} dev ${1}
+ evaluate_retval
+
+ if [ -n "${GATEWAY}" ]; then
+ if ip route | grep -q default; then
+ boot_mesg "Gateway already setup; skipping." ${WARNING}
+ echo_warning
+ else
+ boot_mesg "Setting up default gateway..."
+ ip route add default via ${GATEWAY} dev ${1}
+ evaluate_retval
+ fi
+ fi
+ ;;
+
+ down)
+ if [ -n "${GATEWAY}" ]; then
+ boot_mesg "Removing default gateway..."
+ ip route del default
+ evaluate_retval
+ fi
+
+ boot_mesg "Removing IPv4 address ${IP} from the ${1} interface..."
+ ip addr del ${args} dev ${1}
+ evaluate_retval
+ ;;
+
+ *)
+ echo "Usage: ${0} [interface] {up|down}"
+ exit 1
+ ;;
esac
-# End $network_devices/services/ipv4-static
+# End /lib/boot/ipv4-static
diff --git a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route
index 378b1deff..a85cfacf2 100644
--- a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route
+++ b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route
@@ -1,74 +1,72 @@
#!/bin/sh
########################################################################
-# Begin $network_devices/services/ipv4-static-route
+# Begin /lib/boot/ipv4-static-route
#
# Description : IPV4 Static Route Script
#
# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
-# Version : 00.00
-#
-# Notes :
+# Version : LFS 7.0
#
########################################################################
-. /etc/sysconfig/rc
-. ${rc_functions}
+. /lib/boot/functions
. ${IFCONFIG}
case "${TYPE}" in
- ("" | "network")
- need_ip=1
- need_gateway=1
- ;;
+ ("" | "network")
+ need_ip=1
+ need_gateway=1
+ ;;
- ("default")
- need_gateway=1
- args="${args} default"
- desc="default"
- ;;
+ ("default")
+ need_gateway=1
+ args="${args} default"
+ desc="default"
+ ;;
- ("host")
- need_ip=1
- ;;
+ ("host")
+ need_ip=1
+ ;;
- ("unreachable")
- need_ip=1
- args="${args} unreachable"
- desc="unreachable "
- ;;
+ ("unreachable")
+ need_ip=1
+ args="${args} unreachable"
+ desc="unreachable "
+ ;;
- (*)
- boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
- exit 1
- ;;
+ (*)
+ boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
+ echo_failure
+ exit 1
+ ;;
esac
if [ -n "${need_ip}" ]; then
- if [ -z "${IP}" ]; then
- boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
- exit 1
- fi
+ if [ -z "${IP}" ]; then
+ boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
+ echo_failure
+ exit 1
+ fi
- if [ -z "${PREFIX}" ]; then
- boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
- exit 1
- fi
-
- args="${args} ${IP}/${PREFIX}"
- desc="${desc}${IP}/${PREFIX}"
+ if [ -z "${PREFIX}" ]; then
+ boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
+ echo_failure
+ exit 1
+ fi
+
+ args="${args} ${IP}/${PREFIX}"
+ desc="${desc}${IP}/${PREFIX}"
fi
if [ -n "${need_gateway}" ]; then
- if [ -z "${GATEWAY}" ]; then
- boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
- exit 1
- fi
- args="${args} via ${GATEWAY}"
+ if [ -z "${GATEWAY}" ]; then
+ boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
+ echo_failure
+ exit 1
+ fi
+ args="${args} via ${GATEWAY}"
fi
if [ -n "${SOURCE}" ]; then
@@ -76,22 +74,22 @@ if [ -n "${SOURCE}" ]; then
fi
case "${2}" in
- up)
- boot_mesg "Adding '${desc}' route to the ${1} interface..."
- ip route add ${args} dev ${1}
- evaluate_retval
- ;;
-
- down)
- boot_mesg "Removing '${desc}' route from the ${1} interface..."
- ip route del ${args} dev ${1}
- evaluate_retval
- ;;
-
- *)
- echo "Usage: ${0} [interface] {up|down}"
- exit 1
- ;;
+ up)
+ boot_mesg "Adding '${desc}' route to the ${1} interface..."
+ ip route add ${args} dev ${1}
+ evaluate_retval
+ ;;
+
+ down)
+ boot_mesg "Removing '${desc}' route from the ${1} interface..."
+ ip route del ${args} dev ${1}
+ evaluate_retval
+ ;;
+
+ *)
+ echo "Usage: ${0} [interface] {up|down}"
+ exit 1
+ ;;
esac
-# End $network_devices/services/ipv4-static-route
+# End /bib/boot/ipv4-static-route