Rename /etc/sysconfig/init_params to /etc/sysconfig/rc.site.

Move network services to /lib/services.
Move init-functions to /lib/lsb.
Make /lib/lsb a symlink to /lib/services.
Create convenience symlink /etc/init.d->/etc/rc.d/init.d
Add help and man pages to ifup/ifdown.

Append /run/var/bootlog to /var/log/boot.log at the end of
the boot sequence.

Add capability to step through the boot scripts at boot time.

Optionally allow environment variables in sysconfig directory's
console, network, and clock files to be placed in rc.site.

Add an optional FASTBOOT parameter to set /fastboot when rebooting.

Remove a minor warning message from udev that is triggered
by the udev_retry boot script.

Add SKIPTMPCLEAN as an optional parameter to skip cleaning /tmp at boot time.

Add a page to Chapter 7 documenting rc.site. 



git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9597 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Bruce Dubbs 2011-09-19 03:31:46 +00:00
parent 103bbd63fe
commit f874424cab
50 changed files with 1804 additions and 696 deletions

View File

@ -8,6 +8,7 @@
<!ENTITY functions SYSTEM "functions.script"> <!ENTITY functions SYSTEM "functions.script">
<!ENTITY consolelog SYSTEM "consolelog.script"> <!ENTITY consolelog SYSTEM "consolelog.script">
<!ENTITY halt SYSTEM "halt.script"> <!ENTITY halt SYSTEM "halt.script">
<!ENTITY initfunctions SYSTEM "init-functions.script">
<!ENTITY localnet SYSTEM "localnet.script"> <!ENTITY localnet SYSTEM "localnet.script">
<!ENTITY modules SYSTEM "modules.script"> <!ENTITY modules SYSTEM "modules.script">
<!ENTITY mountfs SYSTEM "mountfs.script"> <!ENTITY mountfs SYSTEM "mountfs.script">
@ -57,6 +58,11 @@
<screen>&rc;</screen> <screen>&rc;</screen>
</sect1> </sect1>
<sect1 id="init-functions" role="wrap">
<title>/lib/lsb/init-functions</title>
<screen>&initfunctions;</screen>
</sect1>
<sect1 id="functions" role="wrap"> <sect1 id="functions" role="wrap">
<title>/etc/rc.d/init.d/functions</title> <title>/etc/rc.d/init.d/functions</title>
<screen>&functions;</screen> <screen>&functions;</screen>
@ -173,22 +179,22 @@
</sect1> </sect1>
<sect1 id="ifup" role="wrap"> <sect1 id="ifup" role="wrap">
<title>/etc/sysconfig/network-devices/ifup</title> <title>/sbin/ifup</title>
<screen>&ifup;</screen> <screen>&ifup;</screen>
</sect1> </sect1>
<sect1 id="ifdown" role="wrap"> <sect1 id="ifdown" role="wrap">
<title>/etc/sysconfig/network-devices/ifdown</title> <title>/sbin/ifdown</title>
<screen>&ifdown;</screen> <screen>&ifdown;</screen>
</sect1> </sect1>
<sect1 id="ipv4static" role="wrap"> <sect1 id="ipv4static" role="wrap">
<title>/etc/sysconfig/network-devices/services/ipv4-static</title> <title>/lib/services/ipv4-static</title>
<screen>&ipv4_static;</screen> <screen>&ipv4_static;</screen>
</sect1> </sect1>
<sect1 id="ipv4route" role="wrap"> <sect1 id="ipv4route" role="wrap">
<title>/etc/sysconfig/network-devices/services/ipv4-static-route</title> <title>/lib/services/ipv4-static-route</title>
<screen>&ipv4_static_route;</screen> <screen>&ipv4_static_route;</screen>
</sect1> </sect1>

View File

@ -1,3 +1,18 @@
2100-09-18
* Review and update of changes made in previous change.
** Rename /etc/sysconfig/init_params to /etc/sysconfig/rc.site.
** Move network services to /lib/services.
** Move init-functions to /lib/lsb.
*** /lib/lsb is a symlink to /lib/services.
* Create convenience symlink /etc/init.d->/etc/rc.d/init.d.
* Add help and man pages to upup/ifdown.
* Append /run/var/bootlog to /var/log/boot.log at the end of
the boot sequence.
* Add capabiltiy to step through the boot scripts at boot time
* Optionally allow environment variables in sysconfig directory's
console, network, and clock files to be placed in rc.site.
* Add an optional FASTBOOT parameter to set /fastboot when rebooting.
2011-07-14 Bruce Dubbs <bdubbs@linuxfromscratch.org> 2011-07-14 Bruce Dubbs <bdubbs@linuxfromscratch.org>
* Major rewrite of all LFS scripts * Major rewrite of all LFS scripts
** Move ifup/ifdown to /sbin ** Move ifup/ifdown to /sbin

View File

