Ignore:
Timestamp:
08/02/2011 02:15:42 AM (13 years ago)
Author:
Bruce Dubbs <bdubbs@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 12.2, 12.2-rc1, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/loongarch-12.2, xry111/mips64el, xry111/multilib, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
a2e555d
Parents:
75fe599
Message:

Rewrite bootscripts and Chaper 7

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9574 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bootscripts/lfs/init.d/modules

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/modules
     3# Begin modules
    44#
    55# Description : Module auto-loading script
    66#
    77# Authors     : Zack Winkles
     8# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    89#
    9 # Version     : 00.00
    10 #
    11 # Notes       :
     10# Version     : LFS 7.0
    1211#
    1312########################################################################
    1413
    15 . /etc/sysconfig/rc
    16 . ${rc_functions}
     14### BEGIN INIT INFO
     15# Provides:            modules
     16# Required-Start:      mountvirtfs sysctl
     17# Should-Start:
     18# Required-Stop:
     19# Should-Stop:
     20# Default-Start:       S
     21# Default-Stop:
     22# Short-Description:   Loads required modules.
     23# Description:         Loads modules listed in /etc/sysconfig/modules.
     24# X-LFS-Provided-By:   LFS
     25### END INIT INFO
     26
     27. /lib/boot/functions
    1728
    1829# Assure that the kernel has module support.
     
    2031
    2132case "${1}" in
    22         start)
     33   start)
     34      # Exit if there's no modules file or there are no
     35      # valid entries
     36      [ -r /etc/sysconfig/modules ] &&
     37         egrep -qv '^($|#)' /etc/sysconfig/modules ||
     38         exit 0
    2339
    24                 # Exit if there's no modules file or there are no
    25                 # valid entries
    26                 [ -r /etc/sysconfig/modules ] &&
    27                         egrep -qv '^($|#)' /etc/sysconfig/modules ||
    28                         exit 0
     40      boot_mesg -n "Loading modules:" ${INFO}
    2941
    30                 boot_mesg -n "Loading modules:" ${INFO}
     42      # Only try to load modules if the user has actually given us
     43      # some modules to load.
     44      while read module args; do
    3145
    32                 # Only try to load modules if the user has actually given us
    33                 # some modules to load.
    34                 while read module args; do
     46         # Ignore comments and blank lines.
     47         case "$module" in
     48            ""|"#"*) continue ;;
     49         esac
    3550
    36                         # Ignore comments and blank lines.
    37                         case "$module" in
    38                                 ""|"#"*) continue ;;
    39                         esac
     51         # Attempt to load the module, making
     52         # sure to pass any arguments provided.
     53         modprobe ${module} ${args} >/dev/null
    4054
    41                         # Attempt to load the module, making
    42                         # sure to pass any arguments provided.
    43                         modprobe ${module} ${args} >/dev/null
     55         # Print the module name if successful,
     56         # otherwise take note.
     57         if [ $? -eq 0 ]; then
     58            boot_mesg -n " ${module}" ${NORMAL}
     59         else
     60            failedmod="${failedmod} ${module}"
     61         fi
     62      done < /etc/sysconfig/modules
    4463
    45                         # Print the module name if successful,
    46                         # otherwise take note.
    47                         if [ $? -eq 0 ]; then
    48                                 boot_mesg -n " ${module}" ${NORMAL}
    49                         else
    50                                 failedmod="${failedmod} ${module}"
    51                         fi
    52                 done < /etc/sysconfig/modules
     64      boot_mesg "" ${NORMAL}
     65      # Print a message about successfully loaded
     66      # modules on the correct line.
     67      echo_ok
    5368
    54                 boot_mesg "" ${NORMAL}
    55                 # Print a message about successfully loaded
    56                 # modules on the correct line.
    57                 echo_ok
     69      # Print a failure message with a list of any
     70      # modules that may have failed to load.
     71      if [ -n "${failedmod}" ]; then
     72         boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
     73         echo_failure
     74      fi
     75      ;;
    5876
    59                 # Print a failure message with a list of any
    60                 # modules that may have failed to load.
    61                 if [ -n "${failedmod}" ]; then
    62                         boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
    63                         echo_failure
    64                 fi
    65                 ;;
    66         *)
    67                 echo "Usage: ${0} {start}"
    68                 exit 1
    69                 ;;
     77   *)
     78      echo "Usage: ${0} {start}"
     79      exit 1
     80      ;;
    7081esac
    7182
    72 # End $rc_base/init.d/modules
     83# End modules
Note: See TracChangeset for help on using the changeset viewer.