From 63107f4bc51be166cf824931968cb8d81a083ea7 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 25 Mar 2022 01:03:13 +0800 Subject: [PATCH 01/17] fix typos Suggested-by: rhubarbpieguy --- chapter05/glibc.xml | 2 +- chapter07/cleanup.xml | 2 +- chapter07/util-linux.xml | 2 +- chapter08/glibc.xml | 2 +- chapter08/jinja2.xml | 2 +- chapter08/libffi.xml | 2 +- chapter08/stripping.xml | 2 +- chapter09/systemd-custom.xml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 5c4e27119..e3685c4e4 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -78,7 +78,7 @@ esac cd build Ensure that the ldconfig and sln - utilites are installed into + utilities are installed into /usr/sbin: echo "rootsbindir=/usr/sbin" > configparms diff --git a/chapter07/cleanup.xml b/chapter07/cleanup.xml index e5bdd1c04..651f2e8d6 100644 --- a/chapter07/cleanup.xml +++ b/chapter07/cleanup.xml @@ -123,7 +123,7 @@ umount $LFS/{sys,proc,run,dev} Because the backup archive is compressed, it takes a relatively - long time (over 10 minutes) even on a resonably fast system. + long time (over 10 minutes) even on a reasonably fast system. diff --git a/chapter07/util-linux.xml b/chapter07/util-linux.xml index 8295d0d8e..9adf2995c 100644 --- a/chapter07/util-linux.xml +++ b/chapter07/util-linux.xml @@ -72,7 +72,7 @@ ADJTIME_PATH=/var/lib/hwclock/adjtime This sets the location of the file recording information about - the hardware clock in accordance to the FHS. This is not stricly + the hardware clock in accordance to the FHS. This is not strictly needed for this temporary tool, but it prevents creating a file at another location, which would not be overwritten or removed when building the final util-linux package. diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index 4e241b40f..be7d646d0 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -63,7 +63,7 @@ cd build Ensure that the ldconfig and sln - utilites will be installed into + utilities will be installed into /usr/sbin: echo "rootsbindir=/usr/sbin" > configparms diff --git a/chapter08/jinja2.xml b/chapter08/jinja2.xml index 5e38154ad..3ac2bdb41 100644 --- a/chapter08/jinja2.xml +++ b/chapter08/jinja2.xml @@ -24,7 +24,7 @@ <para>Jinja2 is a Python module that implements a simple pythonic template - lanuage.</para> + language.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> diff --git a/chapter08/libffi.xml b/chapter08/libffi.xml index 925cf818a..d71f8d2e6 100644 --- a/chapter08/libffi.xml +++ b/chapter08/libffi.xml @@ -44,7 +44,7 @@ <note> <para>Similar to GMP, libffi builds with optimizations specific - to the proccesor in use. If building for another system, export + to the processor in use. If building for another system, export CFLAGS and CXXFLAGS to specify a generic build for your architecture. If this is not done, all applications that link to libffi will trigger Illegal Operation Errors.</para> diff --git a/chapter08/stripping.xml b/chapter08/stripping.xml index 22b34562a..e7ab14f6d 100644 --- a/chapter08/stripping.xml +++ b/chapter08/stripping.xml @@ -41,7 +41,7 @@ rationale to use the <command>install</command> command here.</para> <note><para>The ELF loader's name is ld-linux-x86-64.so.2 on 64-bit systems - and ld-linux.so.2 on 32-bit systems. The contruct below selects the + and ld-linux.so.2 on 32-bit systems. The construct below selects the correct name for the current architecture.</para></note> <!-- also of interest are libgfortan, libgo, libgomp, and libobjc from GCC --> diff --git a/chapter09/systemd-custom.xml b/chapter09/systemd-custom.xml index 085b983c5..22fb32525 100644 --- a/chapter09/systemd-custom.xml +++ b/chapter09/systemd-custom.xml @@ -163,7 +163,7 @@ EOF</userinput></screen> <listitem> <para><command>systemctl show -p Wants <replaceable><multi-user.target></replaceable></command>: shows all units that depend on the multi-user target. Targets are - special unit files that are anogalous to runlevels under + special unit files that are analogous to runlevels under SysVinit.</para> </listitem> <listitem> From b8a2b7e20149b2d05f7b89617046696656d34a13 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao <xry111@mengyan1223.wang> Date: Fri, 25 Mar 2022 01:08:43 +0800 Subject: [PATCH 02/17] inputrc: "8bit" -> "8-bit" The info page of readline says "eight-bit", so I guess a dash is proper. Suggested-by: rhubarbpieguy <rhubarbpieguy@vivaldi.net> --- chapter09/inputrc.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter09/inputrc.xml b/chapter09/inputrc.xml index de5401d2c..cf501c393 100644 --- a/chapter09/inputrc.xml +++ b/chapter09/inputrc.xml @@ -42,7 +42,7 @@ # Allow the command prompt to wrap to the next line set horizontal-scroll-mode Off -# Enable 8bit input +# Enable 8-bit input set meta-flag On set input-meta On From bcb20b4701e957f150c8358a919093aa5d3fd8f0 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs <bdubbs@linuxfromscratch.org> Date: Thu, 24 Mar 2022 12:11:57 -0500 Subject: [PATCH 03/17] Speling --- chapter05/glibc.xml | 2 +- chapter07/cleanup.xml | 2 +- chapter07/util-linux.xml | 2 +- chapter08/glibc.xml | 2 +- chapter08/jinja2.xml | 2 +- chapter08/libffi.xml | 2 +- chapter08/stripping.xml | 2 +- chapter09/inputrc.xml | 2 +- chapter09/systemd-custom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 5c4e27119..e3685c4e4 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -78,7 +78,7 @@ esac</userinput></screen> cd build</userinput></screen> <para>Ensure that the <command>ldconfig</command> and <command>sln</command> - utilites are installed into + utilities are installed into <filename class="directory">/usr/sbin</filename>:</para> <screen><userinput remap="pre">echo "rootsbindir=/usr/sbin" > configparms</userinput></screen> diff --git a/chapter07/cleanup.xml b/chapter07/cleanup.xml index e5bdd1c04..651f2e8d6 100644 --- a/chapter07/cleanup.xml +++ b/chapter07/cleanup.xml @@ -123,7 +123,7 @@ umount $LFS/{sys,proc,run,dev}</userinput></screen> <note> <para> Because the backup archive is compressed, it takes a relatively - long time (over 10 minutes) even on a resonably fast system. + long time (over 10 minutes) even on a reasonably fast system. </para> </note> diff --git a/chapter07/util-linux.xml b/chapter07/util-linux.xml index 8295d0d8e..9adf2995c 100644 --- a/chapter07/util-linux.xml +++ b/chapter07/util-linux.xml @@ -72,7 +72,7 @@ <term><parameter>ADJTIME_PATH=/var/lib/hwclock/adjtime</parameter></term> <listitem> <para>This sets the location of the file recording information about - the hardware clock in accordance to the FHS. This is not stricly + the hardware clock in accordance to the FHS. This is not strictly needed for this temporary tool, but it prevents creating a file at another location, which would not be overwritten or removed when building the final util-linux package.</para> diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml index 4e241b40f..be7d646d0 100644 --- a/chapter08/glibc.xml +++ b/chapter08/glibc.xml @@ -63,7 +63,7 @@ cd build</userinput></screen> <para>Ensure that the <command>ldconfig</command> and <command>sln</command> - utilites will be installed into + utilities will be installed into <filename class="directory">/usr/sbin</filename>:</para> <screen><userinput remap="pre">echo "rootsbindir=/usr/sbin" > configparms</userinput></screen> diff --git a/chapter08/jinja2.xml b/chapter08/jinja2.xml index 5e38154ad..3ac2bdb41 100644 --- a/chapter08/jinja2.xml +++ b/chapter08/jinja2.xml @@ -24,7 +24,7 @@ <title/> <para>Jinja2 is a Python module that implements a simple pythonic template - lanuage.</para> + language.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> diff --git a/chapter08/libffi.xml b/chapter08/libffi.xml index 925cf818a..d71f8d2e6 100644 --- a/chapter08/libffi.xml +++ b/chapter08/libffi.xml @@ -44,7 +44,7 @@ <note> <para>Similar to GMP, libffi builds with optimizations specific - to the proccesor in use. If building for another system, export + to the processor in use. If building for another system, export CFLAGS and CXXFLAGS to specify a generic build for your architecture. If this is not done, all applications that link to libffi will trigger Illegal Operation Errors.</para> diff --git a/chapter08/stripping.xml b/chapter08/stripping.xml index 22b34562a..e7ab14f6d 100644 --- a/chapter08/stripping.xml +++ b/chapter08/stripping.xml @@ -41,7 +41,7 @@ rationale to use the <command>install</command> command here.</para> <note><para>The ELF loader's name is ld-linux-x86-64.so.2 on 64-bit systems - and ld-linux.so.2 on 32-bit systems. The contruct below selects the + and ld-linux.so.2 on 32-bit systems. The construct below selects the correct name for the current architecture.</para></note> <!-- also of interest are libgfortan, libgo, libgomp, and libobjc from GCC --> diff --git a/chapter09/inputrc.xml b/chapter09/inputrc.xml index de5401d2c..cf501c393 100644 --- a/chapter09/inputrc.xml +++ b/chapter09/inputrc.xml @@ -42,7 +42,7 @@ # Allow the command prompt to wrap to the next line set horizontal-scroll-mode Off -# Enable 8bit input +# Enable 8-bit input set meta-flag On set input-meta On diff --git a/chapter09/systemd-custom.xml b/chapter09/systemd-custom.xml index 085b983c5..22fb32525 100644 --- a/chapter09/systemd-custom.xml +++ b/chapter09/systemd-custom.xml @@ -163,7 +163,7 @@ EOF</userinput></screen> <listitem> <para><command>systemctl show -p Wants <replaceable><multi-user.target></replaceable></command>: shows all units that depend on the multi-user target. Targets are - special unit files that are anogalous to runlevels under + special unit files that are analogous to runlevels under SysVinit.</para> </listitem> <listitem> From a18e40dbc8ea9ea033fe6fb242fbc2837d025b28 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 10:42:25 +0100 Subject: [PATCH 04/17] Typo in init-functions --- bootscripts/lfs/lib/services/init-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootscripts/lfs/lib/services/init-functions b/bootscripts/lfs/lib/services/init-functions index d0c86cb03..ece4d79aa 100644 --- a/bootscripts/lfs/lib/services/init-functions +++ b/bootscripts/lfs/lib/services/init-functions @@ -700,7 +700,7 @@ log_info_msg2() ################################################################################ # evaluate_retval() # -# Usage: Evaluate a return value and print success or failyure as appropriate # +# Usage: Evaluate a return value and print success or failure as appropriate # # # # Purpose: Convenience function to terminate an info message # # # From 9d830193559a2d40bdfa7e7bcf5a99f66b128ccf Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 10:45:10 +0100 Subject: [PATCH 05/17] Make runlevel 2 equivalent to 3 by default: sysklogd --- bootscripts/lfs/init.d/sysklogd | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bootscripts/lfs/init.d/sysklogd b/bootscripts/lfs/init.d/sysklogd index a3d37686e..e86b87b16 100644 --- a/bootscripts/lfs/init.d/sysklogd +++ b/bootscripts/lfs/init.d/sysklogd @@ -18,17 +18,14 @@ # Should-Start: # Required-Stop: $local_fs # Should-Stop: sendsignals -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: Starts kernel and system log daemons. # Description: Starts kernel and system log daemons. # /etc/fstab. # X-LFS-Provided-By: LFS ### END INIT INFO -# Note: sysklogd is not started in runlevel 2 due to possible -# remote logging configurations - . /lib/lsb/init-functions case "${1}" in From 96a636b0007708b50d3a376192a13956b665b5e9 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 10:46:19 +0100 Subject: [PATCH 06/17] Make runlevel 2 equivalent to 3 by default: network --- bootscripts/lfs/init.d/network | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootscripts/lfs/init.d/network b/bootscripts/lfs/init.d/network index c60b9ff5b..91c52e085 100644 --- a/bootscripts/lfs/init.d/network +++ b/bootscripts/lfs/init.d/network @@ -20,8 +20,8 @@ # Should-Start: $syslog firewalld iptables nftables # Required-Stop: $local_fs localnet swap # Should-Stop: $syslog firewalld iptables nftables -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: Starts and configures network interfaces. # Description: Starts and configures network interfaces. # X-LFS-Provided-By: LFS From db7c8be8ae1982e17da3db180c577ab5877e4391 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 10:47:08 +0100 Subject: [PATCH 07/17] Make runlevel 2 equivalent to 3 by default: Makefile --- bootscripts/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootscripts/Makefile b/bootscripts/Makefile index 50b63ad3b..4a962ed56 100644 --- a/bootscripts/Makefile +++ b/bootscripts/Makefile @@ -99,8 +99,8 @@ rc1: files ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc1.d/K90sysklogd rc2: files - ln -sf ../init.d/network ${ETCDIR}/rc.d/rc2.d/K80network - ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc2.d/K90sysklogd + ln -sf ../init.d/network ${ETCDIR}/rc.d/rc2.d/S10network + ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc2.d/S20sysklogd rc3: files ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc3.d/S10sysklogd From 17c6532e0fa4afcec0797d206a0c88f37c2d0759 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 10:48:29 +0100 Subject: [PATCH 08/17] Do not redefine is_true in the console script There is a better version in init-functions --- bootscripts/lfs/init.d/console | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bootscripts/lfs/init.d/console b/bootscripts/lfs/init.d/console index 6eb111640..a5338cc71 100644 --- a/bootscripts/lfs/init.d/console +++ b/bootscripts/lfs/init.d/console @@ -32,11 +32,6 @@ # Native English speakers probably don't have /etc/sysconfig/console at all [ -r /etc/sysconfig/console ] && . /etc/sysconfig/console -is_true() -{ - [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] -} - failed=0 case "${1}" in From 27d23b1d4161c092a4a58391ad2ad92c8b5c4844 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 11:13:19 +0100 Subject: [PATCH 09/17] Change semantics of S and K files Presently, there are a lot of special cases: - runlevel 0 and 6 unconditionally run "script stop" if they find a Kxxscript symlink. This may lead to trying to stop an already stopped device if for example switching to runlevel 0/6 from runlevel 1. This can be fixed by stating the convention that it is the responsability of scripts to check that the service is running before killing it (or not running before starting it). Still, we shouldn't try to stop a service if it was marked K in the previous runlevel. And same for S files: we shouldn't try to start a service that was marked S in the previous runlevel. Note that changing runlevel is not a "reset": if a user has manually changed the state of a daemon, this state will remain the same upon changing runlevel if the S/K status of that dameon is the same in both runlevels. - Sxxscript symlinks in runlevel 0/6 are run as "script stop" instead of the more intuitive "script start". This does not interact well with LSB-tools (some scripts would need "Default-Start: S 0 6" but then it is impossible to get correct "Required-Start" or "Should-Start" fields). Furthermore, having a counter-intuitive behavior is error prone. So now runlevel 0/6 will run "script sart" for a Sxxscript. --- bootscripts/lfs/init.d/rc | 61 +++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 35 deletions(-) diff --git a/bootscripts/lfs/init.d/rc b/bootscripts/lfs/init.d/rc index 25b48eec3..7dd503a07 100644 --- a/bootscripts/lfs/init.d/rc +++ b/bootscripts/lfs/init.d/rc @@ -6,10 +6,18 @@ # # Authors : Gerard Beekmans - gerard@linuxfromscratch.org # : DJ Lucas - dj@linuxfromscratch.org -# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# Updates : Bruce Dubbs - bdubbs@linuxfromscratch.org +# : Pierre Labastie - pierre@linuxfromscratch.org # # Version : LFS 7.0 # +# Notes : Updates March 24th, 2022: new semantics of S/K files +# - Instead of testing that S scripts were K scripts in the +# previous runlevel, test that they were not S scripts +# - Instead of testing that K scripts were S scripts in the +# previous runlevel, test that they were not K scripts +# - S scripts in runlevel 0 or 6 are now run with +# "script start" (was "script stop" previously). ######################################################################## . /lib/lsb/init-functions @@ -144,8 +152,9 @@ fi # Read the state file if it exists from runlevel S [ -r /run/interactive ] && source /run/interactive -# Attempt to stop all services started by the previous runlevel, -# and killed in this runlevel +# Stop all services marked as K, except if marked as K in the previous +# runlevel: it is the responsibility of the script to not try to kill +# a non running service if [ "${previous}" != "N" ]; then for i in $(ls -v /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null) do @@ -155,20 +164,8 @@ if [ "${previous}" != "N" ]; then continue fi - 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/rcS.d/S[0-9][0-9]$suffix - - if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then - if [ ! -f ${prev_start} -a ! -f ${sysinit_start} ]; then - 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 + suffix=${i#/etc/rc.d/rc${runlevel}.d/K[0-9][0-9]} + [ -e /etc/rc.d/rc${previous}.d/K[0-9][0-9]$suffix ] && continue run ${i} stop error_value=${?} @@ -184,31 +181,25 @@ if [ "$runlevel" == "6" -a -n "${FASTBOOT}" ]; then fi -# Start all functions in this runlevel +# Start all services marked as S in this runlevel, except if marked as +# S in the previous runlevel +# it is the responsabily of the script to not try to start an already running +# service for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null) do - if [ "${previous}" != "N" ]; then - suffix=${i#/etc/rc.d/rc$runlevel.d/S[0-9][0-9]} - stop=/etc/rc.d/rc$runlevel.d/K[0-9][0-9]$suffix - prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix - [ -f ${prev_start} -a ! -f ${stop} ] && continue + if [ "${previous}" != "N" ]; then + suffix=${i#/etc/rc.d/rc${runlevel}.d/S[0-9][0-9]} + [ -e /etc/rc.d/rc${previous}.d/S[0-9][0-9]$suffix ] && continue fi check_script_status - if [ "${SCRIPT_STAT}" == "1" ]; then - SCRIPT_STAT="0" - continue - fi + if [ "${SCRIPT_STAT}" == "1" ]; then + SCRIPT_STAT="0" + continue + fi - case ${runlevel} in - 0|6) - run ${i} stop - ;; - *) - run ${i} start - ;; - esac + run ${i} start error_value=${?} From 887af775a52a78e1e1552b5c0b83aaa5b98fa1a2 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 11:30:52 +0100 Subject: [PATCH 10/17] Adapt template to new semantics of S/K symlinks --- bootscripts/lfs/init.d/template | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bootscripts/lfs/init.d/template b/bootscripts/lfs/init.d/template index 59c5f3cba..0a7872d98 100644 --- a/bootscripts/lfs/init.d/template +++ b/bootscripts/lfs/init.d/template @@ -30,12 +30,26 @@ case "${1}" in start) log_info_msg "Starting..." + # if it is possible to use start_daemon start_daemon fully_qualified_path + # if it is not possible to use start_daemon + # (command to start the daemon is not simple enough) + if ! pidofproc daemon_name_as_reported_by_ps >/dev/null; then + command_to_start_the_service + fi + evaluate_retval ;; stop) log_info_msg "Stopping..." + # if it is possible to use killproc killproc fully_qualified_path + # if it is not possible to use killproc + # (the daemon shoudn't be stopped by killing it) + if pidofproc daemon_name_as_reported_by_ps >/dev/null; then + command_to_stop_the_service + fi + evaluate_retval ;; restart) From 3b20f597b2e75d8cbdaa41f2618eb6c899af14b7 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 11:33:31 +0100 Subject: [PATCH 11/17] Fix Makefile for new semantics of S/K symlinks In runlevel 0/6, services which must be stopped should be with Kxx symlinks --- bootscripts/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bootscripts/Makefile b/bootscripts/Makefile index 4a962ed56..2e8476d13 100644 --- a/bootscripts/Makefile +++ b/bootscripts/Makefile @@ -88,10 +88,10 @@ rcS: files rc0: files ln -sf ../init.d/network ${ETCDIR}/rc.d/rc0.d/K80network ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc0.d/K90sysklogd - ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc0.d/S60sendsignals - ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc0.d/S65swap - ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc0.d/S70mountfs - ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc0.d/S90localnet + ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc0.d/K92sendsignals + ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc0.d/K94swap + ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc0.d/K96mountfs + ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc0.d/K98localnet ln -sf ../init.d/halt ${ETCDIR}/rc.d/rc0.d/S99halt rc1: files @@ -117,10 +117,10 @@ rc5: files rc6: files ln -sf ../init.d/network ${ETCDIR}/rc.d/rc6.d/K80network ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc6.d/K90sysklogd - ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc6.d/S60sendsignals - ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc6.d/S65swap - ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc6.d/S70mountfs - ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc6.d/S90localnet + ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc0.d/K92sendsignals + ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc0.d/K94swap + ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc0.d/K96mountfs + ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc0.d/K98localnet ln -sf ../init.d/reboot ${ETCDIR}/rc.d/rc6.d/S99reboot uninstall: From 253925339919fbf3b4085889c59241bf7aad96e6 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 14:29:15 +0100 Subject: [PATCH 12/17] New semantics for S/K files in boot scripts Now start and reboot should be called as "script start", and they should be the last in their runlevel. Note that install_initd needs to be patched for this to work; see https://github.com/lfs-book/LSB-Tools/pull/12 --- bootscripts/lfs/init.d/halt | 10 +++++++--- bootscripts/lfs/init.d/reboot | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/bootscripts/lfs/init.d/halt b/bootscripts/lfs/init.d/halt index f8bfc70c2..46ccecf4f 100644 --- a/bootscripts/lfs/init.d/halt +++ b/bootscripts/lfs/init.d/halt @@ -7,14 +7,18 @@ # Authors : Gerard Beekmans - gerard@linuxfromscratch.org # DJ Lucas - dj@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# : Pierre Labastie - pierre@linuxfromscratch.org # # Version : LFS 7.0 # +# Notes : Update March 24th, 2022: change "stop" to "start". +# Add the $last facility to Required-start +# ######################################################################## ### BEGIN INIT INFO # Provides: halt -# Required-Start: +# Required-Start: $last # Should-Start: # Required-Stop: # Should-Stop: @@ -26,12 +30,12 @@ ### END INIT INFO case "${1}" in - stop) + start) halt -d -f -i -p ;; *) - echo "Usage: {stop}" + echo "Usage: {start}" exit 1 ;; esac diff --git a/bootscripts/lfs/init.d/reboot b/bootscripts/lfs/init.d/reboot index 9e4dd1146..b41b03396 100644 --- a/bootscripts/lfs/init.d/reboot +++ b/bootscripts/lfs/init.d/reboot @@ -6,15 +6,19 @@ # # Authors : Gerard Beekmans - gerard@linuxfromscratch.org # DJ Lucas - dj@linuxfromscratch.org -# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org +# Updates : Bruce Dubbs - bdubbs@linuxfromscratch.org +# : Pierre Labastie - pierre@linuxfromscratch.org # # Version : LFS 7.0 # +# Notes : Update March 24th, 2022: change "stop" to "start". +# Add the $last facility to Required-start +# ######################################################################## ### BEGIN INIT INFO # Provides: reboot -# Required-Start: +# Required-Start: $last # Should-Start: # Required-Stop: # Should-Stop: @@ -28,13 +32,13 @@ . /lib/lsb/init-functions case "${1}" in - stop) + start) log_info_msg "Restarting system..." reboot -d -f -i ;; *) - echo "Usage: ${0} {stop}" + echo "Usage: ${0} {start}" exit 1 ;; From ed6ffcb2e2b4a72f8dcbe500b6887de8fa8dd361 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Wed, 23 Mar 2022 10:03:34 +0100 Subject: [PATCH 13/17] network bootscript: Don't run ifup if route already set Otherwise, warnings are issued when changing runlevel. "ip route" is a good test of whether network is already up. If users want to change some config, they should use ifup/down, not the network bootscript. --- bootscripts/lfs/init.d/network | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootscripts/lfs/init.d/network b/bootscripts/lfs/init.d/network index 91c52e085..5b2dd9b97 100644 --- a/bootscripts/lfs/init.d/network +++ b/bootscripts/lfs/init.d/network @@ -29,6 +29,8 @@ case "${1}" in start) + # if the default route exists, network is already configured + if ip route | grep -q "^default"; then return 0; fi # Start all network interfaces for file in /etc/sysconfig/ifconfig.* do From 497d43515f92ede39d15319e848f9f803ed8b8c6 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Wed, 23 Mar 2022 10:16:38 +0100 Subject: [PATCH 14/17] Remove the 0/6 exception explanation in usage.xml It's not true anymore with the new semantics of K/S files. --- chapter09/usage.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapter09/usage.xml b/chapter09/usage.xml index 33890acd2..a1c098cae 100644 --- a/chapter09/usage.xml +++ b/chapter09/usage.xml @@ -157,7 +157,7 @@ EOF</userinput></screen> script is run with the <parameter>stop</parameter> argument. When an S link is encountered, the appropriate script is run with the <parameter>start</parameter> argument.</para> - +<!-- Changed for March 24th, 2022 version of bootscripts <para>There is one exception to this explanation. Links that start with an <emphasis>S</emphasis> in the <filename class="directory">rc0.d</filename> and <filename @@ -170,7 +170,7 @@ EOF</userinput></screen> run before any <emphasis>S</emphasis> prefixed scripts are run with the <parameter>stop</parameter> parameter. </para> - +--> <para>These are descriptions of what the arguments make the scripts do:</para> From aaad26031878bba7c0114134701e51f41dd83ff0 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Fri, 25 Mar 2022 10:31:49 +0100 Subject: [PATCH 15/17] Update bootscripts/ChangeLog for recent changes --- bootscripts/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog index f8411c737..16d8e8006 100644 --- a/bootscripts/ChangeLog +++ b/bootscripts/ChangeLog @@ -1,3 +1,8 @@ +2022-03-24 Pierre Labastie <pierre dot labastie at neuf dot fr> + * New semantics for K and S scripts: + - S scripts only started if not already marked S in the previous runlevel + - K scripts only started if not already marked K in the previous runlevel + - remove the convention of running S scripts ith "stop" in rl 0/6 2021-06-08 Bruce Dubbs <bdubbs@linuxfromscratch.org> * When shutting down the network, ignore invalid interfaces or interfaces that are not UP. From 2103b64b5d9649200d4edf0f13dbb9974dba2848 Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Tue, 22 Mar 2022 14:31:52 +0100 Subject: [PATCH 16/17] Bump bootscripts version --- packages.ent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages.ent b/packages.ent index 92062c070..308968d63 100644 --- a/packages.ent +++ b/packages.ent @@ -385,7 +385,7 @@ <!ENTITY less-fin-du "4.2 MB"> <!ENTITY less-fin-sbu "less than 0.1 SBU"> -<!ENTITY lfs-bootscripts-version "20210608"> <!-- Scripts depend on this format --> +<!ENTITY lfs-bootscripts-version "20220324"> <!-- Scripts depend on this format --> <!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB"> <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.xz"> <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> From 827cc05c379bb251da3993f1ba316758ffdff87d Mon Sep 17 00:00:00 2001 From: Pierre Labastie <pierre.labastie@neuf.fr> Date: Fri, 25 Mar 2022 18:32:05 +0100 Subject: [PATCH 17/17] Upstate bootscripts to 20220324 --- chapter01/changelog.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index b6720bf67..5e062f3b1 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -40,6 +40,16 @@ appropriate for the entry or if needed the entire day's listitem. --> + <listitem> + <para>2022-03-25</para> + <itemizedlist> + <listitem> + <para>[pierre] - Update bootscripts to 20220324. Fixes + <ulink url="&lfs-ticket-root;5027">#5027</ulink>.</para> + </listitem> + </itemizedlist> + </listitem> + <listitem> <para>2022-03-20</para> <itemizedlist>