@ -1,33 +1,37 @@
ETCDIR=/etc ETCDIR=/etc
EXTDIR=${DESTDIR}${ETCDIR} EXTDIR=${DESTDIR}${ETCDIR}
LIBDIR=${DESTDIR}/lib/boot LIBDIR=${DESTDIR}/lib/services
MAN8=/usr/share/man/man8
MODE=754 MODE=754
DIRMODE=755 DIRMODE=755
CONFMODE=644 CONFMODE=644
all: install all: links
install: all
create-dirs: create-dirs:
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc0.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc0.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc1.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc1.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc2.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc2.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc3.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc3.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc4.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc4.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc5.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc5.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc6.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc6.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rcsysinit.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rcS.d
install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d
install -d -m ${DIRMODE} ${EXTDIR}/sysconfig install -d -m ${DIRMODE} ${EXTDIR}/sysconfig
install -d -m ${DIRMODE} ${LIBDIR} install -d -m ${DIRMODE} ${LIBDIR}
ln -svf services ${DESTDIR}/lib/lsb
ln -sf rc.d/init.d ${EXTDIR}/init.d
install: create-dirs files: create-dirs
install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/
install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR}
install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/consolelog ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/consolelog ${EXTDIR}/rc.d/init.d/
install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/modules ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/modules ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/ install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/
@ -37,48 +41,19 @@ install: create-dirs
install -m ${MODE} lfs/init.d/reboot ${EXTDIR}/rc.d/init.d/ 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/sendsignals ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/setclock ${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/swap ${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/sysctl ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/sysklogd ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/template ${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 ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/udev_retry ${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 install -m ${MODE} lfs/sbin/ifup /sbin
ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc0.d/K90sysklogd install -m ${MODE} lfs/sbin/ifdown /sbin
ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals install -m ${MODE} lfs/sbin/ifup.8 ${MAN8}
ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc0.d/S70mountfs ln -sf ifup.8 ${MAN8}/ifdown.8
ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc0.d/S80swap install -m ${MODE} lfs/lib/services/ipv4-static-route ${LIBDIR}
ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rc0.d/S90localnet install -m ${MODE} lfs/lib/services/ipv4-static ${LIBDIR}
ln -sf ../init.d/halt ${EXTDIR}/rc.d/rc0.d/S99halt install -m ${CONFMODE} lfs/lib/services/init-functions ${LIBDIR}
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/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/network ${EXTDIR}/rc.d/rc3.d/S20network
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/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/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
ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rc6.d/S90localnet
ln -sf ../init.d/reboot ${EXTDIR}/rc.d/rc6.d/S99reboot
ln -sf ../init.d/mountvirtfs ${EXTDIR}/rc.d/rcsysinit.d/S00mountvirtfs
ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S02consolelog
ln -sf ../init.d/modules ${EXTDIR}/rc.d/rcsysinit.d/S05modules
ln -sf ../init.d/udev ${EXTDIR}/rc.d/rcsysinit.d/S10udev
ln -sf ../init.d/swap ${EXTDIR}/rc.d/rcsysinit.d/S20swap
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
ln -sf ../init.d/udev_retry ${EXTDIR}/rc.d/rcsysinit.d/S50udev_retry
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 \ if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then \
install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/ ;\ install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/ ;\
fi fi
@ -88,47 +63,63 @@ install: create-dirs
if [ ! -f ${EXTDIR}/sysconfig/rc ]; then \ if [ ! -f ${EXTDIR}/sysconfig/rc ]; then \
install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/ ;\ install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/ ;\
fi fi
install -m ${MODE} lfs/sysconfig/network-devices/ifup /sbin if [ ! -f ${EXTDIR}/sysconfig/rc.site ]; then \
install -m ${MODE} lfs/sysconfig/network-devices/ifdown /sbin install -m ${CONFMODE} lfs/sysconfig/rc.site ${EXTDIR}/sysconfig/ ;\
install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static ${LIBDIR} fi
install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static-route ${LIBDIR}
install-consolelog: create-dirs links: files rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6
install -m ${MODE} contrib/init.d/consolelog ${EXTDIR}/rc.d/init.d
ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S00consolelog
minimal: create-dirs rcS:
install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/mountvirtfs ${EXTDIR}/rc.d/rcS.d/S00mountvirtfs
install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcS.d/S02consolelog
install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/modules ${EXTDIR}/rc.d/rcS.d/S05modules
install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR} ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rcS.d/S08localnet
install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/udev ${EXTDIR}/rc.d/rcS.d/S10udev
install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/swap ${EXTDIR}/rc.d/rcS.d/S20swap
install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/checkfs ${EXTDIR}/rc.d/rcS.d/S30checkfs
install -m ${MODE} lfs/init.d/mountvirtfs ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rcS.d/S40mountfs
install -m ${MODE} lfs/init.d/rc ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/cleanfs ${EXTDIR}/rc.d/rcS.d/S45cleanfs
install -m ${MODE} lfs/init.d/reboot ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/udev_retry ${EXTDIR}/rc.d/rcS.d/S50udev_retry
install -m ${MODE} lfs/init.d/sendsignals ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/console ${EXTDIR}/rc.d/rcS.d/S70console
install -m ${MODE} lfs/init.d/setclock ${EXTDIR}/rc.d/init.d/ ln -sf ../init.d/sysctl ${EXTDIR}/rc.d/rcS.d/S90sysctl
install -m ${MODE} lfs/init.d/swap ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/udev ${EXTDIR}/rc.d/init.d/ rc0:
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/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals 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/mountfs ${EXTDIR}/rc.d/rc0.d/S70mountfs
ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc0.d/S80swap 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/halt ${EXTDIR}/rc.d/rc0.d/S99halt
rc1:
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc1.d/K80network
ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc1.d/K90sysklogd
rc2:
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc2.d/K80network
ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc2.d/K90sysklogd
rc3:
ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc3.d/S10sysklogd
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc3.d/S20network
rc4:
ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc4.d/S10sysklogd
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc4.d/S20network
rc5:
ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc5.d/S10sysklogd
ln -sf ../init.d/network ${EXTDIR}/rc.d/rc5.d/S20network
rc6:
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/sendsignals ${EXTDIR}/rc.d/rc6.d/S60sendsignals 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/mountfs ${EXTDIR}/rc.d/rc6.d/S70mountfs
ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc6.d/S80swap ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc6.d/S80swap
ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rc6.d/S90localnet
ln -sf ../init.d/reboot ${EXTDIR}/rc.d/rc6.d/S99reboot ln -sf ../init.d/reboot ${EXTDIR}/rc.d/rc6.d/S99reboot
ln -sf ../init.d/mountvirtfs ${EXTDIR}/rc.d/rcsysinit.d/S00mountvirtfs
ln -sf ../init.d/udev ${EXTDIR}/rc.d/rcsysinit.d/S10udev
ln -sf ../init.d/swap ${EXTDIR}/rc.d/rcsysinit.d/S20swap
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
.PHONY: all create-dirs install .PHONY: all create-dirs install files links rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6

View File

@ -1,49 +1,44 @@
Network Configuration: Network Configuration:
Script Files: Script Files:
/etc/rc.d/init.d/network /etc/rc.d/init.d/*
/sbin/ifup /sbin/ifup
/sbin/ifdown /sbin/ifdown
/lib/boot/*/* /lib/lsb/*
Configuration Files: Configuration Files:
/etc/sysconfig/ifconfig.* /etc/sysconfig/ifconfig.*
Note: ifconfig.* could be either a file or directory, Note: ifconfig.* files will be processed
but the filename extension must be the same name in alphanumerical order on boot, and reversed on shutdown.
as the network interface you wish it to belong to. - IFACE : The interface that is being configured (e.g. eth0)
The files within the directory will be processed - SERVICE: Which script to run in services directory.
in alphanumerical order on boot, and reversed on - ONBOOT : If set to yes, this interface will be started on bootup
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
/etc/sysconfig/network /etc/sysconfig/network
- HOSTNAME: Value of the system's hostname - HOSTNAME: Value of the system's hostname (From LFS Book)
This value may also be set in /etc/sysconfig/rc.site
Additional Configuration: Additional Configuration:
ipv4-static: SERVICE ipv4-static:
- IP: static IP Address - IP : Static IP Address
- GATEWAY: Specifies the IP Address of the gateway server - GATEWAY : Specifies the IP Address of the gateway server
- PREFIX: CIDR prefix of IP Address, defaults to 24 if not set - PREFIX : CIDR prefix of IP Address, defaults to 24 if not set
- PEER: IP Address of peer (for point-to-point connections and tunnels) - PEER : IP Address of peer (for point-to-point connections and tunnels)
- BROADCAST: broadcast address - BROADCAST: Broadcast address
ipv4-static-route: SERVICE ipv4-static-route:
- TYPE: network (default type if not specified), default, host or - TYPE : Network (default type if not specified), default, host or unreachable
unreachable - IP : IP Address of target (for network, host and unreachable)
- IP: IP Address of target (for network, host and unreachable) - PREFIX : CIDR prefix 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) - GATEWAY: IP Address of gateway to reach target (for network and default)
SetClock configuration: SetClock configuration:
Script Files:
/etc/rc.d/init.d/setclock /etc/rc.d/init.d/cleanfs
- SKIPTMPCLEAN: skips cleaning of /tmp directory - SKIPTMPCLEAN: skips cleaning of /tmp directory
Configuration Files: Configuration Files:
/etc/sysconfig/clock /etc/sysconfig/clock or /etc/sysconfig/rc.site
- UTC: 1 assumes hwclock is in UTC - UTC: 1 assumes hwclock is in UTC
0 assumes hwclock is in local time 0 assumes hwclock is in local time
- CLOCKPARAMS: any additional options to be passed to hwclock - CLOCKPARAMS: any additional options to be passed to hwclock

View File

@ -6,6 +6,7 @@
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# A. Luebke - luebke@users.sourceforge.net # A. Luebke - luebke@users.sourceforge.net
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -37,101 +38,102 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
if [ -f /fastboot ]; then if [ -f /fastboot ]; then
boot_mesg -n "/fastboot found, will not perform" ${INFO} msg="/fastboot found, will omit "
boot_mesg " file system checks as requested." msg="${msg} file system checks as requested.\n"
echo_ok log_info_msg "${msg}"
exit 0 exit 0
fi fi
boot_mesg "Mounting root file system in read-only mode..." log_info_msg "Mounting root file system in read-only mode... "
mount -n -o remount,ro / >/dev/null mount -n -o remount,ro / >/dev/null
evaluate_retval
if [ ${?} != 0 ]; then if [ ${?} != 0 ]; then
echo_failure log_failure_msg2
boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE} msg="\n\nCannot check root "
boot_mesg -n " filesystem because it could not be mounted" msg="${msg}filesystem because it could not be mounted "
boot_mesg -n " in read-only mode.\n\nAfter you" msg="${msg}in read-only mode.\n\n"
boot_mesg -n " press Enter, this system will be" msg="${msg}After you press Enter, this system will be "
boot_mesg -n " halted and powered off." msg="${msg}halted and powered off.\n\n"
boot_mesg -n "\n\nPress enter to continue..." ${INFO} log_failure_msg "${msg}"
boot_mesg "" ${NORMAL}
log_info_msg "Press Enter to continue..."
wait_for_user wait_for_user
/etc/rc.d/init.d/halt stop /etc/rc.d/init.d/halt stop
else
log_success_msg2
fi fi
if [ -f /forcefsck ]; then if [ -f /forcefsck ]; then
boot_mesg -n "/forcefsck found, forcing file" ${INFO} msg="\n/forcefsck found, forcing file"
boot_mesg " system checks as requested." msg="${msg} system checks as requested."
echo_ok log_success_msg "$msg"
options="-f" options="-f"
else else
options="" options=""
fi fi
boot_mesg "Checking file systems..." log_info_msg "Checking file systems..."
# Note: -a option used to be -p; but this fails e.g. # Note: -a option used to be -p; but this fails e.g. on fsck.minix
# on fsck.minix
fsck ${options} -a -A -C -T fsck ${options} -a -A -C -T
error_value=${?} error_value=${?}
if [ "${error_value}" = 0 ]; then if [ "${error_value}" = 0 ]; then
echo_ok log_success_msg2
fi fi
if [ "${error_value}" = 1 ]; then if [ "${error_value}" = 1 ]; then
echo_warning msg="\nWARNING:\n\nFile system errors "
boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING} msg="${msg}were found and have been corrected.\n"
boot_mesg -n " were found and have been corrected. " msg="${msg}You may want to double-check that "
boot_mesg -n " You may want to double-check that" msg="${msg}everything was fixed properly."
boot_mesg -n " everything was fixed properly." log_warning_msg "$msg"
boot_mesg "" ${NORMAL}
fi fi
if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
echo_warning msg="\nWARNING:\n\nFile system errors "
boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING} msg="${msg}were found and have been been "
boot_mesg -n " were found and have been been" msg="${msg}corrected, but the nature of the "
boot_mesg -n " corrected, but the nature of the" msg="${msg}errors require this system to be rebooted.\n\n"
boot_mesg -n " errors require this system to be" msg="${msg}After you press enter, "
boot_mesg -n " rebooted.\n\nAfter you press enter," msg="${msg}this system will be rebooted\n\n"
boot_mesg -n " this system will be rebooted" log_failure_msg "$msg"
boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL} log_info_msg "Press Enter to continue..."
wait_for_user wait_for_user
reboot -f reboot -f
fi fi
if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
echo_failure msg="\nFAILURE:\n\nFile system errors "
boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE} msg="${msg}were encountered that could not be "
boot_mesg -n " were encountered that could not be" msg="${msg}fixed automatically. This system "
boot_mesg -n " fixed automatically. This system" msg="${msg}cannot continue to boot and will "
boot_mesg -n " cannot continue to boot and will" msg="${msg}therefore be halted until those "
boot_mesg -n " therefore be halted until those" msg="${msg}errors are fixed manually by a "
boot_mesg -n " errors are fixed manually by a" msg="${msg}System Administrator.\n\n"
boot_mesg -n " System Administrator.\n\nAfter you" msg="${msg}After you press Enter, this system will be "
boot_mesg -n " press Enter, this system will be" msg="${msg}halted and powered off.\n\n"
boot_mesg -n " halted and powered off." log_failure_msg "$msg"
boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL} log_info_msg "Press Enter to continue..."
wait_for_user wait_for_user
/etc/rc.d/init.d/halt stop /etc/rc.d/init.d/halt stop
fi fi
if [ "${error_value}" -ge 16 ]; then if [ "${error_value}" -ge 16 ]; then
echo_failure msg="\nFAILURE:\n\nUnexpected Failure "
boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE} msg="${msg}running fsck. Exited with error "
boot_mesg -n " running fsck. Exited with error" msg="${msg} code: ${error_value}."
boot_mesg -n " code: ${error_value}." log_failure_msg $msg
boot_mesg "" ${NORMAL}
exit ${error_value} exit ${error_value}
fi fi
exit 0
;; ;;
*) *)
echo "Usage: ${0} {start}" echo "Usage: ${0} {start}"

View File

@ -5,6 +5,7 @@
# Description : Clean file system # Description : Clean file system
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -26,67 +27,70 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
# Function to create files/directory on boot. # Function to create files/directory on boot.
create_files() { function create_files()
# Read in the configuration file. {
# Input to file descriptor 9 and output to stdin (redirection)
exec 9>&0 < /etc/sysconfig/createfiles exec 9>&0 < /etc/sysconfig/createfiles
while read name type perm usr grp dtype maj min junk
do while read name type perm usr grp dtype maj min junk
# Ignore comments and blank lines. do
case "${name}" in # Ignore comments and blank lines.
""|\#*) continue ;; case "${name}" in
""|\#*) continue ;;
esac
# Ignore existing files.
if [ ! -e "${name}" ]; then
# Create stuff based on its type.
case "${type}" in
dir)
mkdir "${name}"
;;
file)
:> "${name}"
;;
dev)
case "${dtype}" in
char)
mknod "${name}" c ${maj} ${min}
;;
block)
mknod "${name}" b ${maj} ${min}
;;
pipe)
mknod "${name}" p
;;
*)
log_warning_msg "\nUnknown device type: ${dtype}"
;;
esac
;;
*)
log_warning_msg "\nUnknown type: ${type}"
continue
;;
esac esac
# Ignore existing files. # Set up the permissions, too.
if [ ! -e "${name}" ]; then chown ${usr}:${grp} "${name}"
# Create stuff based on its type. chmod ${perm} "${name}"
case "${type}" in fi
dir) done
mkdir "${name}"
;;
file)
:> "${name}"
;;
dev)
case "${dtype}" in
char)
mknod "${name}" c ${maj} ${min}
;;
block)
mknod "${name}" b ${maj} ${min}
;;
pipe)
mknod "${name}" p
;;
*)
boot_mesg -n "\nUnknown device type: ${dtype}" ${WARNING}
boot_mesg "" ${NORMAL}
;;
esac
;;
*)
boot_mesg -n "\nUnknown type: ${type}" ${WARNING}
boot_mesg "" ${NORMAL}
continue
;;
esac
# Set up the permissions, too. # Close file descriptor 9 (end redirection)
chown ${usr}:${grp} "${name}"
chmod ${perm} "${name}"
fi
done
exec 0>&9 9>&- exec 0>&9 9>&-
return 0
} }
case "${1}" in case "${1}" in
start) start)
boot_mesg -n "Cleaning file systems:" ${INFO} log_info_msg "Cleaning file systems:"
if [ "${SKIPTMPCLEAN}" = "" ]; then if [ "${SKIPTMPCLEAN}" = "" ]; then
boot_mesg -n " /tmp" ${NORMAL} log_info_msg2 "\n /tmp"
cd /tmp && cd /tmp &&
find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1 find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
fi fi
@ -102,10 +106,12 @@ case "${1}" in
evaluate_retval evaluate_retval
if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null; then if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null; then
boot_mesg "Creating files and directories..." log_info_msg "Creating files and directories... "
create_files create_files # Always returns 0
evaluate_retval evaluate_retval
fi fi
exit $failed
;; ;;
*) *)
echo "Usage: ${0} {start}" echo "Usage: ${0} {start}"

View File

@ -6,14 +6,13 @@
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Alexander E. Patrakov # Alexander E. Patrakov
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
# #
######################################################################## ########################################################################
. /lib/boot/functions
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: console # Provides: console
# Required-Start: # Required-Start:
@ -28,37 +27,43 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
# Native English speakers probably don't have /etc/sysconfig/console at all . /lib/lsb/init-functions
if [ -r /etc/sysconfig/console ]; then
. /etc/sysconfig/console
else
exit 0
fi
is_true() { # Native English speakers probably don't have /etc/sysconfig/console at all
[ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
function is_true()
{
[ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
} }
# See if we need to do anything
if [ -z "${KEYMAP}" ] && [ -z "${KEYMAP_CORRECTIONS}" ] &&
[ -z "${FONT}" ] && [ is_true "${UNICODE}" ] &&
[ -z "${LEGACY_CHARSET}" ]; then
exit 0
fi
failed=0 failed=0
case "${1}" in case "${1}" in
start) start)
boot_mesg "Setting up Linux console..."
# There should be no bogus failures below this line! # There should be no bogus failures below this line!
log_info_msg "Setting up Linux console..."
# Figure out if a framebuffer console is used # Figure out if a framebuffer console is used
[ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0 [ -d /sys/class/graphics/fb0 ] && use_fb=1 || use_fb=0
# Figure out the command to set the console into the # Figure out the command to set the console into the
# desired mode # desired mode
is_true "${UNICODE}" && is_true "${UNICODE}" &&
MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" || MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" ||
MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a" MODE_COMMAND="echo -en '\033%@\033(K' && kbd_mode -a"
# On framebuffer consoles, font has to be set for each vt in # 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. # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
! is_true "${USE_FB}" || [ -z "${FONT}" ] || ! is_true "${use_fb}" || [ -z "${FONT}" ] ||
MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}" MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
# Apply that command to all consoles mentioned in # Apply that command to all consoles mentioned in
@ -66,8 +71,6 @@ case "${1}" in
# happen before setfont, otherwise a kernel bug will # happen before setfont, otherwise a kernel bug will
# show up and the unicode map of the font will not be # show up and the unicode map of the font will not be
# used. # used.
# FIXME: Fedora Core also initializes two spare consoles
# - do we want that?
for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab | for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
grep -o '\btty[[:digit:]]*\b'` grep -o '\btty[[:digit:]]*\b'`
@ -77,31 +80,33 @@ case "${1}" in
done done
# Set the font (if not already set above) and the keymap # Set the font (if not already set above) and the keymap
is_true "${USE_FB}" || [ -z "${FONT}" ] || [ "${use_fb}" == "1" || [ -z "${FONT}" ] || setfont $FONT || failed=1
setfont $FONT ||
failed=1
[ -z "${KEYMAP}" ] || [ -z "${KEYMAP}" ] ||
loadkeys ${KEYMAP} >/dev/null 2>&1 || loadkeys ${KEYMAP} >/dev/null 2>&1 ||
failed=1 failed=1
[ -z "${KEYMAP_CORRECTIONS}" ] || [ -z "${KEYMAP_CORRECTIONS}" ] ||
loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 || loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
failed=1 failed=1
# Convert the keymap from $LEGACY_CHARSET to UTF-8 # Convert the keymap from $LEGACY_CHARSET to UTF-8
[ -z "$LEGACY_CHARSET" ] || [ -z "$LEGACY_CHARSET" ] ||
dumpkeys -c "$LEGACY_CHARSET" | dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u >/dev/null 2>&1 ||
loadkeys -u >/dev/null 2>&1 ||
failed=1 failed=1
# If any of the commands above failed, the trap at the # If any of the commands above failed, the trap at the
# top would set $failed to 1 # top would set $failed to 1
( exit $failed ) ( exit $failed )
evaluate_retval evaluate_retval
;;
*) exit $failed
echo $"Usage:" "${0} {start}" ;;
exit 1
;; *)
echo $"Usage:" "${0} {start}"
exit 1
;;
esac esac
# End console # End console

View File

@ -5,7 +5,8 @@
# Description : Set the kernel log level for the console # Description : Set the kernel log level for the console
# #
# Authors : Dan Nicholson - dnicholson@linuxfromscratch.org # Authors : Dan Nicholson - dnicholson@linuxfromscratch.org
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -27,25 +28,28 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
# set the default loglevel # set the default loglevel if needed
LOGLEVEL=7 LOGLEVEL=${LOGLEVEL:-7}
[ -r /etc/sysconfig/console ] && . /etc/sysconfig/console [ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
case "${1}" in case "${1}" in
start) start)
case "$LOGLEVEL" in case "$LOGLEVEL" in
[1-8]) [1-8])
boot_mesg "Setting the console log level to ${LOGLEVEL}..." log_info_msg "Setting the console log level to ${LOGLEVEL}..."
dmesg -n $LOGLEVEL dmesg -n $LOGLEVEL
evaluate_retval evaluate_retval
exit 0
;; ;;
*) *)
boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE} log_failure_msg "Console log level '${LOGLEVEL}' is invalid"
echo_failure exit 1
;; ;;
esac esac
;; ;;
@ -54,13 +58,14 @@ case "${1}" in
if [ -r /proc/sys/kernel/printk ]; then if [ -r /proc/sys/kernel/printk ]; then
read level line < /proc/sys/kernel/printk read level line < /proc/sys/kernel/printk
else else
boot_mesg "Can't read the current console log level" ${FAILURE} log_failure_msg "Can't read the current console log level"
echo_failure exit 1
fi fi
# Print the value # Print the value
if [ -n "$level" ]; then if [ -n "$level" ]; then
${ECHO} -e "${INFO}The current console log level is ${level}${NORMAL}" log_info_msg "The current console log level is ${level}\n"
exit 0
fi fi
;; ;;

View File

@ -12,12 +12,12 @@
# Notes : With code based on Matthias Benkmann's simpleinit-msb # Notes : With code based on Matthias Benkmann's simpleinit-msb
# http://winterdrache.de/linux/newboot/index.html # http://winterdrache.de/linux/newboot/index.html
# #
# The file should be located in /lib/boot # This file is only present for backward BLFS compatibility
# #
######################################################################## ########################################################################
# Set any needed environment variables e.g. HEADLESS # Set any needed environment variables e.g. HEADLESS
[ -r /etc/sysconfig/init_params ] && . /etc/sysconfig/init_params . /lib/lsb/init_params
## Environmental setup ## Environmental setup
# Setup default values for environment # Setup default values for environment

View File

@ -5,6 +5,7 @@
# Description : Halt Script # Description : Halt Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0

View File

@ -5,6 +5,7 @@
# Description : Loopback device # Description : Loopback device
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -25,23 +26,23 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
. /etc/sysconfig/network [ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
case "${1}" in case "${1}" in
start) start)
boot_mesg "Bringing up the loopback interface..." log_info_msg "Bringing up the loopback interface..."
ip addr add 127.0.0.1/8 label lo dev lo ip addr add 127.0.0.1/8 label lo dev lo
ip link set lo up ip link set lo up
evaluate_retval evaluate_retval
boot_mesg "Setting hostname to ${HOSTNAME}..." log_info_msg "Setting hostname to ${HOSTNAME}..."
hostname ${HOSTNAME} hostname ${HOSTNAME}
evaluate_retval evaluate_retval
;; ;;
stop) stop)
boot_mesg "Bringing down the loopback interface..." log_info_msg "Bringing down the loopback interface..."
ip link set lo down ip link set lo down
evaluate_retval evaluate_retval
;; ;;
@ -63,4 +64,6 @@ case "${1}" in
;; ;;
esac esac
exit 0
# End localnet # End localnet

View File

@ -5,6 +5,7 @@
# Description : Module auto-loading script # Description : Module auto-loading script
# #
# Authors : Zack Winkles # Authors : Zack Winkles
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -24,23 +25,23 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions
# Assure that the kernel has module support. # Assure that the kernel has module support.
[ -e /proc/ksyms -o -e /proc/modules ] || exit 0 [ -e /proc/ksyms -o -e /proc/modules ] || exit 0
. /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
# Exit if there's no modules file or there are no # Exit if there's no modules file or there are no
# valid entries # valid entries
[ -r /etc/sysconfig/modules ] && [ -r /etc/sysconfig/modules ] || exit 0
egrep -qv '^($|#)' /etc/sysconfig/modules || [ $(egrep -qv '^($|#)' /etc/sysconfig/modules) ] || exit 0
exit 0
boot_mesg -n "Loading modules:" ${INFO} log_info_msg "Loading modules:"
# Only try to load modules if the user has actually given us # Only try to load modules if the user has actually given us
# some modules to load. # some modules to load.
while read module args; do while read module args; do
# Ignore comments and blank lines. # Ignore comments and blank lines.
@ -48,29 +49,25 @@ case "${1}" in
""|"#"*) continue ;; ""|"#"*) continue ;;
esac esac
# Attempt to load the module, making # Attempt to load the module, passing any arguments provided.
# sure to pass any arguments provided.
modprobe ${module} ${args} >/dev/null modprobe ${module} ${args} >/dev/null
# Print the module name if successful, # Print the module name if successful, otherwise take note.
# otherwise take note.
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
boot_mesg -n " ${module}" ${NORMAL} log_info_msg2 " ${module}"
else else
failedmod="${failedmod} ${module}" failedmod="${failedmod} ${module}"
fi fi
done < /etc/sysconfig/modules done < /etc/sysconfig/modules
boot_mesg "" ${NORMAL} # Print a message about successfully loaded modules on the correct line.
# Print a message about successfully loaded log_success_msg2
# modules on the correct line.
echo_ok
# Print a failure message with a list of any # Print a failure message with a list of any modules that
# modules that may have failed to load. # may have failed to load.
if [ -n "${failedmod}" ]; then if [ -n "${failedmod}" ]; then
boot_mesg "Failed to load modules:${failedmod}" ${FAILURE} log_failure_msg "Failed to load modules:${failedmod}"
echo_failure exit 1
fi fi
;; ;;
@ -80,4 +77,6 @@ case "${1}" in
;; ;;
esac esac
exit 0
# End modules # End modules

View File

@ -5,6 +5,7 @@
# Description : File System Mount Script # Description : File System Mount Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -27,18 +28,18 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
boot_mesg "Remounting root file system in read-write mode..." log_info_msg "Remounting root file system in read-write mode..."
mount -n -o remount,rw / >/dev/null mount -n -o remount,rw / >/dev/null
evaluate_retval evaluate_retval
# Remove fsck-related file system watermarks. # Remove fsck-related file system watermarks.
rm -f /fastboot /forcefsck rm -f /fastboot /forcefsck
boot_mesg "Recording existing mounts in /etc/mtab..." log_info_msg "Recording existing mounts in /etc/mtab..."
> /etc/mtab > /etc/mtab
mount -f / || failed=1 mount -f / || failed=1
@ -50,15 +51,19 @@ case "${1}" in
# This will mount all filesystems that do not have _netdev in # This will mount all filesystems that do not have _netdev in
# their option list. _netdev denotes a network filesystem. # their option list. _netdev denotes a network filesystem.
boot_mesg "Mounting remaining file systems..."
log_info_msg "Mounting remaining file systems..."
mount -a -O no_netdev >/dev/null mount -a -O no_netdev >/dev/null
evaluate_retval evaluate_retval
exit $failed
;; ;;
stop) stop)
boot_mesg "Unmounting all other currently mounted file systems..." # Don't unmount tmpfs like /run
log_info_msg "Unmounting all other currently mounted file systems..."
umount -a -d -r -t notmpfs >/dev/null umount -a -d -r -t notmpfs >/dev/null
evaluate_retval evaluate_retval
exit 0
;; ;;
*) *)

View File

@ -5,6 +5,7 @@
# Description : Mount proc, sysfs, and run # Description : Mount proc, sysfs, and run
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -26,32 +27,30 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
# Make sure /run/var is available before logging any messages
mkdir -p /run mkdir -p /run
mount -n /run || failed=1 mount -n /run || failed=1
mkdir -p /run/{var,lock,shm} mkdir -p /run/{var,lock,shm}
log_info_msg "Mounting virtual file systems: /run"
boot_mesg -n "Mounting virtual file systems:" ${INFO}
boot_mesg -n " /run" ${NORMAL}
if ! mountpoint /proc >/dev/null; then if ! mountpoint /proc >/dev/null; then
boot_mesg -n " /proc" ${NORMAL} log_info_msg2 " /proc"
mount -n /proc || failed=1 mount -n /proc || failed=1
fi fi
if ! mountpoint /sys >/dev/null; then if ! mountpoint /sys >/dev/null; then
boot_mesg -n " /sys" ${NORMAL} log_info_msg2 " /sys"
mount -n /sys || failed=1 mount -n /sys || failed=1
fi fi
boot_mesg "" ${NORMAL}
(exit ${failed}) (exit ${failed})
evaluate_retval evaluate_retval
exit $failed
;; ;;
*) *)
@ -60,4 +59,4 @@ case "${1}" in
;; ;;
esac esac
# End mountvertfs # End mountvirtfs

View File

@ -7,6 +7,7 @@
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Nathan Coulson - nathan@linuxfromscratch.org # Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org # Kevin P. Fleming - kpfleming@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -33,7 +34,7 @@ case "${1}" in
do do
interface=${file##*/ifconfig.} interface=${file##*/ifconfig.}
# skip if $file is * (because nothing was found) # Skip if $file is * (because nothing was found)
if [ "${interface}" = "*" ] if [ "${interface}" = "*" ]
then then
continue continue
@ -45,18 +46,18 @@ case "${1}" in
stop) stop)
# Reverse list # Reverse list
FILES="" net_files=""
for file in /etc/sysconfig/ifconfig.* for file in /etc/sysconfig/ifconfig.*
do do
FILES="${file} ${FILES}" net_files="${file} ${net_files}"
done done
# Stop all network interfaces # Stop all network interfaces
for file in ${FILES} for file in ${net_files}
do do
interface=${file##*/ifconfig.} interface=${file##*/ifconfig.}
# skip if $file is * (because nothing was found) # Skip if $file is * (because nothing was found)
if [ "${interface}" = "*" ] if [ "${interface}" = "*" ]
then then
continue continue
@ -78,4 +79,6 @@ case "${1}" in
;; ;;
esac esac
exit 0
# End network # End network

View File

@ -1,55 +1,92 @@
#!/bin/sh #!/bin/bash
######################################################################## ########################################################################
# Begin rc # Begin rc
# #
# Description : Main Run Level Control Script # Description : Main Run Level Control Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# : DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
# #
######################################################################## ########################################################################
. /lib/boot/functions . /lib/lsb/init-functions
print_error_msg() function print_error_msg()
{ {
echo_failure log_failure_msg
# $i is set when called # $i is set when called
boot_mesg -n "FAILURE:\n\nYou should not be reading this error message.\n\n" ${FAILURE} MSG="FAILURE:\n\nYou should not be reading this error message.\n\n"
boot_mesg -n " It means that an unforeseen error took" MSG="${MSG}It means that an unforeseen error took place in\n"
boot_mesg -n " place in ${i}, which exited with a return value of" MSG="${MSG}${i},\n"
boot_mesg " ${error_value}.\n" MSG="${MSG}which exited with a return value of ${error_value}.\n"
boot_mesg_flush
boot_mesg -n "If you're able to track this" MSG="${MSG}If you're able to track this error down to a bug in one of\n"
boot_mesg -n " error down to a bug in one of the files provided by" MSG="${MSG}the files provided by the files provided by\n"
boot_mesg -n " the LFS book, please be so kind to inform us at" MSG="${MSG}the ${DISDRI_MINI} book, please be so kind to inform us at\n"
boot_mesg " lfs-dev@linuxfromscratch.org.\n" MSG="${MSG}${DISTRO_CONTACT}.\n"
boot_mesg_flush log_failure_msg "${MSG}"
boot_mesg -n "Press Enter to continue..." ${INFO}
boot_mesg "" ${NORMAL} log_info_msg "Press Enter to continue..."
wait_for_user wait_for_user
} }
check_script_status() function check_script_status()
{ {
# $i is set when called # $i is set when called
if [ ! -f ${i} ]; then if [ ! -f ${i} ]; then
boot_mesg "${i} is not a valid symlink." ${WARNING} log_warning_msg "${i} is not a valid symlink."
echo_warning
continue continue
fi fi
if [ ! -x ${i} ]; then if [ ! -x ${i} ]; then
boot_mesg "${i} is not executable, skipping." ${WARNING} log_warning_msg "${i} is not executable, skipping."
echo_warning
continue continue
fi fi
} }
# This sets a few default terminal options. function run()
stty sane {
if [ -z $interactive ]; then
${1} ${2}
return $?
fi
while true; do
read -p "Run ${1} ${2} (Yes/no/continue)? " -n 1 runit
echo
case ${runit} in
c | C)
interactive=""
${i} ${2}
ret=${?}
break;
;;
n | N)
return 0
;;
y | Y)
${i} ${2}
ret=${?}
break
;;
esac
done
return $ret
}
# Read any local settings/overrides
[ -r /etc/sysconfig/rc.site ] && source /etc/sysconfig/rc.site
DISTRO=${DISTRO:-"Linux From Scratch"}
DISTRO_CONTACT=${DISTRO_CONTACT:-"lfs-dev@linuxfromscratch.org (Registration required)"}
DISTRO_MINI=${DISTRO_MINI:-"LFS"}
# These 3 signals will not cause our script to exit # These 3 signals will not cause our script to exit
trap "" INT QUIT TSTP trap "" INT QUIT TSTP
@ -65,10 +102,29 @@ previous=${PREVLEVEL}
[ "${previous}" = "" ] && previous=N [ "${previous}" = "" ] && previous=N
if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then
boot_mesg "/etc/rc.d/rc${runlevel}.d does not exist." log_info_msg "/etc/rc.d/rc${runlevel}.d does not exist.\n"
exit 1 exit 1
fi fi
if [ "$runlevel" == "6" ] || [ "$runlevel" == "0" ]; then IPROMPT="no"; fi
if [ "${IPROMPT}" == "yes" ]; then
# dcol and icol are spaces before the message to center the
# message on screen.
wcol=$(( ( ${COLUMNS} - ${wlen} ) / 2 ))
icol=$(( ( ${COLUMNS} - ${ilen} ) / 2 ))
echo -e "\\033[${wcol}G${welcome_message}"
echo -e "\\033[${icol}G${i_message}${NORMAL}"
echo ""
read -t "${itime}" -n 1 interactive 2>&1 > /dev/null
# Make lower case
[ "${interactive}" == "I" ] && interactive="i"
[ "${interactive}" != "i" ] && interactive=""
fi
# Attempt to stop all services started by the previous runlevel, # Attempt to stop all services started by the previous runlevel,
# and killed in this runlevel # and killed in this runlevel
if [ "${previous}" != "N" ]; then if [ "${previous}" != "N" ]; then
@ -78,34 +134,34 @@ if [ "${previous}" != "N" ]; then
suffix=${i#/etc/rc.d/rc$runlevel.d/K[0-9][0-9]} 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 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 sysinit_start=/etc/rc.d/rcS.d/S[0-9][0-9]$suffix
if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then
if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING} MSG="WARNING:\n\n${i} can't be "
boot_mesg -n " executed because it was not" MSG="${MSG}executed because it was not "
boot_mesg -n " not started in the previous" MSG="${MSG}not started in the previous "
boot_mesg -n " runlevel (${previous})." MSG="${MSG}runlevel (${previous})."
boot_mesg "" ${NORMAL} log_warning_msg "$MSG"
boot_mesg_flush
continue continue
fi fi
fi fi
${i} stop
run ${i} stop
error_value=${?} error_value=${?}
if [ "${error_value}" != "0" ]; then if [ "${error_value}" != "0" ]; then print_error_msg; fi
print_error_msg
fi
done done
fi fi
if [ "${previous}" = "N" ]; then if [ "${previous}" == "N" ]; then export IN_BOOT=1; fi
IN_BOOT=1
export IN_BOOT if [ "$runlevel" == "6" ] && [ -n ${FASTBOOT} ]; then
touch /fastboot
fi fi
#Start all functions in this runlevel
# Start all functions in this runlevel
for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null) for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null)
do do
if [ "${previous}" != "N" ]; then if [ "${previous}" != "N" ]; then
@ -120,17 +176,22 @@ do
case ${runlevel} in case ${runlevel} in
0|6) 0|6)
${i} stop run ${i} stop
;; ;;
*) *)
${i} start run ${i} start
;; ;;
esac esac
error_value=${?} error_value=${?}
if [ "${error_value}" != "0" ]; then if [ "${error_value}" != "0" ]; then print_error_msg; fi
print_error_msg
fi
done done
# Copy the boot log on initial boot only
if [ "${previous}" == "N" ]; then
cat /run/var/bootlog >> /var/log/boot.log
echo "--------" >> /var/log/boot.log # Mark the end of boot
fi
# End rc # End rc

