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 + * 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 * When shutting down the network, ignore invalid interfaces or interfaces that are not UP. diff --git a/bootscripts/Makefile b/bootscripts/Makefile index 50b63ad3b..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 @@ -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 @@ -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: 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 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/network b/bootscripts/lfs/init.d/network index c60b9ff5b..5b2dd9b97 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 @@ -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 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=${?} 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 ;; 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 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) 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 # # # 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. --> + + 2022-03-25 + + + [pierre] - Update bootscripts to 20220324. Fixes + #5027. + + + + 2022-03-20 diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index f39141c63..4bfff53ba 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -80,7 +80,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 30ccd8043..d4eff38ae 100644 --- a/chapter07/cleanup.xml +++ b/chapter07/cleanup.xml @@ -87,7 +87,7 @@ 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 f3425882e..ce8e761bb 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/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> 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> diff --git a/packages.ent b/packages.ent index be0174b35..3408370cf 100644 --- a/packages.ent +++ b/packages.ent @@ -389,7 +389,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">