aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appendices/scripts.xml14
-rw-r--r--bootscripts/ChangeLog15
-rw-r--r--bootscripts/Makefile151
-rw-r--r--bootscripts/README49
-rw-r--r--bootscripts/lfs/init.d/checkfs110
-rw-r--r--bootscripts/lfs/init.d/cleanfs106
-rw-r--r--bootscripts/lfs/init.d/console57
-rwxr-xr-xbootscripts/lfs/init.d/consolelog27
-rw-r--r--bootscripts/lfs/init.d/functions4
-rw-r--r--bootscripts/lfs/init.d/halt1
-rw-r--r--bootscripts/lfs/init.d/localnet13
-rw-r--r--bootscripts/lfs/init.d/modules37
-rw-r--r--bootscripts/lfs/init.d/mountfs15
-rw-r--r--bootscripts/lfs/init.d/mountvirtfs17
-rw-r--r--bootscripts/lfs/init.d/network13
-rw-r--r--bootscripts/lfs/init.d/rc151
-rw-r--r--bootscripts/lfs/init.d/reboot5
-rw-r--r--bootscripts/lfs/init.d/sendsignals17
-rw-r--r--bootscripts/lfs/init.d/setclock13
-rw-r--r--bootscripts/lfs/init.d/swap13
-rw-r--r--bootscripts/lfs/init.d/sysctl7
-rw-r--r--bootscripts/lfs/init.d/sysklogd40
-rw-r--r--bootscripts/lfs/init.d/template23
-rw-r--r--bootscripts/lfs/init.d/udev38
-rw-r--r--bootscripts/lfs/init.d/udev_retry11
-rw-r--r--bootscripts/lfs/lib/services/init-functions677
-rwxr-xr-xbootscripts/lfs/lib/services/ipv4-static89
-rwxr-xr-x[-rw-r--r--]bootscripts/lfs/lib/services/ipv4-static-route (renamed from bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route)23
-rwxr-xr-xbootscripts/lfs/sbin/ifdown98
-rwxr-xr-xbootscripts/lfs/sbin/ifup110
-rw-r--r--bootscripts/lfs/sbin/ifup.8108
-rw-r--r--bootscripts/lfs/sysconfig/createfiles31
-rw-r--r--bootscripts/lfs/sysconfig/network-devices/ifdown66
-rw-r--r--bootscripts/lfs/sysconfig/network-devices/ifup82
-rw-r--r--bootscripts/lfs/sysconfig/network-devices/services/ipv4-static83
-rw-r--r--bootscripts/lfs/sysconfig/rc2
-rw-r--r--bootscripts/lfs/sysconfig/rc.site61
-rw-r--r--chapter01/changelog.xml40
-rw-r--r--chapter05/binutils-pass2.xml2
-rw-r--r--chapter06/udev.xml6
-rw-r--r--chapter07/bootscripts.xml3
-rw-r--r--chapter07/chapter07.xml1
-rw-r--r--chapter07/network.xml2
-rw-r--r--chapter07/setclock.xml2
-rw-r--r--chapter07/site.xml35
-rw-r--r--chapter07/sysklogd.xml4
-rw-r--r--chapter07/usage.xml4
-rw-r--r--general.ent4
-rw-r--r--packages.ent2
-rw-r--r--process-scripts.sh6
50 files changed, 1798 insertions, 690 deletions
diff --git a/appendices/scripts.xml b/appendices/scripts.xml
index 3c71ac149..210fcaa16 100644
--- a/appendices/scripts.xml
+++ b/appendices/scripts.xml
@@ -8,6 +8,7 @@
<!ENTITY functions SYSTEM "functions.script">
<!ENTITY consolelog SYSTEM "consolelog.script">
<!ENTITY halt SYSTEM "halt.script">
+ <!ENTITY initfunctions SYSTEM "init-functions.script">
<!ENTITY localnet SYSTEM "localnet.script">
<!ENTITY modules SYSTEM "modules.script">
<!ENTITY mountfs SYSTEM "mountfs.script">
@@ -57,6 +58,11 @@
<screen>&rc;</screen>
</sect1>
+ <sect1 id="init-functions" role="wrap">
+ <title>/lib/lsb/init-functions</title>
+ <screen>&initfunctions;</screen>
+ </sect1>
+
<sect1 id="functions" role="wrap">
<title>/etc/rc.d/init.d/functions</title>
<screen>&functions;</screen>
@@ -173,22 +179,22 @@
</sect1>
<sect1 id="ifup" role="wrap">
- <title>/etc/sysconfig/network-devices/ifup</title>
+ <title>/sbin/ifup</title>
<screen>&ifup;</screen>
</sect1>
<sect1 id="ifdown" role="wrap">
- <title>/etc/sysconfig/network-devices/ifdown</title>
+ <title>/sbin/ifdown</title>
<screen>&ifdown;</screen>
</sect1>
<sect1 id="ipv4static" role="wrap">
- <title>/etc/sysconfig/network-devices/services/ipv4-static</title>
+ <title>/lib/services/ipv4-static</title>
<screen>&ipv4_static;</screen>
</sect1>
<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>
</sect1>
diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog
index 92601ef59..fb3cc3138 100644
--- a/bootscripts/ChangeLog
+++ b/bootscripts/ChangeLog
@@ -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>
* Major rewrite of all LFS scripts
** Move ifup/ifdown to /sbin
diff --git a/bootscripts/Makefile b/bootscripts/Makefile
index 2dfde6ed3..f32217777 100644
--- a/bootscripts/Makefile
+++ b/bootscripts/Makefile
@@ -1,33 +1,37 @@
ETCDIR=/etc
EXTDIR=${DESTDIR}${ETCDIR}
-LIBDIR=${DESTDIR}/lib/boot
+LIBDIR=${DESTDIR}/lib/services
+MAN8=/usr/share/man/man8
MODE=754
DIRMODE=755
CONFMODE=644
-all: install
+all: links
+
+install: all
create-dirs:
- 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/rc2.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/rc5.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/init.d
- install -d -m ${DIRMODE} ${EXTDIR}/sysconfig
- install -d -m ${DIRMODE} ${LIBDIR}
+ 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/rc2.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/rc5.d
+ install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc6.d
+ install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rcS.d
+ install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d
+ install -d -m ${DIRMODE} ${EXTDIR}/sysconfig
+ 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/cleanfs ${EXTDIR}/rc.d/init.d/
- install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
- install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR}
install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/consolelog ${EXTDIR}/rc.d/init.d/
+ 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/modules ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/
@@ -37,12 +41,49 @@ install: create-dirs
install -m ${MODE} lfs/init.d/reboot ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/sendsignals ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/setclock ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/sysklogd ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/swap ${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/udev ${EXTDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/udev_retry ${EXTDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/sbin/ifup /sbin
+ install -m ${MODE} lfs/sbin/ifdown /sbin
+ install -m ${MODE} lfs/sbin/ifup.8 ${MAN8}
+ ln -sf ifup.8 ${MAN8}/ifdown.8
+ install -m ${MODE} lfs/lib/services/ipv4-static-route ${LIBDIR}
+ install -m ${MODE} lfs/lib/services/ipv4-static ${LIBDIR}
+ install -m ${CONFMODE} lfs/lib/services/init-functions ${LIBDIR}
+ if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/ ;\
+ fi
+ if [ ! -f ${EXTDIR}/sysconfig/modules ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/ ;\
+ fi
+ if [ ! -f ${EXTDIR}/sysconfig/rc ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/ ;\
+ fi
+ if [ ! -f ${EXTDIR}/sysconfig/rc.site ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/rc.site ${EXTDIR}/sysconfig/ ;\
+ fi
+
+links: files rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6
+
+rcS:
+ ln -sf ../init.d/mountvirtfs ${EXTDIR}/rc.d/rcS.d/S00mountvirtfs
+ ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcS.d/S02consolelog
+ ln -sf ../init.d/modules ${EXTDIR}/rc.d/rcS.d/S05modules
+ ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rcS.d/S08localnet
+ ln -sf ../init.d/udev ${EXTDIR}/rc.d/rcS.d/S10udev
+ ln -sf ../init.d/swap ${EXTDIR}/rc.d/rcS.d/S20swap
+ ln -sf ../init.d/checkfs ${EXTDIR}/rc.d/rcS.d/S30checkfs
+ ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rcS.d/S40mountfs
+ ln -sf ../init.d/cleanfs ${EXTDIR}/rc.d/rcS.d/S45cleanfs
+ ln -sf ../init.d/udev_retry ${EXTDIR}/rc.d/rcS.d/S50udev_retry
+ ln -sf ../init.d/console ${EXTDIR}/rc.d/rcS.d/S70console
+ ln -sf ../init.d/sysctl ${EXTDIR}/rc.d/rcS.d/S90sysctl
+
+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
@@ -50,16 +91,28 @@ install: create-dirs
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
+
+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
@@ -67,68 +120,6 @@ install: create-dirs
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 \
- install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/ ;\
- fi
- if [ ! -f ${EXTDIR}/sysconfig/modules ]; then \
- install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/ ;\
- fi
- if [ ! -f ${EXTDIR}/sysconfig/rc ]; then \
- install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/ ;\
- fi
- install -m ${MODE} lfs/sysconfig/network-devices/ifup /sbin
- install -m ${MODE} lfs/sysconfig/network-devices/ifdown /sbin
- install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static ${LIBDIR}
- install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static-route ${LIBDIR}
-
-install-consolelog: create-dirs
- install -m ${MODE} contrib/init.d/consolelog ${EXTDIR}/rc.d/init.d
- ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S00consolelog
-
-minimal: create-dirs
- install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/
- install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
- install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR}
- install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/mountvirtfs ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/rc ${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/setclock ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/swap ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/udev ${EXTDIR}/rc.d/init.d/
- ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals
- ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc0.d/S70mountfs
- ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc0.d/S80swap
- ln -sf ../init.d/halt ${EXTDIR}/rc.d/rc0.d/S99halt
- 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/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
diff --git a/bootscripts/README b/bootscripts/README
index 726fa1747..6a12b3cfe 100644
--- a/bootscripts/README
+++ b/bootscripts/README
@@ -1,49 +1,44 @@
Network Configuration:
Script Files:
- /etc/rc.d/init.d/network
+ /etc/rc.d/init.d/*
/sbin/ifup
/sbin/ifdown
- /lib/boot/*/*
+ /lib/lsb/*
Configuration Files:
/etc/sysconfig/ifconfig.*
- Note: ifconfig.* could be either a file or directory,
- but the filename extension must be the same name
- as the network interface you wish it to belong to.
- The files within the directory will be processed
- in alphanumerical order on boot, and reversed on
- shutdown.
- - IFACE: the interface that is being configured (e.g. eth0)
- - SERVICE: which script to run in services directory.
- - ONBOOT: if set to yes, this interface will be started on
- bootup, and stopped on shutdown
+ Note: ifconfig.* files will be processed
+ in alphanumerical order on boot, and reversed on shutdown.
+ - IFACE : The interface that is being configured (e.g. eth0)
+ - SERVICE: Which script to run in services directory.
+ - ONBOOT : If set to yes, this interface will be started on bootup
/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:
- ipv4-static:
- - IP: static IP Address
- - GATEWAY: Specifies the IP Address of the gateway server
- - PREFIX: CIDR prefix of IP Address, defaults to 24 if not set
- - PEER: IP Address of peer (for point-to-point connections and tunnels)
- - BROADCAST: broadcast address
+ SERVICE ipv4-static:
+ - IP : Static IP Address
+ - GATEWAY : Specifies the IP Address of the gateway server
+ - PREFIX : CIDR prefix of IP Address, defaults to 24 if not set
+ - PEER : IP Address of peer (for point-to-point connections and tunnels)
+ - BROADCAST: Broadcast address
- ipv4-static-route:
- - TYPE: network (default type if not specified), default, host or
- unreachable
- - IP: IP Address of target (for network, host and unreachable)
- - PREFIX: CIDR prefix of target (for network, host and unreachable)
+ SERVICE ipv4-static-route:
+ - TYPE : Network (default type if not specified), default, host or unreachable
+ - IP : IP Address of target (for network, host and unreachable)
+ - PREFIX : CIDR prefix of target (for network, host and unreachable)
- GATEWAY: IP Address of gateway to reach target (for network and default)
SetClock configuration:
- Script Files:
- /etc/rc.d/init.d/setclock
+
+ /etc/rc.d/init.d/cleanfs
- SKIPTMPCLEAN: skips cleaning of /tmp directory
Configuration Files:
- /etc/sysconfig/clock
+ /etc/sysconfig/clock or /etc/sysconfig/rc.site
- UTC: 1 assumes hwclock is in UTC
0 assumes hwclock is in local time
- CLOCKPARAMS: any additional options to be passed to hwclock
diff --git a/bootscripts/lfs/init.d/checkfs b/bootscripts/lfs/init.d/checkfs
index 2ad3e1921..abfd5a73c 100644
--- a/bootscripts/lfs/init.d/checkfs
+++ b/bootscripts/lfs/init.d/checkfs
@@ -6,6 +6,7 @@
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# A. Luebke - luebke@users.sourceforge.net
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -37,101 +38,102 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
start)
if [ -f /fastboot ]; then
- boot_mesg -n "/fastboot found, will not perform" ${INFO}
- boot_mesg " file system checks as requested."
- echo_ok
+ msg="/fastboot found, will omit "
+ msg="${msg} file system checks as requested.\n"
+ log_info_msg "${msg}"
exit 0
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
- evaluate_retval
if [ ${?} != 0 ]; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE}
- boot_mesg -n " filesystem because it could not be mounted"
- boot_mesg -n " in read-only mode.\n\nAfter you"
- boot_mesg -n " press Enter, this system will be"
- boot_mesg -n " halted and powered off."
- boot_mesg -n "\n\nPress enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
+ log_failure_msg2
+ msg="\n\nCannot check root "
+ msg="${msg}filesystem because it could not be mounted "
+ msg="${msg}in read-only mode.\n\n"
+ msg="${msg}After you press Enter, this system will be "
+ msg="${msg}halted and powered off.\n\n"
+ log_failure_msg "${msg}"
+
+ log_info_msg "Press Enter to continue..."
wait_for_user
/etc/rc.d/init.d/halt stop
+ else
+ log_success_msg2
fi
if [ -f /forcefsck ]; then
- boot_mesg -n "/forcefsck found, forcing file" ${INFO}
- boot_mesg " system checks as requested."
- echo_ok
+ msg="\n/forcefsck found, forcing file"
+ msg="${msg} system checks as requested."
+ log_success_msg "$msg"
options="-f"
else
options=""
fi
- boot_mesg "Checking file systems..."
- # Note: -a option used to be -p; but this fails e.g.
- # on fsck.minix
+ log_info_msg "Checking file systems..."
+ # Note: -a option used to be -p; but this fails e.g. on fsck.minix
fsck ${options} -a -A -C -T
error_value=${?}
if [ "${error_value}" = 0 ]; then
- echo_ok
+ log_success_msg2
fi
if [ "${error_value}" = 1 ]; then
- echo_warning
- boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
- boot_mesg -n " were found and have been corrected. "
- boot_mesg -n " You may want to double-check that"
- boot_mesg -n " everything was fixed properly."
- boot_mesg "" ${NORMAL}
+ msg="\nWARNING:\n\nFile system errors "
+ msg="${msg}were found and have been corrected.\n"
+ msg="${msg}You may want to double-check that "
+ msg="${msg}everything was fixed properly."
+ log_warning_msg "$msg"
fi
if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
- echo_warning
- boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
- boot_mesg -n " were found and have been been"
- boot_mesg -n " corrected, but the nature of the"
- boot_mesg -n " errors require this system to be"
- boot_mesg -n " rebooted.\n\nAfter you press enter,"
- boot_mesg -n " this system will be rebooted"
- boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
+ msg="\nWARNING:\n\nFile system errors "
+ msg="${msg}were found and have been been "
+ msg="${msg}corrected, but the nature of the "
+ msg="${msg}errors require this system to be rebooted.\n\n"
+ msg="${msg}After you press enter, "
+ msg="${msg}this system will be rebooted\n\n"
+ log_failure_msg "$msg"
+
+ log_info_msg "Press Enter to continue..."
wait_for_user
reboot -f
fi
if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE}
- boot_mesg -n " were encountered that could not be"
- boot_mesg -n " fixed automatically. This system"
- boot_mesg -n " cannot continue to boot and will"
- boot_mesg -n " therefore be halted until those"
- boot_mesg -n " errors are fixed manually by a"
- boot_mesg -n " System Administrator.\n\nAfter you"
- boot_mesg -n " press Enter, this system will be"
- boot_mesg -n " halted and powered off."
- boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
+ msg="\nFAILURE:\n\nFile system errors "
+ msg="${msg}were encountered that could not be "
+ msg="${msg}fixed automatically. This system "
+ msg="${msg}cannot continue to boot and will "
+ msg="${msg}therefore be halted until those "
+ msg="${msg}errors are fixed manually by a "
+ msg="${msg}System Administrator.\n\n"
+ msg="${msg}After you press Enter, this system will be "
+ msg="${msg}halted and powered off.\n\n"
+ log_failure_msg "$msg"
+
+ log_info_msg "Press Enter to continue..."
wait_for_user
- /etc/rc.d/init.d/halt stop
+ /etc/rc.d/init.d/halt stop
fi
if [ "${error_value}" -ge 16 ]; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE}
- boot_mesg -n " running fsck. Exited with error"
- boot_mesg -n " code: ${error_value}."
- boot_mesg "" ${NORMAL}
+ msg="\nFAILURE:\n\nUnexpected Failure "
+ msg="${msg}running fsck. Exited with error "
+ msg="${msg} code: ${error_value}."
+ log_failure_msg $msg
exit ${error_value}
fi
+
+ exit 0
;;
*)
echo "Usage: ${0} {start}"
diff --git a/bootscripts/lfs/init.d/cleanfs b/bootscripts/lfs/init.d/cleanfs
index f480c40ce..ea4c5f4b4 100644
--- a/bootscripts/lfs/init.d/cleanfs
+++ b/bootscripts/lfs/init.d/cleanfs
@@ -5,6 +5,7 @@
# Description : Clean file system
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -26,67 +27,70 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
# Function to create files/directory on boot.
-create_files() {
- # Read in the configuration file.
+function create_files()
+{
+ # Input to file descriptor 9 and output to stdin (redirection)
exec 9>&0 < /etc/sysconfig/createfiles
- while read name type perm usr grp dtype maj min junk
- do
- # Ignore comments and blank lines.
- case "${name}" in
- ""|\#*) continue ;;
+
+ while read name type perm usr grp dtype maj min junk
+ do
+ # Ignore comments and blank lines.
+ 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
- # 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
- ;;
- *)
- 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.
+ chown ${usr}:${grp} "${name}"
+ chmod ${perm} "${name}"
+ fi
+ done
- # Set up the permissions, too.
- chown ${usr}:${grp} "${name}"
- chmod ${perm} "${name}"
- fi
- done
+ # Close file descriptor 9 (end redirection)
exec 0>&9 9>&-
+ return 0
}
case "${1}" in
start)
- boot_mesg -n "Cleaning file systems:" ${INFO}
+ log_info_msg "Cleaning file systems:"
if [ "${SKIPTMPCLEAN}" = "" ]; then
- boot_mesg -n " /tmp" ${NORMAL}
+ log_info_msg2 "\n /tmp"
cd /tmp &&
find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
fi
@@ -102,10 +106,12 @@ case "${1}" in
evaluate_retval
if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null; then
- boot_mesg "Creating files and directories..."
- create_files
+ log_info_msg "Creating files and directories... "
+ create_files # Always returns 0
evaluate_retval
fi
+
+ exit $failed
;;
*)
echo "Usage: ${0} {start}"
diff --git a/bootscripts/lfs/init.d/console b/bootscripts/lfs/init.d/console
index 9929f5429..f3b3a51e3 100644
--- a/bootscripts/lfs/init.d/console
+++ b/bootscripts/lfs/init.d/console
@@ -6,14 +6,13 @@
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Alexander E. Patrakov
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
-. /lib/boot/functions
-
### BEGIN INIT INFO
# Provides: console
# Required-Start:
@@ -28,37 +27,43 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
+. /lib/lsb/init-functions
+
# Native English speakers probably don't have /etc/sysconfig/console at all
-if [ -r /etc/sysconfig/console ]; then
- . /etc/sysconfig/console
-else
- exit 0
-fi
+[ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
-is_true() {
+function is_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
case "${1}" in
start)
- boot_mesg "Setting up Linux console..."
# There should be no bogus failures below this line!
+ log_info_msg "Setting up Linux console..."
# 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
# desired mode
is_true "${UNICODE}" &&
- MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" ||
- MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a"
+ MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" ||
+ MODE_COMMAND="echo -en '\033%@\033(K' && kbd_mode -a"
# On framebuffer consoles, font has to be set for each vt in
# UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
- ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
+ ! is_true "${use_fb}" || [ -z "${FONT}" ] ||
MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
# Apply that command to all consoles mentioned in
@@ -66,8 +71,6 @@ case "${1}" in
# happen before setfont, otherwise a kernel bug will
# show up and the unicode map of the font will not be
# used.
- # FIXME: Fedora Core also initializes two spare consoles
- # - do we want that?
for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
grep -o '\btty[[:digit:]]*\b'`
@@ -77,31 +80,33 @@ case "${1}" in
done
# Set the font (if not already set above) and the keymap
- is_true "${USE_FB}" || [ -z "${FONT}" ] ||
- setfont $FONT ||
- failed=1
+ [ "${use_fb}" == "1" || [ -z "${FONT}" ] || setfont $FONT || failed=1
+
[ -z "${KEYMAP}" ] ||
loadkeys ${KEYMAP} >/dev/null 2>&1 ||
failed=1
+
[ -z "${KEYMAP_CORRECTIONS}" ] ||
loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
failed=1
# Convert the keymap from $LEGACY_CHARSET to UTF-8
[ -z "$LEGACY_CHARSET" ] ||
- dumpkeys -c "$LEGACY_CHARSET" |
- loadkeys -u >/dev/null 2>&1 ||
+ dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u >/dev/null 2>&1 ||
failed=1
# If any of the commands above failed, the trap at the
# top would set $failed to 1
- ( exit $failed )
+ ( exit $failed )
evaluate_retval
- ;;
- *)
- echo $"Usage:" "${0} {start}"
- exit 1
- ;;
+
+ exit $failed
+ ;;
+
+ *)
+ echo $"Usage:" "${0} {start}"
+ exit 1
+ ;;
esac
# End console
diff --git a/bootscripts/lfs/init.d/consolelog b/bootscripts/lfs/init.d/consolelog
index 389e86f9f..bd8df09cc 100755
--- a/bootscripts/lfs/init.d/consolelog
+++ b/bootscripts/lfs/init.d/consolelog
@@ -5,7 +5,8 @@
# Description : Set the kernel log level for the console
#
# 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
#
# Version : LFS 7.0
@@ -27,25 +28,28 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
-# set the default loglevel
-LOGLEVEL=7
+# set the default loglevel if needed
+LOGLEVEL=${LOGLEVEL:-7}
-[ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
+[ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
case "${1}" in
start)
case "$LOGLEVEL" in
[1-8])
- boot_mesg "Setting the console log level to ${LOGLEVEL}..."
+ log_info_msg "Setting the console log level to ${LOGLEVEL}..."
dmesg -n $LOGLEVEL
evaluate_retval
+ exit 0
;;
+
*)
- boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
- echo_failure
+ log_failure_msg "Console log level '${LOGLEVEL}' is invalid"
+ exit 1
;;
+
esac
;;
@@ -54,13 +58,14 @@ case "${1}" in
if [ -r /proc/sys/kernel/printk ]; then
read level line < /proc/sys/kernel/printk
else
- boot_mesg "Can't read the current console log level" ${FAILURE}
- echo_failure
+ log_failure_msg "Can't read the current console log level"
+ exit 1
fi
# Print the value
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
;;
diff --git a/bootscripts/lfs/init.d/functions b/bootscripts/lfs/init.d/functions
index 1487dfa39..242e78720 100644
--- a/bootscripts/lfs/init.d/functions
+++ b/bootscripts/lfs/init.d/functions
@@ -12,12 +12,12 @@
# Notes : With code based on Matthias Benkmann's simpleinit-msb
# 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
-[ -r /etc/sysconfig/init_params ] && . /etc/sysconfig/init_params
+. /lib/lsb/init_params
## Environmental setup
# Setup default values for environment
diff --git a/bootscripts/lfs/init.d/halt b/bootscripts/lfs/init.d/halt
index 3b8b78fa2..f8bfc70c2 100644
--- a/bootscripts/lfs/init.d/halt
+++ b/bootscripts/lfs/init.d/halt
@@ -5,6 +5,7 @@
# Description : Halt Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
diff --git a/bootscripts/lfs/init.d/localnet b/bootscripts/lfs/init.d/localnet
index f7e8fc6dd..7afcb72dd 100644
--- a/bootscripts/lfs/init.d/localnet
+++ b/bootscripts/lfs/init.d/localnet
@@ -5,6 +5,7 @@
# Description : Loopback device
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -25,23 +26,23 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
-. /etc/sysconfig/network
+. /lib/lsb/init-functions
+[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
case "${1}" in
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 link set lo up
evaluate_retval
- boot_mesg "Setting hostname to ${HOSTNAME}..."
+ log_info_msg "Setting hostname to ${HOSTNAME}..."
hostname ${HOSTNAME}
evaluate_retval
;;
stop)
- boot_mesg "Bringing down the loopback interface..."
+ log_info_msg "Bringing down the loopback interface..."
ip link set lo down
evaluate_retval
;;
@@ -63,4 +64,6 @@ case "${1}" in
;;
esac
+exit 0
+
# End localnet
diff --git a/bootscripts/lfs/init.d/modules b/bootscripts/lfs/init.d/modules
index 71698ac37..f1c226c7f 100644
--- a/bootscripts/lfs/init.d/modules
+++ b/bootscripts/lfs/init.d/modules
@@ -5,6 +5,7 @@
# Description : Module auto-loading script
#
# Authors : Zack Winkles
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -24,23 +25,23 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
-
# Assure that the kernel has module support.
[ -e /proc/ksyms -o -e /proc/modules ] || exit 0
+. /lib/lsb/init-functions
+
case "${1}" in
start)
# Exit if there's no modules file or there are no
# valid entries
- [ -r /etc/sysconfig/modules ] &&
- egrep -qv '^($|#)' /etc/sysconfig/modules ||
- exit 0
+ [ -r /etc/sysconfig/modules ] || exit 0
+ [ $(egrep -qv '^($|#)' /etc/sysconfig/modules) ] || 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
# some modules to load.
+
while read module args; do
# Ignore comments and blank lines.
@@ -48,29 +49,25 @@ case "${1}" in
""|"#"*) continue ;;
esac
- # Attempt to load the module, making
- # sure to pass any arguments provided.
+ # Attempt to load the module, passing any arguments provided.
modprobe ${module} ${args} >/dev/null
- # Print the module name if successful,
- # otherwise take note.
+ # Print the module name if successful, otherwise take note.
if [ $? -eq 0 ]; then
- boot_mesg -n " ${module}" ${NORMAL}
+ log_info_msg2 " ${module}"
else
failedmod="${failedmod} ${module}"
fi
done < /etc/sysconfig/modules
- boot_mesg "" ${NORMAL}
- # Print a message about successfully loaded
- # modules on the correct line.
- echo_ok
+ # Print a message about successfully loaded modules on the correct line.
+ log_success_msg2
- # Print a failure message with a list of any
- # modules that may have failed to load.
+ # Print a failure message with a list of any modules that
+ # may have failed to load.
if [ -n "${failedmod}" ]; then
- boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
- echo_failure
+ log_failure_msg "Failed to load modules:${failedmod}"
+ exit 1
fi
;;
@@ -80,4 +77,6 @@ case "${1}" in
;;
esac
+exit 0
+
# End modules
diff --git a/bootscripts/lfs/init.d/mountfs b/bootscripts/lfs/init.d/mountfs
index c88a6386f..59d4300c5 100644
--- a/bootscripts/lfs/init.d/mountfs
+++ b/bootscripts/lfs/init.d/mountfs
@@ -5,6 +5,7 @@
# Description : File System Mount Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -27,18 +28,18 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
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
evaluate_retval
# Remove fsck-related file system watermarks.
rm -f /fastboot /forcefsck
- boot_mesg "Recording existing mounts in /etc/mtab..."
+ log_info_msg "Recording existing mounts in /etc/mtab..."
> /etc/mtab
mount -f / || failed=1
@@ -50,15 +51,19 @@ case "${1}" in
# This will mount all filesystems that do not have _netdev in
# their option list. _netdev denotes a network filesystem.
- boot_mesg "Mounting remaining file systems..."
+
+ log_info_msg "Mounting remaining file systems..."
mount -a -O no_netdev >/dev/null
evaluate_retval
+ exit $failed
;;
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
evaluate_retval
+ exit 0
;;
*)
diff --git a/bootscripts/lfs/init.d/mountvirtfs b/bootscripts/lfs/init.d/mountvirtfs
index 2c23248b7..34ae95bab 100644
--- a/bootscripts/lfs/init.d/mountvirtfs
+++ b/bootscripts/lfs/init.d/mountvirtfs
@@ -5,6 +5,7 @@
# Description : Mount proc, sysfs, and run
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -26,32 +27,30 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
start)
+ # Make sure /run/var is available before logging any messages
mkdir -p /run
mount -n /run || failed=1
mkdir -p /run/{var,lock,shm}
-
- boot_mesg -n "Mounting virtual file systems:" ${INFO}
- boot_mesg -n " /run" ${NORMAL}
+ log_info_msg "Mounting virtual file systems: /run"
if ! mountpoint /proc >/dev/null; then
- boot_mesg -n " /proc" ${NORMAL}
+ log_info_msg2 " /proc"
mount -n /proc || failed=1
fi
if ! mountpoint /sys >/dev/null; then
- boot_mesg -n " /sys" ${NORMAL}
+ log_info_msg2 " /sys"
mount -n /sys || failed=1
fi
- boot_mesg "" ${NORMAL}
-
(exit ${failed})
evaluate_retval
+ exit $failed
;;
*)
@@ -60,4 +59,4 @@ case "${1}" in
;;
esac
-# End mountvertfs
+# End mountvirtfs
diff --git a/bootscripts/lfs/init.d/network b/bootscripts/lfs/init.d/network
index 622a2a40d..c34123555 100644
--- a/bootscripts/lfs/init.d/network
+++ b/bootscripts/lfs/init.d/network
@@ -7,6 +7,7 @@
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -33,7 +34,7 @@ case "${1}" in
do
interface=${file##*/ifconfig.}
- # skip if $file is * (because nothing was found)
+ # Skip if $file is * (because nothing was found)
if [ "${interface}" = "*" ]
then
continue
@@ -45,18 +46,18 @@ case "${1}" in
stop)
# Reverse list
- FILES=""
+ net_files=""
for file in /etc/sysconfig/ifconfig.*
do
- FILES="${file} ${FILES}"
+ net_files="${file} ${net_files}"
done
# Stop all network interfaces
- for file in ${FILES}
+ for file in ${net_files}
do
interface=${file##*/ifconfig.}
- # skip if $file is * (because nothing was found)
+ # Skip if $file is * (because nothing was found)
if [ "${interface}" = "*" ]
then
continue
@@ -78,4 +79,6 @@ case "${1}" in
;;
esac
+exit 0
+
# End network
diff --git a/bootscripts/lfs/init.d/rc b/bootscripts/lfs/init.d/rc
index 9538b3407..3a4712690 100644
--- a/bootscripts/lfs/init.d/rc
+++ b/bootscripts/lfs/init.d/rc
@@ -1,55 +1,92 @@
-#!/bin/sh
+#!/bin/bash
########################################################################
# Begin rc
#
# Description : Main Run Level Control Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# : DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# 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
- boot_mesg -n "FAILURE:\n\nYou should not be reading this error message.\n\n" ${FAILURE}
- boot_mesg -n " It means that an unforeseen error took"
- boot_mesg -n " place in ${i}, which exited with a return value of"
- boot_mesg " ${error_value}.\n"
- boot_mesg_flush
- boot_mesg -n "If you're able to track this"
- boot_mesg -n " error down to a bug in one of the files provided by"
- boot_mesg -n " the LFS book, please be so kind to inform us at"
- boot_mesg " lfs-dev@linuxfromscratch.org.\n"
- boot_mesg_flush
- boot_mesg -n "Press Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
+ MSG="FAILURE:\n\nYou should not be reading this error message.\n\n"
+ MSG="${MSG}It means that an unforeseen error took place in\n"
+ MSG="${MSG}${i},\n"
+ MSG="${MSG}which exited with a return value of ${error_value}.\n"
+
+ MSG="${MSG}If you're able to track this error down to a bug in one of\n"
+ MSG="${MSG}the files provided by the files provided by\n"
+ MSG="${MSG}the ${DISDRI_MINI} book, please be so kind to inform us at\n"
+ MSG="${MSG}${DISTRO_CONTACT}.\n"
+ log_failure_msg "${MSG}"
+
+ log_info_msg "Press Enter to continue..."
wait_for_user
}
-check_script_status()
+function check_script_status()
{
# $i is set when called
if [ ! -f ${i} ]; then
- boot_mesg "${i} is not a valid symlink." ${WARNING}
- echo_warning
+ log_warning_msg "${i} is not a valid symlink."
continue
fi
if [ ! -x ${i} ]; then
- boot_mesg "${i} is not executable, skipping." ${WARNING}
- echo_warning
+ log_warning_msg "${i} is not executable, skipping."
continue
fi
}
-# This sets a few default terminal options.
-stty sane
+function run()
+{
+ 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
trap "" INT QUIT TSTP
@@ -65,10 +102,29 @@ previous=${PREVLEVEL}
[ "${previous}" = "" ] && previous=N
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
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,
# and killed in this runlevel
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]}
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
- boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING}
- boot_mesg -n " executed because it was not"
- boot_mesg -n " not started in the previous"
- boot_mesg -n " runlevel (${previous})."
- boot_mesg "" ${NORMAL}
- boot_mesg_flush
+ MSG="WARNING:\n\n${i} can't be "
+ MSG="${MSG}executed because it was not "
+ MSG="${MSG}not started in the previous "
+ MSG="${MSG}runlevel (${previous})."
+ log_warning_msg "$MSG"
continue
fi
fi
- ${i} stop
+
+ run ${i} stop
error_value=${?}
- if [ "${error_value}" != "0" ]; then
- print_error_msg
- fi
+ if [ "${error_value}" != "0" ]; then print_error_msg; fi
done
fi
-if [ "${previous}" = "N" ]; then
- IN_BOOT=1
- export IN_BOOT
+if [ "${previous}" == "N" ]; then export IN_BOOT=1; fi
+
+if [ "$runlevel" == "6" ] && [ -n ${FASTBOOT} ]; then
+ touch /fastboot
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)
do
if [ "${previous}" != "N" ]; then
@@ -120,17 +176,22 @@ do
case ${runlevel} in
0|6)
- ${i} stop
+ run ${i} stop
;;
*)
- ${i} start
+ run ${i} start
;;
esac
+
error_value=${?}
- if [ "${error_value}" != "0" ]; then
- print_error_msg
- fi
+ if [ "${error_value}" != "0" ]; then print_error_msg; fi
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
diff --git a/bootscripts/lfs/init.d/reboot b/bootscripts/lfs/init.d/reboot
index a7cfd82cf..9e4dd1146 100644
--- a/bootscripts/lfs/init.d/reboot
+++ b/bootscripts/lfs/init.d/reboot
@@ -5,6 +5,7 @@
# Description : Reboot Scripts
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -24,11 +25,11 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
stop)
- boot_mesg "Restarting system..."
+ log_info_msg "Restarting system..."
reboot -d -f -i
;;
diff --git a/bootscripts/lfs/init.d/sendsignals b/bootscripts/lfs/init.d/sendsignals
index 016650c6b..55de3119b 100644
--- a/bootscripts/lfs/init.d/sendsignals
+++ b/bootscripts/lfs/init.d/sendsignals
@@ -5,6 +5,7 @@
# Description : Sendsignals Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -24,32 +25,32 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot//functions
+. /lib/lsb/init-functions
case "${1}" in
stop)
- boot_mesg "Sending all processes the TERM signal..."
+ log_info_msg "Sending all processes the TERM signal..."
killall5 -15
error_value=${?}
sleep ${KILLDELAY}
if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
- echo_ok
+ log_success_msg
else
- echo_failure
+ log_failure_msg
fi
- boot_mesg "Sending all processes the KILL signal..."
+ log_info_msg "Sending all processes the KILL signal..."
killall5 -9
error_value=${?}
sleep ${KILLDELAY}
if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
- echo_ok
+ log_success_msg
else
- echo_failure
+ log_failure_msg
fi
;;
@@ -60,4 +61,6 @@ case "${1}" in
esac
+exit 0
+
# End sendsignals
diff --git a/bootscripts/lfs/init.d/setclock b/bootscripts/lfs/init.d/setclock
index 19cbb1447..12aaf032d 100644
--- a/bootscripts/lfs/init.d/setclock
+++ b/bootscripts/lfs/init.d/setclock
@@ -5,6 +5,7 @@
# Description : Setting Linux Clock
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -25,9 +26,9 @@
# X-LFS-Provided-By: LFS BLFS
### 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
@@ -43,19 +44,23 @@ esac
case ${1} in
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
evaluate_retval
;;
stop)
- boot_mesg "Setting hardware clock..."
+ log_info_msg "Setting hardware clock..."
hwclock --systohc ${CLOCKPARAMS} >/dev/null
evaluate_retval
;;
*)
echo "Usage: ${0} {start|stop}"
+ exit 1
;;
esac
+
+exit 0
diff --git a/bootscripts/lfs/init.d/swap b/bootscripts/lfs/init.d/swap
index d042e723f..1198ee4c6 100644
--- a/bootscripts/lfs/init.d/swap
+++ b/bootscripts/lfs/init.d/swap
@@ -5,6 +5,7 @@
# Description : Swap Control Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -25,17 +26,17 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
start)
- boot_mesg "Activating all swap files/partitions..."
+ log_info_msg "Activating all swap files/partitions..."
swapon -a
evaluate_retval
;;
stop)
- boot_mesg "Deactivating all swap files/partitions..."
+ log_info_msg "Deactivating all swap files/partitions..."
swapoff -a
evaluate_retval
;;
@@ -47,9 +48,7 @@ case "${1}" in
;;
status)
- boot_mesg "Retrieving swap status." ${INFO}
- echo_ok
- echo
+ log_success_msg "Retrieving swap status."
swapon -s
;;
@@ -59,4 +58,6 @@ case "${1}" in
;;
esac
+exit 0
+
# End swap
diff --git a/bootscripts/lfs/init.d/sysctl b/bootscripts/lfs/init.d/sysctl
index b37d51e42..baa9fe60a 100644
--- a/bootscripts/lfs/init.d/sysctl
+++ b/bootscripts/lfs/init.d/sysctl
@@ -7,6 +7,7 @@
#
# Authors : Nathan Coulson (nathan@linuxfromscratch.org)
# Matthew Burgress (matthew@linuxfromscratch.org)
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -27,12 +28,12 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
start)
if [ -f "/etc/sysctl.conf" ]; then
- boot_mesg "Setting kernel runtime parameters..."
+ log_info_msg "Setting kernel runtime parameters..."
sysctl -q -p
evaluate_retval
fi
@@ -48,4 +49,6 @@ case "${1}" in
;;
esac
+exit 0
+
# End sysctl
diff --git a/bootscripts/lfs/init.d/sysklogd b/bootscripts/lfs/init.d/sysklogd
index 7e079abf5..72e349744 100644
--- a/bootscripts/lfs/init.d/sysklogd
+++ b/bootscripts/lfs/init.d/sysklogd
@@ -5,6 +5,7 @@
# Description : Sysklogd loader
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -25,29 +26,35 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
start)
- boot_mesg "Starting system log daemon..."
- PARMS=${SYSKLOGD_PARMS-'-m 0'}
- loadproc syslogd $PARMS
+ log_info_msg "Starting system log daemon..."
+ parms=${SYSKLOGD_PARMS-'-m 0'}
+ start_daemon /sbin/syslogd $parms
+ evaluate_retval
- boot_mesg "Starting kernel log daemon..."
- loadproc klogd
+ log_info_msg "Starting kernel log daemon..."
+ start_daemon /sbin/klogd
+ evaluate_retval
;;
stop)
- boot_mesg "Stopping kernel log daemon..."
- killproc klogd
+ log_info_msg "Stopping kernel log daemon..."
+ killproc /sbin/klogd
+ evaluate_retval
- boot_mesg "Stopping system log daemon..."
- killproc syslogd
+ log_info_msg "Stopping system log daemon..."
+ killproc /sbin/syslogd
+ evaluate_retval
;;
reload)
- boot_mesg "Reloading system log daemon config file..."
- reloadproc syslogd
+ log_info_msg "Reloading system log daemon config file..."
+ pid=`pidofproc syslogd`
+ kill -HUP "${pid}"
+ evaluate_retval
;;
restart)
@@ -56,15 +63,12 @@ case "${1}" in
${0} start
;;
- status)
- statusproc syslogd
- statusproc klogd
- ;;
-
*)
- echo "Usage: ${0} {start|stop|reload|restart|status}"
+ echo "Usage: ${0} {start|stop|reload|restart}"
exit 1
;;
esac
+exit 0
+
# End sysklogd
diff --git a/bootscripts/lfs/init.d/template b/bootscripts/lfs/init.d/template
index dbb3aa837..59c5f3cba 100644
--- a/bootscripts/lfs/init.d/template
+++ b/bootscripts/lfs/init.d/template
@@ -25,22 +25,17 @@
# X-LFS-Provided-By:
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
start)
- boot_mesg "Starting..."
- loadproc
+ log_info_msg "Starting..."
+ start_daemon fully_qualified_path
;;
stop)
- boot_mesg "Stopping..."
- killproc
- ;;
-
- reload)
- boot_mesg "Reloading..."
- reloadproc
+ log_info_msg "Stopping..."
+ killproc fully_qualified_path
;;
restart)
@@ -49,14 +44,12 @@ case "${1}" in
${0} start
;;
- status)
- statusproc
- ;;
-
*)
- echo "Usage: ${0} {start|stop|reload|restart|status}"
+ echo "Usage: ${0} {start|stop|restart}"
exit 1
;;
esac
+exit 0
+
# End scriptname
diff --git a/bootscripts/lfs/init.d/udev b/bootscripts/lfs/init.d/udev
index 63cde4273..6b7a79bc6 100644
--- a/bootscripts/lfs/init.d/udev
+++ b/bootscripts/lfs/init.d/udev
@@ -5,6 +5,7 @@
# Description : Udev cold-plugging script
#
# Authors : Zack Winkles, Alexander E. Patrakov
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -25,19 +26,19 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
start)
- boot_mesg "Populating /dev with device nodes..."
+ log_info_msg "Populating /dev with device nodes... "
if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
- boot_mesg -n " devices without a SysFS filesystem"
- boot_mesg -n "\n\nAfter you press Enter, this system"
- boot_mesg -n " will be halted and powered off."
- boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
+ log_failure_msg2
+ msg="FAILURE:\n\nUnable to create "
+ msg="${msg}devices without a SysFS filesystem\n\n"
+ msg="${msg}After you press Enter, this system "
+ msg="${msg}will be halted and powered off.\n\n"
+ log_info_msg "$msg"
+ log_info_msg "Press Enter to continue..."
wait_for_user
/etc/rc.d/init.d/halt stop
fi
@@ -49,14 +50,15 @@ case "${1}" in
if ! mountpoint /dev > /dev/null; then
mount -n -t tmpfs tmpfs /dev -o mode=755
fi
+
if [ ${?} != 0 ]; then
- echo_failure
- boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
- boot_mesg -n " onto /dev, this system will be halted."
- boot_mesg -n "\n\nAfter you press Enter, this system"
- boot_mesg -n " will be halted and powered off."
- boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
- boot_mesg "" ${NORMAL}
+ log_failure_msg2
+ msg="FAILURE:\n\nCannot mount a tmpfs "
+ msg="${msg}onto /dev, this system will be halted.\n\n"
+ msg="${msg}After you press Enter, this system "
+ msg="${msg}will be halted and powered off.\n\n"
+ log_failure_msg "$msg"
+ log_info_msg "Press Enter to continue..."
wait_for_user
/etc/rc.d/init.d/halt stop
fi
@@ -82,7 +84,7 @@ case "${1}" in
# Now wait for udevd to process the uevents we triggered
/sbin/udevadm settle
- evaluate_retval
+ log_success_msg2
;;
*)
@@ -91,4 +93,6 @@ case "${1}" in
;;
esac
+exit 0
+
# End udev
diff --git a/bootscripts/lfs/init.d/udev_retry b/bootscripts/lfs/init.d/udev_retry
index faad2a4c9..8abf3da64 100644
--- a/bootscripts/lfs/init.d/udev_retry
+++ b/bootscripts/lfs/init.d/udev_retry
@@ -5,6 +5,7 @@
# Description : Udev cold-plugging script (retry)
#
# Authors : Alexander E. Patrakov
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
@@ -26,17 +27,17 @@
# X-LFS-Provided-By: LFS
### END INIT INFO
-. /lib/boot/functions
+. /lib/lsb/init-functions
case "${1}" in
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
# read-write":
- for file in ${RUNDIR}/tmp-rules--*; do
+ for file in ${rundir}/tmp-rules--*; do
dest=${file##*tmp-rules--}
[ "$dest" = '*' ] && break
cat $file >> /etc/udev/rules.d/$dest
@@ -57,4 +58,6 @@ case "${1}" in
;;
esac
+exit 0
+
# End udev_retry
diff --git a/bootscripts/lfs/lib/services/init-functions b/bootscripts/lfs/lib/services/init-functions
new file mode 100644
index 000000000..02d0c876d
--- /dev/null
+++ b/bootscripts/lfs/lib/services/init-functions
@@ -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
diff --git a/bootscripts/lfs/lib/services/ipv4-static b/bootscripts/lfs/lib/services/ipv4-static
new file mode 100755
index 000000000..5a5693d09
--- /dev/null
+++ b/bootscripts/lfs/lib/services/ipv4-static
@@ -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
diff --git a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route b/bootscripts/lfs/lib/services/ipv4-static-route
index a85cfacf2..c4d433d2a 100644..100755
--- a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route
+++ b/bootscripts/lfs/lib/services/ipv4-static-route
@@ -1,17 +1,18 @@
#!/bin/sh
########################################################################
-# Begin /lib/boot/ipv4-static-route
+# Begin /lib/services/ipv4-static-route
#
# Description : IPV4 Static Route Script
#
# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org
+# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
-. /lib/boot/functions
+. /lib/lsb/init-functions
. ${IFCONFIG}
case "${TYPE}" in
@@ -37,22 +38,19 @@ case "${TYPE}" in
;;
(*)
- boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
+ log_failure_msg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue."
exit 1
;;
esac
if [ -n "${need_ip}" ]; then
if [ -z "${IP}" ]; then
- boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
+ log_failure_msg "IP variable missing from ${IFCONFIG}, cannot continue."
exit 1
fi
if [ -z "${PREFIX}" ]; then
- boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
+ log_failure_msg "PREFIX variable missing from ${IFCONFIG}, cannot continue."
exit 1
fi
@@ -62,8 +60,7 @@ fi
if [ -n "${need_gateway}" ]; then
if [ -z "${GATEWAY}" ]; then
- boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
- echo_failure
+ log_failure_msg "GATEWAY variable missing from ${IFCONFIG}, cannot continue."
exit 1
fi
args="${args} via ${GATEWAY}"
@@ -75,13 +72,13 @@ fi
case "${2}" in
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}
evaluate_retval
;;
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}
evaluate_retval
;;
@@ -92,4 +89,4 @@ case "${2}" in
;;
esac
-# End /bib/boot/ipv4-static-route
+# End /lib/services/ipv4-static-route
diff --git a/bootscripts/lfs/sbin/ifdown b/bootscripts/lfs/sbin/ifdown
new file mode 100755
index 000000000..0ec9867f3
--- /dev/null
+++ b/bootscripts/lfs/sbin/ifdown
@@ -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
diff --git a/bootscripts/lfs/sbin/ifup b/bootscripts/lfs/sbin/ifup
new file mode 100755
index 000000000..e808045f2
--- /dev/null
+++ b/bootscripts/lfs/sbin/ifup
@@ -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
diff --git a/bootscripts/lfs/sbin/ifup.8 b/bootscripts/lfs/sbin/ifup.8
new file mode 100644
index 000000000..3520d4240
--- /dev/null
+++ b/bootscripts/lfs/sbin/ifup.8
@@ -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)
diff --git a/bootscripts/lfs/sysconfig/createfiles b/bootscripts/lfs/sysconfig/createfiles
index 8320c79ae..9706346df 100644
--- a/bootscripts/lfs/sysconfig/createfiles
+++ b/bootscripts/lfs/sysconfig/createfiles
@@ -8,21 +8,24 @@
# Version : 00.00
#
# Notes : The syntax of this file is as follows:
-# if type is equal to "file" or "dir"
-# <filename> <type> <permissions> <user> <group>
-# if type is equal to "dev"
-# <filename> <type> <permissions> <user> <group> <devtype> <major> <minor>
+# if type is equal to "file" or "dir"
+# <filename> <type> <permissions> <user> <group>
+# if type is equal to "dev"
+# <filename> <type> <permissions> <user> <group> <devtype>
+# <major> <minor>
#
-# <filename> is the name of the file which is to be created
-# <type> is either file, dir, or dev.
-# file creates a new file
-# dir creates a new directory
-# dev creates a new device
-# <devtype> is either block, char or pipe
-# block creates a block device
-# char creates a character deivce
-# pipe creates a pipe, this will ignore the <major> and <minor> fields
-# <major> and <minor> are the major and minor numbers used for the device.
+# <filename> is the name of the file which is to be created
+# <type> is either file, dir, or dev.
+# file creates a new file
+# dir creates a new directory
+# dev creates a new device
+# <devtype> is either block, char or pipe
+# block creates a block device
+# char creates a character deivce
+# pipe creates a pipe, this will ignore the <major> and
+# <minor> fields
+# <major> and <minor> are the major and minor numbers used for
+# the device.
########################################################################
# End /etc/sysconfig/createfiles
diff --git a/bootscripts/lfs/sysconfig/network-devices/ifdown b/bootscripts/lfs/sysconfig/network-devices/ifdown
deleted file mode 100644
index 8ca91268a..000000000
--- a/bootscripts/lfs/sysconfig/network-devices/ifdown
+++ /dev/null
@@ -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
diff --git a/bootscripts/lfs/sysconfig/network-devices/ifup b/bootscripts/lfs/sysconfig/network-devices/ifup
deleted file mode 100644
index 3049a5c3d..000000000
--- a/bootscripts/lfs/sysconfig/network-devices/ifup
+++ /dev/null
@@ -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
diff --git a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static b/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static
deleted file mode 100644
index aeb5c1a9a..000000000
--- a/bootscripts/lfs/sysconfig/network-devices/services/ipv4-static
+++ /dev/null
@@ -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
diff --git a/bootscripts/lfs/sysconfig/rc b/bootscripts/lfs/sysconfig/rc
index 2333ff488..717d8c544 100644
--- a/bootscripts/lfs/sysconfig/rc
+++ b/bootscripts/lfs/sysconfig/rc
@@ -7,7 +7,7 @@
#
# Version : 00.00
#
-# Notes :
+# Notes : Not used by LFS, but present for BLFS compatibility
#
########################################################################
diff --git a/bootscripts/lfs/sysconfig/rc.site b/bootscripts/lfs/sysconfig/rc.site
new file mode 100644
index 000000000..b068d36c6
--- /dev/null
+++ b/bootscripts/lfs/sysconfig/rc.site
@@ -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=
+
diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml
index 24f690e10..77b2ce711 100644
--- a/chapter01/changelog.xml
+++ b/chapter01/changelog.xml
@@ -37,6 +37,46 @@
-->
<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>
<para>2011-09-04</para>
<itemizedlist>
<listitem>
diff --git a/chapter05/binutils-pass2.xml b/chapter05/binutils-pass2.xml
index 3e6822339..148e3b6cf 100644
--- a/chapter05/binutils-pass2.xml
+++ b/chapter05/binutils-pass2.xml
@@ -52,10 +52,10 @@ cd ../binutils-build</userinput></screen>
<screen><userinput remap="configure">CC="$LFS_TGT-gcc -B/tools/lib/" \
AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib \
-<!-- ../binutils-&binutils-version;/configure - -prefix=/tools \ -->
../binutils-&binutils-dir;/configure --prefix=/tools \
--disable-nls --with-lib-path=/tools/lib</userinput></screen>
+<!-- ../binutils-&binutils-version;/configure - -prefix=/tools \ -->
<variablelist>
<title>The meaning of the new configure options:</title>
diff --git a/chapter06/udev.xml b/chapter06/udev.xml
index 164c7eb4f..275878105 100644
--- a/chapter06/udev.xml
+++ b/chapter06/udev.xml
@@ -41,6 +41,12 @@
<sect2 role="installation">
<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
Udev. Unpack it into the Udev source directory:</para>
diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml
index 151706572..802012b30 100644
--- a/chapter07/bootscripts.xml
+++ b/chapter07/bootscripts.xml
@@ -58,7 +58,8 @@
ifup, localnet, modules, mountfs, mountkernfs, network, rc, reboot,
sendsignals, setclock, static, swap, sysctl, sysklogd, template,
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>
</segmentedlist>
diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml
index dbf20b74d..d312ef9ad 100644
--- a/chapter07/chapter07.xml
+++ b/chapter07/chapter07.xml
@@ -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="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="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="inputrc.xml"/>
diff --git a/chapter07/network.xml b/chapter07/network.xml
index a13af483d..8bb099adf 100644
--- a/chapter07/network.xml
+++ b/chapter07/network.xml
@@ -157,7 +157,7 @@ EOF</userinput></screen>
<para>The <envar>SERVICE</envar> variable defines the method used for
obtaining the IP address. The LFS-Bootscripts package has a modular IP
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
Protocol (DHCP), which is addressed in the BLFS book.</para>
diff --git a/chapter07/setclock.xml b/chapter07/setclock.xml
index 8acd27e54..f8a03579b 100644
--- a/chapter07/setclock.xml
+++ b/chapter07/setclock.xml
@@ -63,6 +63,6 @@ EOF</userinput></screen>
time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
<note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set
- in the <filename>/etc/sysconfig/init_params</filename> file.</para></note>
+ in the <filename>/etc/sysconfig/rc.site</filename> file.</para></note>
</sect1>
diff --git a/chapter07/site.xml b/chapter07/site.xml
new file mode 100644
index 000000000..8c36fe0b8
--- /dev/null
+++ b/chapter07/site.xml
@@ -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>
+
diff --git a/chapter07/sysklogd.xml b/chapter07/sysklogd.xml
index fe5de2503..c2d784b67 100644
--- a/chapter07/sysklogd.xml
+++ b/chapter07/sysklogd.xml
@@ -19,8 +19,8 @@
<command>syslogd</command> program with the <parameter>-m 0</parameter>
option. This option turns off the periodic timestamp mark that
<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
- <filename>/etc/sysconfig/init_params</filename> and define the variable
+ default. If you want to turn on this periodic timestamp mark, edit
+ <filename>/etc/sysconfig/rc.site</filename> and define the variable
SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters,
set the variable to a null value:</para>
diff --git a/chapter07/usage.xml b/chapter07/usage.xml
index a679381c5..a40ce3be8 100644
--- a/chapter07/usage.xml
+++ b/chapter07/usage.xml
@@ -59,7 +59,7 @@
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
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>
<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,
<filename>/etc/sysconfig/init_params</filename>. Any of the system
configuration file parameters described in subsequent sections can be
diff --git a/general.ent b/general.ent
index 4233b6514..01d4d4662 100644
--- a/general.ent
+++ b/general.ent
@@ -1,5 +1,5 @@
-<!ENTITY version "SVN-20110904">
-<!ENTITY releasedate "Sep 4, 2011">
+<!ENTITY version "SVN-20110918">
+<!ENTITY releasedate "Sep 18, 2011">
<!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not &ndash; -->
<!ENTITY milestone "7.0">
<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->
diff --git a/packages.ent b/packages.ent
index 7625671c4..a372bf421 100644
--- a/packages.ent
+++ b/packages.ent
@@ -298,7 +298,7 @@
<!ENTITY less-ch6-du "3.5 MB">
<!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-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2">
<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!-- Updated in Makefile -->
diff --git a/process-scripts.sh b/process-scripts.sh
index 44518c423..15c1ead0d 100644
--- a/process-scripts.sh
+++ b/process-scripts.sh
@@ -3,14 +3,14 @@
# Boot scripts
for s in bootscripts/lfs/init.d/* \
bootscripts/lfs/sysconfig/* \
- bootscripts/lfs/sysconfig/network-devices/* \
- bootscripts/lfs/sysconfig/network-devices/services/*
+ bootscripts/lfs/lib/services/* \
+ bootscripts/lfs/sbin/*
do
script=$(basename $s)
# Skip directories
[ $script == 'network-devices' ] && continue
- [ $script == 'services' ] && continue
+ #[ $script == 'services' ] && continue
# Disambiguate duplicate file names
[ $s == 'bootscripts/lfs/sysconfig/rc' ] && script='rc-sysinit';