View File

@ -5,6 +5,7 @@
# Description : Reboot Scripts # Description : Reboot Scripts
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -24,11 +25,11 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
stop) stop)
boot_mesg "Restarting system..." log_info_msg "Restarting system..."
reboot -d -f -i reboot -d -f -i
;; ;;

View File

@ -5,6 +5,7 @@
# Description : Sendsignals Script # Description : Sendsignals Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -24,32 +25,32 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot//functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
stop) stop)
boot_mesg "Sending all processes the TERM signal..." log_info_msg "Sending all processes the TERM signal..."
killall5 -15 killall5 -15
error_value=${?} error_value=${?}
sleep ${KILLDELAY} sleep ${KILLDELAY}
if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
echo_ok log_success_msg
else else
echo_failure log_failure_msg
fi fi
boot_mesg "Sending all processes the KILL signal..." log_info_msg "Sending all processes the KILL signal..."
killall5 -9 killall5 -9
error_value=${?} error_value=${?}
sleep ${KILLDELAY} sleep ${KILLDELAY}
if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
echo_ok log_success_msg
else else
echo_failure log_failure_msg
fi fi
;; ;;
@ -60,4 +61,6 @@ case "${1}" in
esac esac
exit 0
# End sendsignals # End sendsignals

View File

@ -5,6 +5,7 @@
# Description : Setting Linux Clock # Description : Setting Linux Clock
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -25,9 +26,9 @@
# X-LFS-Provided-By: LFS BLFS # X-LFS-Provided-By: LFS BLFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
[ -r /etc/sysconfig/clock ] && . /etc/sysconfig/clock [ -r /etc/sysconfig/clock ] && . /etc/sysconfig/clock
case "${UTC}" in case "${UTC}" in
@ -43,19 +44,23 @@ esac
case ${1} in case ${1} in
start) start)
boot_mesg "Setting system clock..." log_info_msg2 "\n" # Run by udev, make sure start on new line
log_info_msg "Setting system clock..."
hwclock --hctosys ${CLOCKPARAMS} >/dev/null hwclock --hctosys ${CLOCKPARAMS} >/dev/null
evaluate_retval evaluate_retval
;; ;;
stop) stop)
boot_mesg "Setting hardware clock..." log_info_msg "Setting hardware clock..."
hwclock --systohc ${CLOCKPARAMS} >/dev/null hwclock --systohc ${CLOCKPARAMS} >/dev/null
evaluate_retval evaluate_retval
;; ;;
*) *)
echo "Usage: ${0} {start|stop}" echo "Usage: ${0} {start|stop}"
exit 1
;; ;;
esac esac
exit 0

View File

@ -5,6 +5,7 @@
# Description : Swap Control Script # Description : Swap Control Script
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -25,17 +26,17 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
boot_mesg "Activating all swap files/partitions..." log_info_msg "Activating all swap files/partitions..."
swapon -a swapon -a
evaluate_retval evaluate_retval
;; ;;
stop) stop)
boot_mesg "Deactivating all swap files/partitions..." log_info_msg "Deactivating all swap files/partitions..."
swapoff -a swapoff -a
evaluate_retval evaluate_retval
;; ;;
@ -47,9 +48,7 @@ case "${1}" in
;; ;;
status) status)
boot_mesg "Retrieving swap status." ${INFO} log_success_msg "Retrieving swap status."
echo_ok
echo
swapon -s swapon -s
;; ;;
@ -59,4 +58,6 @@ case "${1}" in
;; ;;
esac esac
exit 0
# End swap # End swap

View File

@ -7,6 +7,7 @@
# #
# Authors : Nathan Coulson (nathan@linuxfromscratch.org) # Authors : Nathan Coulson (nathan@linuxfromscratch.org)
# Matthew Burgress (matthew@linuxfromscratch.org) # Matthew Burgress (matthew@linuxfromscratch.org)
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -27,12 +28,12 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
if [ -f "/etc/sysctl.conf" ]; then if [ -f "/etc/sysctl.conf" ]; then
boot_mesg "Setting kernel runtime parameters..." log_info_msg "Setting kernel runtime parameters..."
sysctl -q -p sysctl -q -p
evaluate_retval evaluate_retval
fi fi
@ -48,4 +49,6 @@ case "${1}" in
;; ;;
esac esac
exit 0
# End sysctl # End sysctl

View File

@ -5,6 +5,7 @@
# Description : Sysklogd loader # Description : Sysklogd loader
# #
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -25,29 +26,35 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
boot_mesg "Starting system log daemon..." log_info_msg "Starting system log daemon..."
PARMS=${SYSKLOGD_PARMS-'-m 0'} parms=${SYSKLOGD_PARMS-'-m 0'}
loadproc syslogd $PARMS start_daemon /sbin/syslogd $parms
evaluate_retval
boot_mesg "Starting kernel log daemon..." log_info_msg "Starting kernel log daemon..."
loadproc klogd start_daemon /sbin/klogd
evaluate_retval
;; ;;
stop) stop)
boot_mesg "Stopping kernel log daemon..." log_info_msg "Stopping kernel log daemon..."
killproc klogd killproc /sbin/klogd
evaluate_retval
boot_mesg "Stopping system log daemon..." log_info_msg "Stopping system log daemon..."
killproc syslogd killproc /sbin/syslogd
evaluate_retval
;; ;;
reload) reload)
boot_mesg "Reloading system log daemon config file..." log_info_msg "Reloading system log daemon config file..."
reloadproc syslogd pid=`pidofproc syslogd`
kill -HUP "${pid}"
evaluate_retval
;; ;;
restart) restart)
@ -56,15 +63,12 @@ case "${1}" in
${0} start ${0} start
;; ;;
status)
statusproc syslogd
statusproc klogd
;;
*) *)
echo "Usage: ${0} {start|stop|reload|restart|status}" echo "Usage: ${0} {start|stop|reload|restart}"
exit 1 exit 1
;; ;;
esac esac
exit 0
# End sysklogd # End sysklogd

View File

@ -25,22 +25,17 @@
# X-LFS-Provided-By: # X-LFS-Provided-By:
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
boot_mesg "Starting..." log_info_msg "Starting..."
loadproc start_daemon fully_qualified_path
;; ;;
stop) stop)
boot_mesg "Stopping..." log_info_msg "Stopping..."
killproc killproc fully_qualified_path
;;
reload)
boot_mesg "Reloading..."
reloadproc
;; ;;
restart) restart)
@ -49,14 +44,12 @@ case "${1}" in
${0} start ${0} start
;; ;;
status)
statusproc
;;
*) *)
echo "Usage: ${0} {start|stop|reload|restart|status}" echo "Usage: ${0} {start|stop|restart}"
exit 1 exit 1
;; ;;
esac esac
exit 0
# End scriptname # End scriptname

View File

@ -5,6 +5,7 @@
# Description : Udev cold-plugging script # Description : Udev cold-plugging script
# #
# Authors : Zack Winkles, Alexander E. Patrakov # Authors : Zack Winkles, Alexander E. Patrakov
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -25,19 +26,19 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
boot_mesg "Populating /dev with device nodes..." log_info_msg "Populating /dev with device nodes... "
if ! grep -q '[[:space:]]sysfs' /proc/mounts; then if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
echo_failure log_failure_msg2
boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE} msg="FAILURE:\n\nUnable to create "
boot_mesg -n " devices without a SysFS filesystem" msg="${msg}devices without a SysFS filesystem\n\n"
boot_mesg -n "\n\nAfter you press Enter, this system" msg="${msg}After you press Enter, this system "
boot_mesg -n " will be halted and powered off." msg="${msg}will be halted and powered off.\n\n"
boot_mesg -n "\n\nPress Enter to continue..." ${INFO} log_info_msg "$msg"
boot_mesg "" ${NORMAL} log_info_msg "Press Enter to continue..."
wait_for_user wait_for_user
/etc/rc.d/init.d/halt stop /etc/rc.d/init.d/halt stop
fi fi
@ -49,14 +50,15 @@ case "${1}" in
if ! mountpoint /dev > /dev/null; then if ! mountpoint /dev > /dev/null; then
mount -n -t tmpfs tmpfs /dev -o mode=755 mount -n -t tmpfs tmpfs /dev -o mode=755
fi fi
if [ ${?} != 0 ]; then if [ ${?} != 0 ]; then
echo_failure log_failure_msg2
boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE} msg="FAILURE:\n\nCannot mount a tmpfs "
boot_mesg -n " onto /dev, this system will be halted." msg="${msg}onto /dev, this system will be halted.\n\n"
boot_mesg -n "\n\nAfter you press Enter, this system" msg="${msg}After you press Enter, this system "
boot_mesg -n " will be halted and powered off." msg="${msg}will be halted and powered off.\n\n"
boot_mesg -n "\n\nPress Enter to continue..." ${INFO} log_failure_msg "$msg"
boot_mesg "" ${NORMAL} log_info_msg "Press Enter to continue..."
wait_for_user wait_for_user
/etc/rc.d/init.d/halt stop /etc/rc.d/init.d/halt stop
fi fi
@ -82,7 +84,7 @@ case "${1}" in
# Now wait for udevd to process the uevents we triggered # Now wait for udevd to process the uevents we triggered
/sbin/udevadm settle /sbin/udevadm settle
evaluate_retval log_success_msg2
;; ;;
*) *)
@ -91,4 +93,6 @@ case "${1}" in
;; ;;
esac esac
exit 0
# End udev # End udev

View File

@ -5,6 +5,7 @@
# Description : Udev cold-plugging script (retry) # Description : Udev cold-plugging script (retry)
# #
# Authors : Alexander E. Patrakov # Authors : Alexander E. Patrakov
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
@ -26,17 +27,17 @@
# X-LFS-Provided-By: LFS # X-LFS-Provided-By: LFS
### END INIT INFO ### END INIT INFO
. /lib/boot/functions . /lib/lsb/init-functions
case "${1}" in case "${1}" in
start) start)
boot_mesg "Retrying failed uevents, if any..." log_info_msg "Retrying failed uevents, if any..."
RUNDIR=$(/sbin/udevadm info --run) rundir=$(/sbin/udevadm info --run)
# From Debian: "copy the rules generated before / was mounted # From Debian: "copy the rules generated before / was mounted
# read-write": # read-write":
for file in ${RUNDIR}/tmp-rules--*; do for file in ${rundir}/tmp-rules--*; do
dest=${file##*tmp-rules--} dest=${file##*tmp-rules--}
[ "$dest" = '*' ] && break [ "$dest" = '*' ] && break
cat $file >> /etc/udev/rules.d/$dest cat $file >> /etc/udev/rules.d/$dest
@ -57,4 +58,6 @@ case "${1}" in
;; ;;
esac esac
exit 0
# End udev_retry # End udev_retry

View File

@ -0,0 +1,677 @@
#!/bin/sh
########################################################################
#
# Begin /lib/lsb/init-funtions
#
# Description : Run Level Control Functions
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# : DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
# Notes : With code based on Matthias Benkmann's simpleinit-msb
# http://winterdrache.de/linux/newboot/index.html
#
# The file should be located in /lib/lsb
#
########################################################################
# Set any needed environment variables e.g. HEADLESS
[ -r /etc/sysconfig/rc.site ] && . /etc/sysconfig/rc.site
## Environmental setup
# Setup default values for environment
umask 022
export PATH="/bin:/usr/bin:/sbin:/usr/sbin"
## Screen Dimensions
# Find current screen size
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 Cursor Position Commands, used via echo
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
# Please consult `man console_codes for more information
# under the "ECMA-48 Set Graphics Rendition" 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
BOOTLOG=/run/var/bootlog
KILLDELAY=3
################################################################################
# start_daemon() #
# Usage: start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args...] #
# #
# Purpose: This runs the specified program as a daemon #
# #
# Inputs: -f: (force) run the program even if it is already running. #
# -n nicelevel: specify a nice level. See 'man nice(1)'. #
# -p pidfile: use the specified file to determine PIDs. #
# pathname: the complete path to the specified program #
# args: additional arguments passed to the program (pathname) #
# #
# Return values (as defined by LSB exit codes): #
# 0 - program is running or service is OK #
# 1 - generic or unspecified error #
# 2 - invalid or excessive argument(s) #
# 5 - program is not installed #
################################################################################
start_daemon()
{
local force=""
local nice="0"
local pidfile=""
local pidlist=""
local retval=""
# Process arguments
while true
do
case "${1}" in
-f)
force="1"
shift 1
;;
-n)
nice="${2}"
shift 2
;;
-p)
pidfile="${2}"
shift 2
;;
-*)
return 2
;;
*)
program="${1}"
break
;;
esac
done
# Check for a valid program
if [ ! -e "${program}" ]; then return 5; fi
# Execute
if [ -z "${force}" ]; then
if [ -z "${pidfile}" ]; then
# Determine the pid by discovery
pidlist=`pidofproc "${1}"`
retval="${?}"
else
# The PID file contains the needed PIDs
# Note that by LSB requirement, the path must be given to pidofproc,
# however, it is not used by the current implementation or standard.
pidlist=`pidofproc -p "${pidfile}" "${1}"`
retval="${?}"
fi
# Return a value ONLY
# It is the init script's (or distribution's functions) responsibilty
# to log messages!
case "${retval}" in
0)
# Program is already running correctly, this is a
# succesful start.
return 0
;;
1)
# Program is not running, but an invalid pid file exists
# remove the pid file and continue
rm -f "${pidfile}"
;;
3)
# Program is not running and no pidfile exists
# do nothing here, let start_deamon continue.
;;
*)
# Others as returned by status values shall not be interpreted
# and returned as an unspecified error.
return 1
;;
esac
fi
# Do the start!
nice -n "${nice}" "${@}"
}
################################################################################
# killproc() #
# Usage: killproc [-p pidfile] pathname [signal] #
# #
# Purpose: Send control signals to running processes #
# #
# Inputs: -p pidfile, uses the specified pidfile #
# pathname, pathname to the specified program #
# signal, send this signal to pathname #
# #
# Return values (as defined by LSB exit codes): #
# 0 - program (pathname) has stopped/is already stopped or a #
# running program has been sent specified signal and stopped #
# successfully #
# 1 - generic or unspecified error #
# 2 - invalid or excessive argument(s) #
# 5 - program is not installed #
# 7 - program is not running and a signal was supplied #
################################################################################
killproc()
{
local pidfile
local program
local prefix
local progname
local signal="-TERM"
local fallback="-KILL"
local nosig
local pidlist
local retval
local pid
local delay="30"
local piddead
local dtime
# Process arguments
while true; do
case "${1}" in
-p)
pidfile="${2}"
shift 2
;;
*)
program="${1}"
if [ -n "${2}" ]; then
signal="${2}"
fallback=""
else
nosig=1
fi
# Error on additional arguments
if [ -n "${3}" ]; then
return 2
else
break
fi
;;
esac
done
# Check for a valid program
if [ ! -e "${program}" ]; then return 5; fi
# Check for a valid signal
check_signal "${signal}"
if [ "${?}" -ne "0" ]; then return 2; fi
# Get a list of pids
if [ -z "${pidfile}" ]; then
# determine the pid by discovery
pidlist=`pidofproc "${1}"`
retval="${?}"
else
# The PID file contains the needed PIDs
# Note that by LSB requirement, the path must be given to pidofproc,
# however, it is not used by the current implementation or standard.
pidlist=`pidofproc -p "${pidfile}" "${1}"`
retval="${?}"
fi
# Return a value ONLY
# It is the init script's (or distribution's functions) responsibilty
# to log messages!
case "${retval}" in
0)
# Program is running correctly
# Do nothing here, let killproc continue.
;;
1)
# Program is not running, but an invalid pid file exists
# Remove the pid file.
rm -f "${pidfile}"
# This is only a success if no signal was passed.
if [ -n "${nosig}" ]; then
return 0
else
return 7
fi
;;
3)
# Program is not running and no pidfile exists
# This is only a success if no signal was passed.
if [ -n "${nosig}" ]; then
return 0
else
return 7
fi
;;
*)
# Others as returned by status values shall not be interpreted
# and returned as an unspecified error.
return 1
;;
esac
# Perform different actions for exit signals and control signals
check_sig_type "${signal}"
if [ "${?}" -eq "0" ]; then # Signal is used to terminate the program
# Account for empty pidlist (pid file still exists and no
# signal was given)
if [ "${pidlist}" != "" ]; then
# Kill the list of pids
for pid in ${pidlist}; do
kill -0 "${pid}" 2> /dev/null
if [ "${?}" -ne "0" ]; then
# Process is dead, continue to next and assume all is well
continue
else
kill "${signal}" "${pid}" 2> /dev/null
# Wait up to ${delay}/10 seconds to for "${pid}" to
# terminate in 10ths of a second
while [ "${delay}" -ne "0" ]; do
kill -0 "${pid}" 2> /dev/null || piddead="1"
if [ "${piddead}" = "1" ]; then break; fi
sleep 0.1
delay="$(( ${delay} - 1 ))"
done
# If a fallback is set, and program is still running, then
# use the fallback
if [ -n "${fallback}" -a "${piddead}" != "1" ]; then
kill "${fallback}" "${pid}" 2> /dev/null
sleep 1
# Check again, and fail if still running
kill -0 "${pid}" 2> /dev/null && return 1
else
# just check one last time and if still alive, fail
sleep 1
kill -0 "${pid}" 2> /dev/null && return 1
fi
fi
done
fi
# Check for and remove stale PID files.
if [ -z "${pidfile}" ]; then
# Find the basename of $program
prefix=`echo "${program}" | sed 's/[^/]*$//'`
progname=`echo "${program}" | sed "s@${prefix}@@"`
if [ -e "/var/run/${progname}.pid" ]; then
rm -f "/var/run/${progname}.pid" 2> /dev/null
fi
else
if [ -e "${pidfile}" ]; then rm -f "${pidfile}" 2> /dev/null; fi
fi
# For signals that do not expect a program to exit, simply
# let kill do it's job, and evaluate kills return for value
else # check_sig_type - signal is not used to terminate program
for pid in ${pidlist}; do
kill "${signal}" "${pid}"
if [ "${?}" -ne "0" ]; then return 1; fi
done
fi
}
################################################################################
# pidofproc() #
# Usage: 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 #
# #
# Return values (as defined by LSB status codes): #
# 0 - Success (PIDs to stdout) #
# 1 - Program is dead, PID file still exists (remaining PIDs output) #
# 3 - Program is not running (no output) #
################################################################################
pidofproc()
{
local pidfile
local program
local prefix
local progname
local pidlist
local lpids
local exitstatus="0"
# Process arguments
while true; do
case "${1}" in
-p)
pidfile="${2}"
shift 2
;;
*)
program="${1}"
if [ -n "${2}" ]; then
# Too many arguments
# Since this is status, return unknown
return 4
else
break
fi
;;
esac
done
# If a PID file is not specified, try and find one.
if [ -z "${pidfile}" ]; then
# Get the program's basename
prefix=`echo "${program}" | sed 's/[^/]*$//'`
progname=`echo "${program}" | sed "s@${prefix}@@"`
# If a PID file exists with that name, assume that is it.
if [ -e "/var/run/${progname}.pid" ]; then
pidfile="/var/run/${progname}.pid"
fi
fi
# If a PID file is set and exists, use it.
if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
# Use the value in the first line of the pidfile
pidlist=`/bin/head -n1 "${pidfile}"`
# This can optionally be written as 'sed 1q' to repalce 'head -n1'
# should LFS move /bin/head to /usr/bin/head
else
# Use pidof
pidlist=`pidof "${program}"`
fi
# Figure out if all listed PIDs are running.
for pid in ${pidlist}; do
kill -0 ${pid} 2> /dev/null
if [ "${?}" -eq "0" ]; then
lpids="${pids}${pid} "
else
exitstatus="1"
fi
done
if [ -z "${lpids}" -a ! -f "${pidfile}" ]; then
return 3
else
echo "${lpids}"
return "${exitstatus}"
fi
}
################################################################################
# timespec() #
# #
# Purpose: An internal utility function to format a timestamp #
# a boot log file. Sets the STAMP variable. #
# #
# Return value: Not used #
################################################################################
timespec()
{
STAMP="$(echo `date +"%b %d %T %:z"` `hostname`) "
return 0
}
################################################################################
# log_success_msg() #
# Usage: log_success_msg ["message"] #
# #
# Purpose: Print a successful status message to the screen and #
# a boot log file. #
# #
# Inputs: $@ - Message #
# #
# Return values: Not used #
################################################################################
log_success_msg()
{
echo -n -e "${@}"
echo -e "${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"
timespec
echo -e "${STAMP} ${@} OK" >> ${BOOTLOG}
return 0
}
log_success_msg2()
{
echo -n -e "${@}"
echo -e "${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"
echo " OK" >> ${BOOTLOG}
return 0
}
################################################################################
# log_failure_msg() #
# Usage: log_failure_msg ["message"] #
# #
# Purpose: Print a failure status message to the screen and #
# a boot log file. #
# #
# Inputs: $@ - Message #
# #
# Return values: Not used #
################################################################################
log_failure_msg()
{
echo -n -e "${@}"
echo -e "${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
timespec
echo -e "${STAMP} ${@} FAIL" >> ${BOOTLOG}
return 0
}
log_failure_msg2()
{
echo -n -e "${@}"
echo -e "${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
echo "FAIL" >> ${BOOTLOG}
return 0
}
################################################################################
# log_warning_msg() #
# Usage: log_warning_msg ["message"] #
# #
# Purpose: Print a warning status message to the screen and #
# a boot log file. #
# #
# Return values: Not used #
################################################################################
log_warning_msg()
{
echo -n -e "${@}"
echo -e "${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"
timespec
echo -e "${STAMP} ${@} WARN" >> ${BOOTLOG}
return 0
}
################################################################################
# log_info_msg() #
# Usage: log_info_msg message #
# #
# Purpose: Print an information message to the screen and #
# a boot log file. Does not print a trailing newline character. #
# #
# Return values: Not used #
################################################################################
log_info_msg()
{
echo -n -e "${@}"
timespec
echo -n -e "${STAMP} ${@}" >> ${BOOTLOG}
return 0
}
log_info_msg2()
{
echo -n -e "${@}"
echo -n -e "${@}" >> ${BOOTLOG}
return 0
}
################################################################################
# evaluate_retval() #
# Usage: Evaluate a return value and print success or failyure as appropriate #
# #
# Purpose: Convenience function to terminate an info message #
# #
# Return values: Not used #
################################################################################
evaluate_retval()
{
local error_value="${?}"
if [ ${error_value} = 0 ]; then
log_success_msg2
else
log_failure_msg2
fi
}
################################################################################
# check_signal() #
# Usage: check_signal [ -{signal} | {signal} ] #
# #
# Purpose: Check for a valid signal. This is not defined by any LSB draft, #
# however, it is required to check the signals to determine if the #
# signals chosen are invalid arguments to the other functions. #
# #
# Inputs: Accepts a single string value in the form or -{signal} or {signal} #
# #
# Return values: #
# 0 - Success (signal is valid #
# 1 - Signal is not valid #
################################################################################
check_signal()
{
local valsig
# Add error handling for invalid signals
valsig="-ALRM -HUP -INT -KILL -PIPE -POLL -PROF -TERM -USR1 -USR2"
valsig="${valsig} -VTALRM -STKFLT -PWR -WINCH -CHLD -URG -TSTP -TTIN"
valsig="${valsig} -TTOU -STOP -CONT -ABRT -FPE -ILL -QUIT -SEGV -TRAP"
valsig="${valsig} -SYS -EMT -BUS -XCPU -XFSZ -0 -1 -2 -3 -4 -5 -6 -8 -9"
valsig="${valsig} -11 -13 -14 -15"
echo "${valsig}" | grep -- " ${1} " > /dev/null
if [ "${?}" -eq "0" ]; then
return 0
else
return 1
fi
}
################################################################################
# check_sig_type() #
# Usage: check_signal [ -{signal} | {signal} ] #
# #
# Purpose: Check if signal is a program termination signal or a control signal #
# This is not defined by any LSB draft, however, it is required to #
# check the signals to determine if they are intended to end a #
# program or simply to control it. #
# #
# Inputs: Accepts a single string value in the form or -{signal} or {signal} #
# #
# Return values: #
# 0 - Signal is used for program termination #
# 1 - Signal is used for program control #
################################################################################
check_sig_type()
{
local valsig
# The list of termination signals (limited to generally used items)
valsig="-ALRM -INT -KILL -TERM -PWR -STOP -ABRT -QUIT -2 -3 -6 -9 -14 -15"
echo "${valsig}" | grep -- " ${1} " > /dev/null
if [ "${?}" -eq "0" ]; then
return 0
else
return 1
fi
}
################################################################################
# wait_for_user() #
# #
# Purpose: Wait for the user to respond if not a headless system #
# #
################################################################################
wait_for_user()
{
# Wait for the user by default
[ "${HEADLESS=0}" = "0" ] && read ENTER
return 0
}
# End /lib/lsb/init-functions

View File

@ -0,0 +1,89 @@
#!/bin/sh
########################################################################
# Begin /lib/services/ipv4-static
#
# Description : IPV4 Static Boot Script
#
# Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
. /lib/lsb/init-functions
. ${IFCONFIG}
if [ -z "${IP}" ]; then
log_failure_msg "\nIP variable missing from ${IFCONFIG}, cannot continue."
exit 1
fi
if [ -z "${PREFIX}" -a -z "${PEER}" ]; then
log_warning_msg "\nPREFIX variable missing from ${IFCONFIG}, assuming 24."
PREFIX=24
args="${args} ${IP}/${PREFIX}"
elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then
log_failure_msg "\nPREFIX and PEER both specified in ${IFCONFIG}, cannot continue."
exit 1
elif [ -n "${PREFIX}" ]; then
args="${args} ${IP}/${PREFIX}"
elif [ -n "${PEER}" ]; then
args="${args} ${IP} peer ${PEER}"
fi
if [ -n "${BROADCAST}" ]; then
args="${args} broadcast ${BROADCAST}"
fi
case "${2}" in
up)
if [ "$(ip addr show ${1} | grep ${IP})" == "" ]; then
log_info_msg2 "\n" # Terminate the previous message
log_info_msg "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
log_warning_msg "\nGateway already setup; skipping."
else
log_info_msg "Setting up default gateway..."
ip route add default via ${GATEWAY} dev ${1}
evaluate_retval
fi
fi
else
msg="Cannot add IPv4 address ${IP} to ${1}. Already present."
log_warning_msg "$msg"
fi
;;
down)
if [ "$(ip addr show ${1} | grep ${IP})" != "" ]; then
log_info_msg "Removing IPv4 address ${IP} from the ${1} interface..."
ip addr del ${args} dev ${1}
evaluate_retval
fi
if [ -n "${GATEWAY}" ]; then
# Only remove the gateway if ther are no remaining ipv4 addresses
if [ "$(ip addr show ${1} | grep 'inet ')" != "" ]; then
log_info_msg "Removing default gateway..."
ip route del default
evaluate_retval
fi
fi
;;
*)
echo "Usage: ${0} [interface] {up|down}"
exit 1
;;
esac
# End /lib/services/ipv4-static

View File

@ -1,17 +1,18 @@
#!/bin/sh #!/bin/sh
######################################################################## ########################################################################
# Begin /lib/boot/ipv4-static-route # Begin /lib/services/ipv4-static-route
# #
# Description : IPV4 Static Route Script # Description : IPV4 Static Route Script
# #
# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org # Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# #
# Version : LFS 7.0 # Version : LFS 7.0
# #
######################################################################## ########################################################################
. /lib/boot/functions . /lib/lsb/init-functions
. ${IFCONFIG} . ${IFCONFIG}
case "${TYPE}" in case "${TYPE}" in
@ -37,22 +38,19 @@ case "${TYPE}" in
;; ;;
(*) (*)
boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE} log_failure_msg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue."
echo_failure
exit 1 exit 1
;; ;;
esac esac
if [ -n "${need_ip}" ]; then if [ -n "${need_ip}" ]; then
if [ -z "${IP}" ]; then if [ -z "${IP}" ]; then
boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} log_failure_msg "IP variable missing from ${IFCONFIG}, cannot continue."
echo_failure
exit 1 exit 1
fi fi
if [ -z "${PREFIX}" ]; then if [ -z "${PREFIX}" ]; then
boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} log_failure_msg "PREFIX variable missing from ${IFCONFIG}, cannot continue."
echo_failure
exit 1 exit 1
fi fi
@ -62,8 +60,7 @@ fi
if [ -n "${need_gateway}" ]; then if [ -n "${need_gateway}" ]; then
if [ -z "${GATEWAY}" ]; then if [ -z "${GATEWAY}" ]; then
boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} log_failure_msg "GATEWAY variable missing from ${IFCONFIG}, cannot continue."
echo_failure
exit 1 exit 1
fi fi
args="${args} via ${GATEWAY}" args="${args} via ${GATEWAY}"
@ -75,13 +72,13 @@ fi
case "${2}" in case "${2}" in
up) up)
boot_mesg "Adding '${desc}' route to the ${1} interface..." log_info_msg "Adding '${desc}' route to the ${1} interface..."
ip route add ${args} dev ${1} ip route add ${args} dev ${1}
evaluate_retval evaluate_retval
;; ;;
down) down)
boot_mesg "Removing '${desc}' route from the ${1} interface..." log_info_msg "Removing '${desc}' route from the ${1} interface..."
ip route del ${args} dev ${1} ip route del ${args} dev ${1}
evaluate_retval evaluate_retval
;; ;;
@ -92,4 +89,4 @@ case "${2}" in
;; ;;
esac esac
# End /bib/boot/ipv4-static-route # End /lib/services/ipv4-static-route

98
bootscripts/lfs/sbin/ifdown Executable file
View File

@ -0,0 +1,98 @@
#!/bin/bash
########################################################################
# 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 : LFS 7.0
#
# Notes : the IFCONFIG variable is passed to the scripts found
# in the /lib/services directory, to indicate what file the
# service should source to get interface specifications.
#
########################################################################
RELEASE="7.0"
USAGE="Usage: $0 [ -hV ] [--help] [--version] interface"
VERSTR="LFS ifdown, version ${RELEASE}"
while [ $# -gt 0 ]; do
case "$1" in
--help | -h) help="y"; break ;;
--version | -V) echo "${VERSTR}"; exit 0 ;;
-*) echo "ifup: ${1}: invalid option" >&2
echo "${USAGE}" >& 2
exit 2 ;;
*) break ;;
esac
done
if [ -n "$help" ]; then
echo "${VERSTR}"
echo "${USAGE}"
echo
cat << HERE_EOF
ifdown is used to bring down a network interface. The interface
parameter, e.g. eth0 or eth0:2, must match the trailing part of the
interface specifications file, e.g. /etc/sysconfig/ifconfig.eth0:2.
HERE_EOF
exit 0
fi
file=/etc/sysconfig/ifconfig.${1}
# Skip backup files
[ "${file}" = "${file%""~""}" ] || exit 0
. /lib/lsb/init-functions
if [ ! -r "${file}" ]; then
log_warning_msg "${file} is missing or cannot be accessed."
exit 1
fi
. ${file}
if [ "$IFACE" = "" ]; then
log_failure_msg "${file} does not define an interface [IFACE]."
exit 1
fi
# This will run the service script, if SERVICE is set
if [ -n "${SERVICE}" -a -x "/lib/services/${SERVICE}" ]; then
if ip link show ${IFACE} > /dev/null 2>&1; then
IFCONFIG=${file} /lib/services/${SERVICE} ${IFACE} down
else
log_warning_msg "Interface ${1} doesn't exist."
echo_warning
fi
else
MSG="Unable to process ${file}. Either "
MSG="${MSG}the SERVICE variable was not set"
MSG="${MSG}or the specified service cannot be executed."
log_failure_msg "$MSG"
exit 1
fi
link_status=`ip link show ${IFACE} 2>/dev/null`
if [ -n "${link_status}" ]; then
if [ "$(echo "${link_status}" | grep UP)" != "" ]; then
if [ "$(ip addr show ${IFACE} | grep 'inet ')" != "" ]; then
log_info_msg "Bringing down the ${IFACE} interface..."
ip link set ${IFACE} down
evaluate_retval
fi
fi
fi
# End /sbin/ifdown

110
bootscripts/lfs/sbin/ifup Executable file
View File

@ -0,0 +1,110 @@
#!/bin/sh
########################################################################
# 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 : LFS 7.0
#
# Notes : The IFCONFIG variable is passed to the SERVICE script
# in the /lib/services directory, to indicate what file the
# service should source to get interface specifications.
#
########################################################################
RELEASE="7.0"
USAGE="Usage: $0 [ -hV ] [--help] [--version] interface"
VERSTR="LFS ifup, version ${RELEASE}"
while [ $# -gt 0 ]; do
case "$1" in
--help | -h) help="y"; break ;;
--version | -V) echo "${VERSTR}"; exit 0 ;;
-*) echo "ifup: ${1}: invalid option" >&2
echo "${USAGE}" >& 2
exit 2 ;;
*) break ;;
esac
done
if [ -n "$help" ]; then
echo "${VERSTR}"
echo "${USAGE}"
echo
cat << HERE_EOF
ifup is used to bring up a network interface. The interface
parameter, e.g. eth0 or eth0:2, must match the trailing part of the
interface specifications file, e.g. /etc/sysconfig/ifconfig.eth0:2.
HERE_EOF
exit 0
fi
file=/etc/sysconfig/ifconfig.${1}
# Skip backup files
[ "${file}" = "${file%""~""}" ] || exit 0
. /lib/lsb/init-functions
log_info_msg "Bringing up the ${1} interface... "
if [ ! -r "${file}" ]; then
log_warning_msg "\n${file} is missing or cannot be accessed."
exit 1
fi
. $file
if [ "$IFACE" = "" ]; then
log_failure_msg "\n${file} does not define an interface [IFACE]."
exit 1
fi
# Do not process this service if started by boot, and ONBOOT
# is not set to yes
if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
log_info_msg2 "skipped\n"
exit 0
fi
if [ -n "${SERVICE}" -a -x "/lib/services/${SERVICE}" ]; then
if [ -z "${CHECK_LINK}" -o \
"${CHECK_LINK}" = "y" -o \
"${CHECK_LINK}" = "yes" -o \
"${CHECK_LINK}" = "1" ]; then
# Bring up the interface
if ip link show ${IFACE} > /dev/null 2>&1; then
link_status=`ip link show ${IFACE}`
if [ -n "${link_status}" ]; then
if ! echo "${link_status}" | grep -q UP; then
ip link set ${IFACE} up
fi
fi
else
log_warning_msg "\nInterface ${IFACE} doesn't exist."
fi
fi
IFCONFIG=${file} /lib/services/${SERVICE} ${IFACE} up
else
MSG="\nUnable to process ${file}. Either "
MSG="${MSG}the SERVICE variable was not set "
MSG="${MSG}or the specified service cannot be executed."
log_failure_msg "$MSG"
exit 1
fi
# End /sbin/ifup

108
bootscripts/lfs/sbin/ifup.8 Normal file
View File

@ -0,0 +1,108 @@
ifup(8) ifup(8)
NAME
ifup - bring a network interface up
ifdown - take a network interface down
SYNOPSIS
ifup IFACE
ifup -h|--help
ifup -V|--version
ifdown IFACE
ifdown -h|--help
ifdown -V|--version
DESCRIPTION
The ifup and ifdown commands may be used to configure
(or, respectively, deconfigure) a network interface based
on interface definitions in the file
/etc/sysconfig/ifconfig.IFACE.
OPTIONS
A summary of options is included below.
-h, --help
Show summary of options.
-V, --version
Show version information.
EXAMPLE
ifup eth0
Bring up the interface defined in the file
/etc/sysconfig/ifconfig.eth0
ifdown eth0:2
Bring down the interface defined in the file
/etc/sysconfig/ifconfig.eth0:2
NOTES
The program does not configure network interfaces direct-
ly. It runs scripts defined by the SERVICE variable in
the network configuration file.
The configuration files must have the following environ-
ment variables set:
IFACE - The interface to configure, e.g. eth0. It must
be available in /sys/class/net.
SERVICE - The service script to run to bring up the inter-
face. Standard services are ipv4-static and
ipv4-static-route. Other services such as dhcp
may be installed.
ONBOOT - If set to 'yes', the specified interface is
configured by the netowrk boot script.
Other paramters that are service specific include:
ipv4-static
IP - The IP address of the interface,
e.g. 192.168.1.2.
PREFIX - The number of bits that specify the network
number of the interface, e.g., 24.
GATEWAY - The default IP address to use for routing
if the destination IP address is not in a
static route or on a local network, e.g.,
192.168.1.1. For secondary IP addresses on
an interface, this parameter should not be
specified.
BROADCAST - The brodcast address for this interface,
e.g 192.168.1.255.
ipv4-static-route
TYPE - The type of route, typically 'default',
'network', 'or host'.
IP - The IP address for a network or host, if thei
TYPE is not 'default'.
PREFIX - The prefix for the associated IP address.
GATEWAY - The IP address for a network route.
SOURCE - The source IP address to prefer when sending
to the destinations covered by the specified
route. (optional)
FILES
/etc/sysconfig/ifconfig.*
definitions of network interfaces
AUTHORS
The ifup/ifdown suite was written by Nathan Coulson
<nathan@linuxfromscratch.org> and Kevin P. Fleming
<kpfleming@linuxfromscratch.org>
and updated by Bruce Dubbs <bdubbs@linuxfromscratch>.
SEE ALSO
ip(8).
IFUP/IFDOWN 18 Sep 2011 ifup(8)

View File

@ -8,21 +8,24 @@
# Version : 00.00 # Version : 00.00
# #
# Notes : The syntax of this file is as follows: # Notes : The syntax of this file is as follows:
# if type is equal to "file" or "dir" # if type is equal to "file" or "dir"
# <filename> <type> <permissions> <user> <group> # <filename> <type> <permissions> <user> <group>
# if type is equal to "dev" # if type is equal to "dev"
# <filename> <type> <permissions> <user> <group> <devtype> <major> <minor> # <filename> <type> <permissions> <user> <group> <devtype>
# <major> <minor>
# #
# <filename> is the name of the file which is to be created # <filename> is the name of the file which is to be created
# <type> is either file, dir, or dev. # <type> is either file, dir, or dev.
# file creates a new file # file creates a new file
# dir creates a new directory # dir creates a new directory
# dev creates a new device # dev creates a new device
# <devtype> is either block, char or pipe # <devtype> is either block, char or pipe
# block creates a block device # block creates a block device
# char creates a character deivce # char creates a character deivce
# pipe creates a pipe, this will ignore the <major> and <minor> fields # pipe creates a pipe, this will ignore the <major> and
# <major> and <minor> are the major and minor numbers used for the device. # <minor> fields
# <major> and <minor> are the major and minor numbers used for
# the device.
######################################################################## ########################################################################
# End /etc/sysconfig/createfiles # End /etc/sysconfig/createfiles

View File

@ -1,66 +0,0 @@
#!/bin/sh
########################################################################
# 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 : LFS 7.0
#
# Notes : the IFCONFIG variable is passed to the scripts found
# in the /lib/boot directory, to indicate what file the
# service should source to get environmental variables.
#
########################################################################
file=/etc/sysconfig/ifconfig.${1}
# Skip backup files
[ "${file}" = "${file%""~""}" ] || exit 0
. /lib/boot/functions
if [ ! -r "${file}" ]; then
boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
echo_warning
exit 1
fi
. ${file}
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
link_status=`ip link show ${IFACE} 2>/dev/null`
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 /sbin/ifdown

View File

@ -1,82 +0,0 @@
#!/bin/sh
########################################################################
# 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 : LFS 7.0
#
# 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.
#
########################################################################
file=/etc/sysconfig/ifconfig.${1}
# Skip backup files
[ "${file}" = "${file%""~""}" ] || exit 0
. /lib/boot/functions
boot_mesg "Bringing up the ${1} interface..."
boot_mesg_flush
if [ ! -r "${file}" ]; then
boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
echo_warning
exit 1
fi
. $file
if [ "$IFACE" = "" ]; then
boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE}
echo_failure
exit 1
fi
# 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
if [ -n "${SERVICE}" -a -x "/lib/boot/${SERVICE}" ]; then
if [ -z "${CHECK_LINK}" -o \
"${CHECK_LINK}" = "y" -o \
"${CHECK_LINK}" = "yes" -o \
"${CHECK_LINK}" = "1" ]; then
# Bring up the interface
if ip link show ${IFACE} > /dev/null 2>&1; then
link_status=`ip link show ${IFACE}`
if [ -n "${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 /sbin/ifup

View File

@ -1,83 +0,0 @@
#!/bin/sh
########################################################################
# Begin /lib/boot/ipv4-static
#
# Description : IPV4 Static Boot Script
#
# Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
. /lib/boot/functions
. ${IFCONFIG}
if [ -z "${IP}" ]; then
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}"
elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then
boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE}
echo_failure
exit 1
elif [ -n "${PREFIX}" ]; then
args="${args} ${IP}/${PREFIX}"
elif [ -n "${PEER}" ]; then
args="${args} ${IP} peer ${PEER}"
fi
if [ -n "${BROADCAST}" ]; then
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
;;
esac
# End /lib/boot/ipv4-static

View File

@ -7,7 +7,7 @@
# #
# Version : 00.00 # Version : 00.00
# #
# Notes : # Notes : Not used by LFS, but present for BLFS compatibility
# #
######################################################################## ########################################################################

View File

@ -0,0 +1,61 @@
# rc.site
# Optional parameters for boot scripts.
# Distro Information
DISTRO="Linux From Scratch" # The distro name
DISTRO_CONTACT="lfs-dev@linuxfromscratch.org" # Bug report address
DISTRO_MINI="LFS" # Short name used in filenames for distro config
# Define custom colors used in messages printed to the screen
# These values, if specified here, override the defaults
#BRACKET="\\033[1;34m" # Blue
#FAILURE="\\033[1;31m" # Red
#INFO="\\033[1;36m" # Cyan
#NORMAL="\\033[0;39m" # Grey
#SUCCESS="\\033[1;32m" # Green
#WARNING="\\033[1;33m" # Yellow
# Interactive startup
#IPROMPT="yes" # Whether to display the interactive boot promp
itime="10" # The ammount of time (in seconds) to display the prompt
# The total length of the distro welcome string, without escape codes
wlen=$(echo "Welcome to ${DISTRO}" | wc -c )
welcome_message="Welcome to ${INFO}${DISTRO}${NORMAL}"
# The total length of the interactive string, without escape codes
ilen=$(echo "Press 'I' to enter interactive startup" | wc -c )
i_message="Press '${FAILURE}I${NORMAL}' to enter interactive startup"
# Set scripts to skip the file system check on reboot
#FASTBOOT=yes
# Skip reading from the console
#HEADLESS=yes
# Skip cleaning /tmp
#SKIPTMPCLEAN=yes
# For setclock
#UTC=1
#CLOCKPARAMS=
# For consolelog
#LOGLEVEL=5
# For network
#HOSTNAME=mylfs
# Delay between TERM and KILL signals at shutdown
#KILLDELAY=3
# Optional sysklogd parameters
#SYSKLOGD_PARMS="-m 0"
# Console parameters
#UNICODE=1
#KEYMAP="de-latin1"
#KEYMAP_CORRECTIONS="euro2"
#FONT="lat0-16 -m 8859-15"
#LEGACY_CHARSET=

View File

@ -36,6 +36,46 @@
</listitem> </listitem>
--> -->
<listitem>
<para>2011-09-18</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Review and update recent changes to bootscripts.</para>
<itemizedlist>
<listitem><para>Rename /etc/sysconfig/init_params to /etc/sysconfig/rc.site.</para>
</listitem>
<listitem><para>Move network services to /lib/services.</para></listitem>
<listitem><para>Move init-functions to /lib/lsb.</para></listitem>
<listitem><para>Make /lib/lsb a symlink to /lib/services.</para></listitem>
<listitem><para>Create convenience symlink /etc/init.d->/etc/rc.d/init.d
</para></listitem>
<listitem><para>Add help and man pages to ifup/ifdown.
</para></listitem>
<listitem><para>Append /run/var/bootlog to /var/log/boot.log at the end of
the boot sequence.</para></listitem>
<listitem><para>Add capability to step through the boot scripts at boot time.
</para></listitem>
<listitem><para>Optionally allow environment variables in sysconfig directory's
console, network, and clock files to be placed in rc.site.
</para></listitem>
<listitem><para>Add an optional FASTBOOT parameter to set /fastboot when rebooting.
</para></listitem>
</itemizedlist>
</listitem>
<listitem>
<para>[bdubbs] - Remove a minor warning message from udev that is triggered
by the udev_retry boot script.</para>
</listitem>
<listitem>
<para>[bdubbs] - Add SKIPTMPCLEAN as an optional parameter to skip cleaning
/tmp at boot time.</para>
</listitem>
<listitem>
<para>[bdubbs] - Add a page to Chapter 7 documenting rc.site.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem> <listitem>
<para>2011-09-04</para> <para>2011-09-04</para>
<itemizedlist> <itemizedlist>

View File

@ -52,10 +52,10 @@ cd ../binutils-build</userinput></screen>
<screen><userinput remap="configure">CC="$LFS_TGT-gcc -B/tools/lib/" \ <screen><userinput remap="configure">CC="$LFS_TGT-gcc -B/tools/lib/" \
AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \ AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
<!-- ../binutils-&binutils-version;/configure - -prefix=/tools \ -->
../binutils-&binutils-dir;/configure --prefix=/tools \ ../binutils-&binutils-dir;/configure --prefix=/tools \
--disable-nls --with-lib-path=/tools/lib</userinput></screen> --disable-nls --with-lib-path=/tools/lib</userinput></screen>
<!-- ../binutils-&binutils-version;/configure - -prefix=/tools \ -->
<variablelist> <variablelist>
<title>The meaning of the new configure options:</title> <title>The meaning of the new configure options:</title>

View File

@ -41,6 +41,12 @@
<sect2 role="installation"> <sect2 role="installation">
<title>Installation of Udev</title> <title>Installation of Udev</title>
<para>Optionally remove an unneeded warning message that shows up in this
version of udev at boot time.</para>
<screen><userinput remap="pre">sed -i -e '/deprecated/d' udev/udevadm-trigger.c</userinput></screen>
<para>The udev-config tarball contains LFS-specific files used to configure <para>The udev-config tarball contains LFS-specific files used to configure
Udev. Unpack it into the Udev source directory:</para> Udev. Unpack it into the Udev source directory:</para>

View File

@ -58,7 +58,8 @@
ifup, localnet, modules, mountfs, mountkernfs, network, rc, reboot, ifup, localnet, modules, mountfs, mountkernfs, network, rc, reboot,
sendsignals, setclock, static, swap, sysctl, sysklogd, template, sendsignals, setclock, static, swap, sysctl, sysklogd, template,
udev, and udev_retry</seg> udev, and udev_retry</seg>
<seg>/etc/rc.d, /etc/sysconfig, /lib/boot</seg> <seg>/etc/rc.d, /etc/init.d (symbolic link), /etc/sysconfig,
/lib/services, /lib/lsb (symbolic link)</seg>
</seglistitem> </seglistitem>
</segmentedlist> </segmentedlist>

View File

@ -22,6 +22,7 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="site.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>

View File

@ -157,7 +157,7 @@ EOF</userinput></screen>
<para>The <envar>SERVICE</envar> variable defines the method used for <para>The <envar>SERVICE</envar> variable defines the method used for
obtaining the IP address. The LFS-Bootscripts package has a modular IP obtaining the IP address. The LFS-Bootscripts package has a modular IP
assignment format, and creating additional files in the <filename assignment format, and creating additional files in the <filename
class="directory">/lib/boot/</filename> directory allows other IP class="directory">/lib/services/</filename> directory allows other IP
assignment methods. This is commonly used for Dynamic Host Configuration assignment methods. This is commonly used for Dynamic Host Configuration
Protocol (DHCP), which is addressed in the BLFS book.</para> Protocol (DHCP), which is addressed in the BLFS book.</para>

View File

@ -63,6 +63,6 @@ EOF</userinput></screen>
time zones, UTC, and the <envar>TZ</envar> environment variable.</para> time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
<note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set <note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set
in the <filename>/etc/sysconfig/init_params</filename> file.</para></note> in the <filename>/etc/sysconfig/rc.site</filename> file.</para></note>
</sect1> </sect1>

35
chapter07/site.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
<!ENTITY site SYSTEM "../appendices/rc.site.script">
%general-entities;
]>
<sect1 id="ch-scripts-site">
<?dbhtml filename="site.html"?>
<title>The rc.site File</title>
<indexterm zone="ch-scripts-site">
<primary sortas="a-rc.site">rc.site</primary>
</indexterm>
<para>The optional <filename>/etc/sysconfig/rc.site</filename> file contains
settings that are automatically set for each boot script. It can alternatively
set the values specified in the <filename>hostname</filename>,
<filename>console</filename>, and <filename>clock</filename> files in the
<filename class='directory'>/etc/sysconfig/</filename> directory. If the
associated variables are present in both these separate files and
<filename>rc.site</filename>, the values in the script specific files have
precedence. </para>
<para><filename>rc.site</filename> also contains parameters that can
customize other aspects of the boot process. Setting the IPROMPT variable
will enable selective running of bootscripts. Other options are described
in the file comments. The default version of the file is as follows:</para>
<screen>&site;</screen>
</sect1>

View File

@ -19,8 +19,8 @@
<command>syslogd</command> program with the <parameter>-m 0</parameter> <command>syslogd</command> program with the <parameter>-m 0</parameter>
option. This option turns off the periodic timestamp mark that option. This option turns off the periodic timestamp mark that
<command>syslogd</command> writes to the log files every 20 minutes by <command>syslogd</command> writes to the log files every 20 minutes by
default. If you want to turn on this periodic timestamp mark, create or edit default. If you want to turn on this periodic timestamp mark, edit
<filename>/etc/sysconfig/init_params</filename> and define the variable <filename>/etc/sysconfig/rc.site</filename> and define the variable
SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters, SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
set the variable to a null value:</para> set the variable to a null value:</para>

View File

@ -59,7 +59,7 @@
id:3:initdefault: id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc sysinit si::sysinit:/etc/rc.d/init.d/rc S
l0:0:wait:/etc/rc.d/init.d/rc 0 l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1 l1:S1:wait:/etc/rc.d/init.d/rc 1
@ -93,7 +93,7 @@ EOF</userinput></screen>
mark is specified by the initdefault value.</para> mark is specified by the initdefault value.</para>
<para>As a convenience, the <command>rc</command> script reads a library of <para>As a convenience, the <command>rc</command> script reads a library of
functions in <filename class="directory">/lib/boot/functions</filename>. functions in <filename class="directory">/lib/lsb/init-functions</filename>.
This library also reads an optional configuration file, This library also reads an optional configuration file,
<filename>/etc/sysconfig/init_params</filename>. Any of the system <filename>/etc/sysconfig/init_params</filename>. Any of the system
configuration file parameters described in subsequent sections can be configuration file parameters described in subsequent sections can be

View File

@ -1,5 +1,5 @@
<!ENTITY version "SVN-20110904"> <!ENTITY version "SVN-20110918">
<!ENTITY releasedate "Sep 4, 2011"> <!ENTITY releasedate "Sep 18, 2011">
<!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not &ndash; --> <!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not &ndash; -->
<!ENTITY milestone "7.0"> <!ENTITY milestone "7.0">
<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->

View File

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

View File

@ -3,14 +3,14 @@
# Boot scripts # Boot scripts
for s in bootscripts/lfs/init.d/* \ for s in bootscripts/lfs/init.d/* \
bootscripts/lfs/sysconfig/* \ bootscripts/lfs/sysconfig/* \
bootscripts/lfs/sysconfig/network-devices/* \ bootscripts/lfs/lib/services/* \
bootscripts/lfs/sysconfig/network-devices/services/* bootscripts/lfs/sbin/*
do do
script=$(basename $s) script=$(basename $s)
# Skip directories # Skip directories
[ $script == 'network-devices' ] && continue [ $script == 'network-devices' ] && continue
[ $script == 'services' ] && continue #[ $script == 'services' ] && continue
# Disambiguate duplicate file names # Disambiguate duplicate file names
[ $s == 'bootscripts/lfs/sysconfig/rc' ] && script='rc-sysinit'; [ $s == 'bootscripts/lfs/sysconfig/rc' ] && script='rc-sysinit';