Changeset 0cda898


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, 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/mips64el, 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

Files:
4 deleted
43 edited

Legend:

Unmodified
Added
Removed
  • bootscripts/ChangeLog

    r75fe599 r0cda898  
    1 2011-05-31      DJ Lucas <dj@linuxfromscratch.org>
     12011-07-14  Bruce Dubbs <bdubbs@linuxfromscratch.org>
     2   * Major rewrite of all LFS scripts
     3   ** Move ifup/ifdown to /sbin
     4   ** Move functions and network services to /lib/boot
     5   ** Remove contrib directory
     6   ** Move all READ commands to functions and allow the user to specify
     7      HEADLESS=1 to skip READ commands
     8   ** Add /etc/sysconfig/init_params for adding environmental parameters
     9      to all functions used in bootscripts
     10   ** Move network configuration to /etc/sysconfig/ifconfig.*.  The
     11      ifconfig files can have any extention.  Use IFACE parameter to
     12      specify the target network interface within the configuration file.
     13   ** Adds an optional parameter, SKIPTMPCLEAN, to skip the removal of
     14      files in /tmp at bootup.  Specify the variable in
     15      /etc/sysconfig/init_params.
     16
     172011-05-31  DJ Lucas <dj@linuxfromscratch.org>
    218   * lfs/init.d/udev: Add multiple udev triggers for both subsystems and
    319     devices per upstream recommendation.
    420
    5 2011-04-19      Bruce Dubbs <bdubbs@linuxfromscratch.org>
     212011-04-19  Bruce Dubbs <bdubbs@linuxfromscratch.org>
    622   * lfs/init.d/mountvirtfs: Add creation of /run/{var,lock,shm}.
    723   * lfs/init.d/udev: Add /dev/shm -> /run/shm symlink.
    824
    9 2011-04-18      Bruce Dubbs <bdubbs@linuxfromscratch.org>
     252011-04-18  Bruce Dubbs <bdubbs@linuxfromscratch.org>
    1026   * lfs/init.d/mountvirtfs: Change name from mountkernfs to mountvirtfs.
    1127     Add mounting of /run filesystem.
    1228
    13 2010-05-29      Matt Burgess <matthew@linuxfromscratch.org>
     292010-05-29  Matt Burgess <matthew@linuxfromscratch.org>
    1430   * lfs/init.d/udev: Only copy /lib/udev/devices/null, as Udev >= 155 copies
    1531     devices from /lib/udev/devices to /dev itself.  Udevd still needs /dev/null
    1632     present before starting up though.
    1733
    18 2010-04-20      Bryan Kadzban <bryan@linuxfromscratch.org>
     342010-04-20  Bryan Kadzban <bryan@linuxfromscratch.org>
    1935   * lfs/init.d/udev, lfs/init.d/udev_retry: Add --action=add, to handle udev
    2036   version 152 and newer, which send "change" events by default in udevtrigger
  • bootscripts/Makefile

    r75fe599 r0cda898  
    11ETCDIR=/etc
    22EXTDIR=${DESTDIR}${ETCDIR}
     3LIBDIR=${DESTDIR}/lib/boot
    34MODE=754
    45DIRMODE=755
     
    1819        install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d
    1920        install -d -m ${DIRMODE} ${EXTDIR}/sysconfig
     21        install -d -m ${DIRMODE} ${LIBDIR}
    2022
    21 create-service-dir:
    22         install -d -m ${DIRMODE} ${EXTDIR}/sysconfig/network-devices/services
    23 
    24 install: create-dirs create-service-dir
     23install: create-dirs
    2524        install -m ${MODE} lfs/init.d/checkfs       ${EXTDIR}/rc.d/init.d/
    2625        install -m ${MODE} lfs/init.d/cleanfs       ${EXTDIR}/rc.d/init.d/
    2726        install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
     27        install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR}
    2828        install -m ${MODE} lfs/init.d/halt          ${EXTDIR}/rc.d/init.d/
    2929        install -m ${MODE} lfs/init.d/console       ${EXTDIR}/rc.d/init.d/
     
    3838        install -m ${MODE} lfs/init.d/sendsignals   ${EXTDIR}/rc.d/init.d/
    3939        install -m ${MODE} lfs/init.d/setclock      ${EXTDIR}/rc.d/init.d/
    40         install -m ${MODE} lfs/init.d/sysklogd      ${EXTDIR}/rc.d/init.d/
     40        install -m ${MODE} lfs/init.d/sysklogd      ${EXTDIR}/rc.d/init.d/
    4141        install -m ${MODE} lfs/init.d/swap          ${EXTDIR}/rc.d/init.d/
    4242        install -m ${MODE} lfs/init.d/sysctl        ${EXTDIR}/rc.d/init.d/
     
    4545        install -m ${MODE} lfs/init.d/udev_retry    ${EXTDIR}/rc.d/init.d/
    4646        ln -sf ../init.d/network     ${EXTDIR}/rc.d/rc0.d/K80network
    47         ln -sf ../init.d/sysklogd   ${EXTDIR}/rc.d/rc0.d/K90sysklogd
     47        ln -sf ../init.d/sysklogd    ${EXTDIR}/rc.d/rc0.d/K90sysklogd
    4848        ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals
    4949        ln -sf ../init.d/mountfs     ${EXTDIR}/rc.d/rc0.d/S70mountfs
     
    5252        ln -sf ../init.d/halt        ${EXTDIR}/rc.d/rc0.d/S99halt
    5353        ln -sf ../init.d/network     ${EXTDIR}/rc.d/rc1.d/K80network
    54         ln -sf ../init.d/sysklogd   ${EXTDIR}/rc.d/rc1.d/K90sysklogd
     54        ln -sf ../init.d/sysklogd    ${EXTDIR}/rc.d/rc1.d/K90sysklogd
    5555        ln -sf ../init.d/network     ${EXTDIR}/rc.d/rc2.d/K80network
    56         ln -sf ../init.d/sysklogd   ${EXTDIR}/rc.d/rc2.d/K90sysklogd
    57         ln -sf ../init.d/sysklogd   ${EXTDIR}/rc.d/rc3.d/S10sysklogd
     56        ln -sf ../init.d/sysklogd    ${EXTDIR}/rc.d/rc2.d/K90sysklogd
     57        ln -sf ../init.d/sysklogd    ${EXTDIR}/rc.d/rc3.d/S10sysklogd
    5858        ln -sf ../init.d/network     ${EXTDIR}/rc.d/rc3.d/S20network
    59         ln -sf ../init.d/sysklogd   ${EXTDIR}/rc.d/rc4.d/S10sysklogd
     59        ln -sf ../init.d/sysklogd    ${EXTDIR}/rc.d/rc4.d/S10sysklogd
    6060        ln -sf ../init.d/network     ${EXTDIR}/rc.d/rc4.d/S20network
    61         ln -sf ../init.d/sysklogd   ${EXTDIR}/rc.d/rc5.d/S10sysklogd
     61        ln -sf ../init.d/sysklogd    ${EXTDIR}/rc.d/rc5.d/S10sysklogd
    6262        ln -sf ../init.d/network     ${EXTDIR}/rc.d/rc5.d/S20network
    6363        ln -sf ../init.d/network     ${EXTDIR}/rc.d/rc6.d/K80network
    64         ln -sf ../init.d/sysklogd   ${EXTDIR}/rc.d/rc6.d/K90sysklogd
     64        ln -sf ../init.d/sysklogd    ${EXTDIR}/rc.d/rc6.d/K90sysklogd
    6565        ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc6.d/S60sendsignals
    6666        ln -sf ../init.d/mountfs     ${EXTDIR}/rc.d/rc6.d/S70mountfs
     
    8080        ln -sf ../init.d/localnet    ${EXTDIR}/rc.d/rcsysinit.d/S80localnet
    8181        ln -sf ../init.d/sysctl      ${EXTDIR}/rc.d/rcsysinit.d/S90sysctl
    82         if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/; fi
    83         if [ ! -f ${EXTDIR}/sysconfig/modules     ]; then install -m ${CONFMODE} lfs/sysconfig/modules     ${EXTDIR}/sysconfig/; fi
    84         if [ ! -f ${EXTDIR}/sysconfig/rc          ]; then install -m ${CONFMODE} lfs/sysconfig/rc          ${EXTDIR}/sysconfig/; fi
    85         install                   -m ${MODE} lfs/sysconfig/network-devices/ifup   ${EXTDIR}/sysconfig/network-devices/
    86         install                   -m ${MODE} lfs/sysconfig/network-devices/ifdown ${EXTDIR}/sysconfig/network-devices/
    87         install                   -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static       ${EXTDIR}/sysconfig/network-devices/services/
    88         install                   -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static-route ${EXTDIR}/sysconfig/network-devices/services/
     82        if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then \
     83     install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/ ;\
     84   fi
     85        if [ ! -f ${EXTDIR}/sysconfig/modules     ]; then \
     86     install -m ${CONFMODE} lfs/sysconfig/modules     ${EXTDIR}/sysconfig/ ;\
     87   fi
     88        if [ ! -f ${EXTDIR}/sysconfig/rc          ]; then \
     89     install -m ${CONFMODE} lfs/sysconfig/rc          ${EXTDIR}/sysconfig/ ;\
     90   fi
     91        install -m ${MODE} lfs/sysconfig/network-devices/ifup   /sbin
     92        install -m ${MODE} lfs/sysconfig/network-devices/ifdown /sbin
     93        install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static       ${LIBDIR}
     94        install -m ${MODE} lfs/sysconfig/network-devices/services/ipv4-static-route ${LIBDIR}
    8995
    9096install-consolelog: create-dirs
     
    9298        ln -sf ../init.d/consolelog  ${EXTDIR}/rc.d/rcsysinit.d/S00consolelog
    9399
    94 install-lsb-compliant:
    95         make -C contrib/lsb
    96 
    97 install-service-mtu: create-service-dir
    98         install -m ${MODE} contrib/sysconfig/network-devices/services/mtu ${EXTDIR}/sysconfig/network-devices/services
    99 
    100 minimal: create-dirs create-service-dir
     100minimal: create-dirs
    101101        install -m ${MODE} lfs/init.d/checkfs       ${EXTDIR}/rc.d/init.d/
    102102        install -m ${MODE} lfs/init.d/cleanfs       ${EXTDIR}/rc.d/init.d/
    103103        install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
     104        install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR}
    104105        install -m ${MODE} lfs/init.d/halt          ${EXTDIR}/rc.d/init.d/
    105106        install -m ${MODE} lfs/init.d/localnet      ${EXTDIR}/rc.d/init.d/
     
    126127        ln -sf ../init.d/mountfs     ${EXTDIR}/rc.d/rcsysinit.d/S40mountfs
    127128        ln -sf ../init.d/cleanfs     ${EXTDIR}/rc.d/rcsysinit.d/S45cleanfs
    128         if [ ! -f ${EXTDIR}/sysconfig/rc          ]; then install -m ${CONFMODE} lfs/sysconfig/rc          ${EXTDIR}/sysconfig/; fi
     129        if [ ! -f ${EXTDIR}/sysconfig/rc          ]; then \
     130      install -m ${CONFMODE} lfs/sysconfig/rc ${EXTDIR}/sysconfig/; \
     131   fi
    129132
    130 .PHONY: all create-dirs create-service-dir \
    131         install install-service-mtu
     133.PHONY: all create-dirs install
    132134
  • bootscripts/README

    r75fe599 r0cda898  
    11Network Configuration:
    2         Script Files:
    3                 rc.d/init.d/network
    4                 sysconfig/network-devices/ifup
    5                 sysconfig/network-devices/ifdown
    6                 sysconfig/network-devices/services/*
     2   Script Files:
     3      /etc/rc.d/init.d/network
     4      /sbin/ifup
     5      /sbin/ifdown
     6      /lib/boot/*/*
    77
    8         Configuration Files:
    9                 sysconfig/network-devices/ifconfig.*/*
    10                 Note: ifconfig.* could be either a file or directory,
    11                       but the filename extension must be the same name
    12                       as the network interface you wish it to belong to.
    13                       The files within the directory will be processed
    14                       in alphanumerical order on boot, and reversed on
    15                       shutdown.
    16                 - SERVICE: which script to run in services directory.
    17                 - ONBOOT: if set to yes, this interface will be started on
    18                           bootup, and stopped on shutdown
     8   Configuration Files:
     9      /etc/sysconfig/ifconfig.*
     10      Note: ifconfig.* could be either a file or directory,
     11            but the filename extension must be the same name
     12            as the network interface you wish it to belong to.
     13            The files within the directory will be processed
     14            in alphanumerical order on boot, and reversed on
     15            shutdown.
     16      - IFACE: the interface that is being configured (e.g. eth0)
     17      - SERVICE: which script to run in services directory.
     18      - ONBOOT: if set to yes, this interface will be started on
     19                bootup, and stopped on shutdown
    1920
    20                 sysconfig/network
    21                 - HOSTNAME: Value of the system's hostname
     21      /etc/sysconfig/network
     22      - HOSTNAME: Value of the system's hostname
    2223
    23         Additional Configuration:
    24                 sysconfig/network-devices/ifconfig.*
    25                 ipv4-static:
    26                 - IP: static IP Address
    27                 - GATEWAY: Specifies the IP Address of the gateway server
    28                 - PREFIX: CIDR prefix of IP Address, defaults to 24 if not set
    29                 - PEER: IP Address of peer (for point-to-point connections and tunnels)
    30                 - BROADCAST: broadcast address
    31                 ipv4-static-route:
    32                 - TYPE: network (default type if not specified), default, host or
    33                   unreachable
    34                 - IP: IP Address of target (for network, host and unreachable)
    35                 - PREFIX: CIDR prefix of target (for network, host and unreachable)
    36                 - GATEWAY: IP Address of gateway to reach target (for network and default)
     24   Additional Configuration:
     25      ipv4-static:
     26      - IP: static IP Address
     27      - GATEWAY: Specifies the IP Address of the gateway server
     28      - PREFIX: CIDR prefix of IP Address, defaults to 24 if not set
     29      - PEER: IP Address of peer (for point-to-point connections and tunnels)
     30      - BROADCAST: broadcast address
     31
     32      ipv4-static-route:
     33      - TYPE: network (default type if not specified), default, host or
     34        unreachable
     35      - IP: IP Address of target (for network, host and unreachable)
     36      - PREFIX: CIDR prefix of target (for network, host and unreachable)
     37      - GATEWAY: IP Address of gateway to reach target (for network and default)
    3738
    3839
    3940SetClock configuration:
    40         Script Files:
    41                 rc.d/init.d/setclock
     41   Script Files:
     42      /etc/rc.d/init.d/setclock
     43      - SKIPTMPCLEAN: skips cleaning of /tmp directory
    4244
    43         Configuration Files:
    44                 sysconfig/clock
    45                 - UTC: 1 assumes hwclock is in UTC
    46                        0 assumes hwclock is in local time
    47                 - CLOCKPARAMS: any additional options to be passed to hwclock
     45   Configuration Files:
     46      /etc/sysconfig/clock
     47      - UTC: 1 assumes hwclock is in UTC
     48             0 assumes hwclock is in local time
     49      - CLOCKPARAMS: any additional options to be passed to hwclock
    4850
    4951CleanFS configuration:
    50         Script Files:
    51                 rc.d/init.d/cleanfs
     52   Script Files:
     53      /etc/rc.d/init.d/cleanfs
    5254
    53         Configuration Files:
    54                 /etc/sysconfig/createfiles
    55                 Each line is parsed, using space as a deliminator.
    56                 [NAME] [TYPE] [PERMISSIONS] [USER] [GROUP]
    57                 The below fields are currently only used on dev type.
    58                 ([DEV TYPE] [MAJOR#] [MINOR#])
    59                 Name:
    60                         File/Directory/Device name
    61                 Type:
    62                         dir: creates a directory
    63                         file: creates a file
    64                         dev: creates a device
    65                 Permissions:
    66                         chmod the created file
    67                 User/Group:
    68                         chown the created file/dir to this user/group
    69                 Dev Type:
    70                         char:  character [needs MAJOR#, MINOR#]
    71                         block: block [needs MAJOR#, MINOR#]
    72                         pipe:  pipe
    73                 Major#:
    74                         Used by character and block devices.
    75                 Minor#:
    76                         Used by character and block devices.
     55   Configuration Files:
     56      /etc/sysconfig/createfiles
     57      Each line is parsed, using space as a deliminator.
     58      [NAME] [TYPE] [PERMISSIONS] [USER] [GROUP]
     59      The below fields are currently only used on dev type.
     60      ([DEV TYPE] [MAJOR#] [MINOR#])
     61      Name:
     62         File/Directory/Device name
     63      Type:
     64         dir: creates a directory
     65         file: creates a file
     66         dev: creates a device
     67      Permissions:
     68         chmod the created file
     69      User/Group:
     70         chown the created file/dir to this user/group
     71      Dev Type:
     72         char:  character [needs MAJOR#, MINOR#]
     73         block: block [needs MAJOR#, MINOR#]
     74         pipe:  pipe
     75      Major#:
     76         Used by character and block devices.
     77      Minor#:
     78         Used by character and block devices.
     79
  • bootscripts/lfs/init.d/checkfs

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/checkfs
     3# Begin checkfs
    44#
    55# Description : File System Check
     
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
    88#               A. Luebke - luebke@users.sourceforge.net
     9# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    910#
    10 # Version     : 00.00
    11 #
    12 # Notes       :
     11# Version     : LFS 7.0
    1312#
    1413# Based on checkfs script from LFS-3.1 and earlier.
     
    2625#########################################################################
    2726
    28 . /etc/sysconfig/rc
    29 . ${rc_functions}
     27### BEGIN INIT INFO
     28# Provides:            checkfs
     29# Required-Start:      udev swap $time
     30# Should-Start:
     31# Required-Stop:
     32# Should-Stop:
     33# Default-Start:       S
     34# Default-Stop:
     35# Short-Description:   Checks local filesystems before mounting.
     36# Description:         Checks local filesystmes before mounting.
     37# X-LFS-Provided-By:   LFS
     38### END INIT INFO
     39
     40. /lib/boot/functions
    3041
    3142case "${1}" in
    32         start)
    33                 if [ -f /fastboot ]; then
    34                         boot_mesg -n "/fastboot found, will not perform" ${INFO}
    35                         boot_mesg " file system checks as requested."
    36                         echo_ok
    37                         exit 0
    38                 fi
     43   start)
     44      if [ -f /fastboot ]; then
     45         boot_mesg -n "/fastboot found, will not perform" ${INFO}
     46         boot_mesg " file system checks as requested."
     47         echo_ok
     48         exit 0
     49      fi
    3950
    40                 boot_mesg "Mounting root file system in read-only mode..."
    41                 mount -n -o remount,ro / >/dev/null
    42                 evaluate_retval
     51      boot_mesg "Mounting root file system in read-only mode..."
     52      mount -n -o remount,ro / >/dev/null
     53      evaluate_retval
    4354
    44                 if [ ${?} != 0 ]; then
    45                         echo_failure
    46                         boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE}
    47                         boot_mesg -n " filesystem because it could not be mounted"
    48                         boot_mesg -n " in read-only mode.\n\nAfter you"
    49                         boot_mesg -n " press Enter, this system will be"
    50                         boot_mesg -n " halted and powered off."
    51                         boot_mesg -n "\n\nPress enter to continue..." ${INFO}
    52                         boot_mesg "" ${NORMAL}
    53                         read ENTER
    54                         ${rc_base}/init.d/halt stop
    55                 fi
     55      if [ ${?} != 0 ]; then
     56         echo_failure
     57         boot_mesg -n "FAILURE:\n\nCannot check root" ${FAILURE}
     58         boot_mesg -n " filesystem because it could not be mounted"
     59         boot_mesg -n " in read-only mode.\n\nAfter you"
     60         boot_mesg -n " press Enter, this system will be"
     61         boot_mesg -n " halted and powered off."
     62         boot_mesg -n "\n\nPress enter to continue..." ${INFO}
     63         boot_mesg "" ${NORMAL}
     64         wait_for_user
     65         /etc/rc.d/init.d/halt stop
     66      fi
    5667
    57                 if [ -f /forcefsck ]; then
    58                         boot_mesg -n "/forcefsck found, forcing file" ${INFO}
    59                         boot_mesg " system checks as requested."
    60                         echo_ok
    61                         options="-f"
    62                 else
    63                         options=""
    64                 fi
     68      if [ -f /forcefsck ]; then
     69         boot_mesg -n "/forcefsck found, forcing file" ${INFO}
     70         boot_mesg " system checks as requested."
     71         echo_ok
     72         options="-f"
     73      else
     74         options=""
     75      fi
    6576
    66                 boot_mesg "Checking file systems..."
    67                 # Note: -a option used to be -p; but this fails e.g.
    68                 # on fsck.minix
    69                 fsck ${options} -a -A -C -T
    70                 error_value=${?}
     77      boot_mesg "Checking file systems..."
     78      # Note: -a option used to be -p; but this fails e.g.
     79      # on fsck.minix
     80      fsck ${options} -a -A -C -T
     81      error_value=${?}
    7182
    72                 if [ "${error_value}" = 0 ]; then
    73                         echo_ok
    74                 fi
     83      if [ "${error_value}" = 0 ]; then
     84         echo_ok
     85      fi
    7586
    76                 if [ "${error_value}" = 1 ]; then
    77                         echo_warning
    78                         boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
    79                         boot_mesg -n " were found and have been corrected."
    80                         boot_mesg -n " You may want to double-check that"
    81                         boot_mesg -n " everything was fixed properly."
    82                         boot_mesg "" ${NORMAL}
    83                 fi
     87      if [ "${error_value}" = 1 ]; then
     88         echo_warning
     89         boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
     90         boot_mesg -n " were found and have been corrected. "
     91         boot_mesg -n " You may want to double-check that"
     92         boot_mesg -n " everything was fixed properly."
     93         boot_mesg "" ${NORMAL}
     94      fi
    8495
    85                 if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
    86                         echo_warning
    87                         boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
    88                         boot_mesg -n " were found and have been been"
    89                         boot_mesg -n " corrected, but the nature of the"
    90                         boot_mesg -n " errors require this system to be"
    91                         boot_mesg -n " rebooted.\n\nAfter you press enter,"
    92                         boot_mesg -n " this system will be rebooted"
    93                         boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
    94                         boot_mesg "" ${NORMAL}
    95                         read ENTER
    96                         reboot -f
    97                 fi
     96      if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
     97         echo_warning
     98         boot_mesg -n "WARNING:\n\nFile system errors" ${WARNING}
     99         boot_mesg -n " were found and have been been"
     100         boot_mesg -n " corrected, but the nature of the"
     101         boot_mesg -n " errors require this system to be"
     102         boot_mesg -n " rebooted.\n\nAfter you press enter,"
     103         boot_mesg -n " this system will be rebooted"
     104         boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
     105         boot_mesg "" ${NORMAL}
     106         wait_for_user
     107         reboot -f
     108      fi
    98109
    99                 if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
    100                         echo_failure
    101                         boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE}
    102                         boot_mesg -n " were encountered that could not be"
    103                         boot_mesg -n " fixed automatically.  This system"
    104                         boot_mesg -n " cannot continue to boot and will"
    105                         boot_mesg -n " therefore be halted until those"
    106                         boot_mesg -n " errors are fixed manually by a"
    107                         boot_mesg -n " System Administrator.\n\nAfter you"
    108                         boot_mesg -n " press Enter, this system will be"
    109                         boot_mesg -n " halted and powered off."
    110                         boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
    111                         boot_mesg "" ${NORMAL}
    112                         read ENTER
    113                   ${rc_base}/init.d/halt stop
    114                 fi
     110      if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
     111         echo_failure
     112         boot_mesg -n "FAILURE:\n\nFile system errors" ${FAILURE}
     113         boot_mesg -n " were encountered that could not be"
     114         boot_mesg -n " fixed automatically.  This system"
     115         boot_mesg -n " cannot continue to boot and will"
     116         boot_mesg -n " therefore be halted until those"
     117         boot_mesg -n " errors are fixed manually by a"
     118         boot_mesg -n " System Administrator.\n\nAfter you"
     119         boot_mesg -n " press Enter, this system will be"
     120         boot_mesg -n " halted and powered off."
     121         boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
     122         boot_mesg "" ${NORMAL}
     123         wait_for_user
     124        /etc/rc.d/init.d/halt stop
     125      fi
    115126
    116                 if [ "${error_value}" -ge 16 ]; then
    117                         echo_failure
    118                         boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE}
    119                         boot_mesg -n " running fsck.  Exited with error"
    120                         boot_mesg -n " code: ${error_value}."
    121                         boot_mesg "" ${NORMAL}
    122                         exit ${error_value}
    123                 fi
    124                 ;;
    125         *)
    126                 echo "Usage: ${0} {start}"
    127                 exit 1
    128                 ;;
     127      if [ "${error_value}" -ge 16 ]; then
     128         echo_failure
     129         boot_mesg -n "FAILURE:\n\nUnexpected Failure" ${FAILURE}
     130         boot_mesg -n " running fsck.  Exited with error"
     131         boot_mesg -n " code: ${error_value}."
     132         boot_mesg "" ${NORMAL}
     133         exit ${error_value}
     134      fi
     135      ;;
     136   *)
     137      echo "Usage: ${0} {start}"
     138      exit 1
     139      ;;
    129140esac
    130141
    131 # End $rc_base/init.d/checkfs
     142# End checkfs
  • bootscripts/lfs/init.d/cleanfs

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/cleanfs
     3# Begin cleanfs
    44#
    55# Description : Clean file system
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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:            cleanfs
     16# Required-Start:      $local_fs
     17# Should-Start:
     18# Required-Stop:
     19# Should-Stop:
     20# Default-Start:       S
     21# Default-Stop:
     22# Short-Description:   Cleans temporary directories early in the boot process.
     23# Description:         Cleans temporary directories /var/run, /var/lock, and
     24#                      optionally) /tmp.  cleanfs also creates /var/run/utmp
     25#                      and any files defined in /etc/sysconfig/createfiles.
     26# X-LFS-Provided-By:   LFS
     27### END INIT INFO
     28
     29. /lib/boot/functions
    1730
    1831# Function to create files/directory on boot.
     
    2235                while read name type perm usr grp dtype maj min junk
    2336                do
    24 
    2537                        # Ignore comments and blank lines.
    2638                        case "${name}" in
     
    7486                boot_mesg -n "Cleaning file systems:" ${INFO}
    7587
    76                 boot_mesg -n " /tmp" ${NORMAL}
    77                 cd /tmp &&
    78                 find . -xdev -mindepth 1 ! -name lost+found \
    79                         -delete || failed=1
     88      if [ "${SKIPTMPCLEAN}" = "" ]; then
     89                   boot_mesg -n " /tmp" ${NORMAL}
     90                   cd /tmp &&
     91                   find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
     92      fi
    8093
    8194                > /var/run/utmp
     
    101114esac
    102115
    103 # End $rc_base/init.d/cleanfs
     116# End cleanfs
  • bootscripts/lfs/init.d/console

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/console
     3# Begin console
    44#
    55# Description : Sets keymap and screen font
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
    8 #               Alexander E. Patrakov
     8#               Alexander E. Patrakov
     9# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    910#
    10 # Version     : 00.03
    11 #
    12 # Notes       :
     11# Version     : LFS 7.0
    1312#
    1413########################################################################
    1514
    16 . /etc/sysconfig/rc
    17 . ${rc_functions}
     15. /lib/boot/functions
     16
     17### BEGIN INIT INFO
     18# Provides:            console
     19# Required-Start:
     20# Should-Start:        $local_fs
     21# Required-Stop:
     22# Should-Stop:
     23# Default-Start:       S
     24# Default-Stop:
     25# Short-Description:   Sets up a localised console.
     26# Description:         Sets up fonts and language settings for the user's
     27#                      local as defined by /etc/sysconfig/console.
     28# X-LFS-Provided-By:   LFS
     29### END INIT INFO
    1830
    1931# Native English speakers probably don't have /etc/sysconfig/console at all
    20 if [ -f /etc/sysconfig/console ]
    21 then
    22         . /etc/sysconfig/console
     32if [ -r /etc/sysconfig/console ]; then
     33   . /etc/sysconfig/console
    2334else
    24         exit 0
     35   exit 0
    2536fi
    2637
    2738is_true() {
    28         [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
     39   [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
    2940}
    3041
     
    3243
    3344case "${1}" in
    34         start)
    35                 boot_mesg "Setting up Linux console..."
    36                 # There should be no bogus failures below this line!
    37                
    38                 # Figure out if a framebuffer console is used
    39                 [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
    40                
    41                 # Figure out the command to set the console into the
    42                 # desired mode
    43                 is_true "${UNICODE}" &&
    44                         MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" ||
    45                         MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a"
    46                
    47                 # On framebuffer consoles, font has to be set for each vt in
    48                 # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
    49                
    50                 ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
    51                         MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
     45   start)
     46      boot_mesg "Setting up Linux console..."
     47      # There should be no bogus failures below this line!
    5248
    53                 # Apply that command to all consoles mentioned in
    54                 # /etc/inittab. Important: in the UTF-8 mode this should
    55                 # happen before setfont, otherwise a kernel bug will
    56                 # show up and the unicode map of the font will not be
    57                 # used.
    58                 # FIXME: Fedora Core also initializes two spare consoles
    59                 # - do we want that?
    60                
    61                 for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
    62                         grep -o '\btty[[:digit:]]*\b'`
    63                 do
    64                         openvt -f -w -c ${TTY#tty} -- \
    65                                 /bin/sh -c "${MODE_COMMAND}" || failed=1
    66                 done
     49      # Figure out if a framebuffer console is used
     50      [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
    6751
    68                 # Set the font (if not already set above) and the keymap
    69                 is_true "${USE_FB}" || [ -z "${FONT}" ] ||
    70                         setfont $FONT ||
    71                         failed=1
    72                 [ -z "${KEYMAP}" ] ||
    73                         loadkeys ${KEYMAP} >/dev/null 2>&1 ||
    74                         failed=1
    75                 [ -z "${KEYMAP_CORRECTIONS}" ] ||
    76                         loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
    77                         failed=1
     52      # Figure out the command to set the console into the
     53      # desired mode
     54      is_true "${UNICODE}" &&
     55         MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" ||
     56         MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a"
    7857
    79                 # Convert the keymap from $LEGACY_CHARSET to UTF-8
    80                 [ -z "$LEGACY_CHARSET" ] ||
    81                         dumpkeys -c "$LEGACY_CHARSET" |
    82                         loadkeys -u >/dev/null 2>&1 ||
    83                         failed=1
     58      # On framebuffer consoles, font has to be set for each vt in
     59      # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
    8460
    85                 # If any of the commands above failed, the trap at the
    86                 # top would set $failed to 1
    87                 ( exit $failed )
    88                 evaluate_retval
    89                 ;;
    90         *)
    91                 echo $"Usage:" "${0} {start}"
    92                 exit 1
    93                 ;;
     61      ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
     62         MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
     63
     64      # Apply that command to all consoles mentioned in
     65      # /etc/inittab. Important: in the UTF-8 mode this should
     66      # happen before setfont, otherwise a kernel bug will
     67      # show up and the unicode map of the font will not be
     68      # used.
     69      # FIXME: Fedora Core also initializes two spare consoles
     70      # - do we want that?
     71
     72      for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
     73         grep -o '\btty[[:digit:]]*\b'`
     74      do
     75         openvt -f -w -c ${TTY#tty} -- \
     76            /bin/sh -c "${MODE_COMMAND}" || failed=1
     77      done
     78
     79      # Set the font (if not already set above) and the keymap
     80      is_true "${USE_FB}" || [ -z "${FONT}" ] ||
     81         setfont $FONT ||
     82         failed=1
     83      [ -z "${KEYMAP}" ] ||
     84         loadkeys ${KEYMAP} >/dev/null 2>&1 ||
     85         failed=1
     86      [ -z "${KEYMAP_CORRECTIONS}" ] ||
     87         loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
     88         failed=1
     89
     90      # Convert the keymap from $LEGACY_CHARSET to UTF-8
     91      [ -z "$LEGACY_CHARSET" ] ||
     92         dumpkeys -c "$LEGACY_CHARSET" |
     93         loadkeys -u >/dev/null 2>&1 ||
     94         failed=1
     95
     96      # If any of the commands above failed, the trap at the
     97      # top would set $failed to 1
     98      ( exit $failed )
     99      evaluate_retval
     100      ;;
     101   *)
     102      echo $"Usage:" "${0} {start}"
     103      exit 1
     104      ;;
    94105esac
    95106
    96 # End $rc_base/init.d/console
     107# End console
  • bootscripts/lfs/init.d/consolelog

    r75fe599 r0cda898  
    11#!/bin/sh
    2 # Begin $rc_base/init.d/consolelog
    3 
    42########################################################################
     3# Begin consolelog
    54#
    65# Description : Set the kernel log level for the console
    76#
    87# Authors     : Dan Nicholson - dnicholson@linuxfromscratch.org
     8# Authors     : Gerard Beekmans  - gerard@linuxfromscratch.org
     9# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    910#
    10 # Version     : 00.00
     11# Version     : LFS 7.0
    1112#
    1213# Notes       : /proc must be mounted before this can run
     
    1415########################################################################
    1516
    16 . /etc/sysconfig/rc
    17 . ${rc_functions}
     17### BEGIN INIT INFO
     18# Provides:            consolelog
     19# Required-Start:
     20# Should-Start:       
     21# Required-Stop:
     22# Should-Stop:
     23# Default-Start:       S
     24# Default-Stop:
     25# Short-Description:   Sets the console log level.
     26# Description:         Sets the console log level.
     27# X-LFS-Provided-By:   LFS
     28### END INIT INFO
     29
     30. /lib/boot/functions
    1831
    1932# set the default loglevel
    2033LOGLEVEL=7
    21 if [ -r /etc/sysconfig/console ]; then
    22         . /etc/sysconfig/console
    23 fi
     34
     35[ -r /etc/sysconfig/console ] &&  . /etc/sysconfig/console
    2436
    2537case "${1}" in
    26         start)
    27                 case "$LOGLEVEL" in
    28                 [1-8])
    29                         boot_mesg "Setting the console log level to ${LOGLEVEL}..."
    30                         dmesg -n $LOGLEVEL
    31                         evaluate_retval
    32                         ;;
    33                 *)
    34                         boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
    35                         echo_failure
    36                         ;;
    37                 esac
    38                 ;;
    39         status)
    40                 # Read the current value if possible
    41                 if [ -r /proc/sys/kernel/printk ]; then
    42                         read level line < /proc/sys/kernel/printk
    43                 else
    44                         boot_mesg "Can't read the current console log level" ${FAILURE}
    45                         echo_failure
    46                 fi
     38   start)
     39      case "$LOGLEVEL" in
     40      [1-8])
     41         boot_mesg "Setting the console log level to ${LOGLEVEL}..."
     42         dmesg -n $LOGLEVEL
     43         evaluate_retval
     44         ;;
     45      *)
     46         boot_mesg "Console log level '${LOGLEVEL}' is invalid" ${FAILURE}
     47         echo_failure
     48         ;;
     49      esac
     50      ;;
    4751
    48                 # Print the value
    49                 if [ -n "$level" ]; then
    50                         ${ECHO} -e "${INFO}The current console log level" \
    51                                 "is ${level}${NORMAL}"
    52                 fi
    53                 ;;
     52   status)
     53      # Read the current value if possible
     54      if [ -r /proc/sys/kernel/printk ]; then
     55         read level line < /proc/sys/kernel/printk
     56      else
     57         boot_mesg "Can't read the current console log level" ${FAILURE}
     58         echo_failure
     59      fi
    5460
    55         *)
    56                 echo "Usage: ${0} {start|status}"
    57                 exit 1
    58                 ;;
     61      # Print the value
     62      if [ -n "$level" ]; then
     63         ${ECHO} -e "${INFO}The current console log level is ${level}${NORMAL}"
     64      fi
     65      ;;
     66
     67   *)
     68      echo "Usage: ${0} {start|status}"
     69      exit 1
     70      ;;
    5971esac
    6072
    61 # End $rc_base/init.d/consolelog
     73# End consolelog
  • bootscripts/lfs/init.d/functions

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/functions
     3# Begin boot functions
    44#
    55# Description : Run Level Control Functions
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
    8 #
    9 # Version     : 00.00
     8# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
     9#
     10# Version     : LFS 7.0
    1011#
    1112# Notes       : With code based on Matthias Benkmann's simpleinit-msb
    12 #               http://winterdrache.de/linux/newboot/index.html
     13#               http://winterdrache.de/linux/newboot/index.html
     14#
     15#               The file should be located in /lib/boot
    1316#
    1417########################################################################
     18
     19# Set any needed environment variables e.g. HEADLESS
     20[ -r /etc/sysconfig/init_params ]  && . /etc/sysconfig/init_params
    1521
    1622## Environmental setup
     
    2834# Find current screen size
    2935if [ -z "${COLUMNS}" ]; then
    30         COLUMNS=$(stty size)
    31         COLUMNS=${COLUMNS##* }
     36   COLUMNS=$(stty size)
     37   COLUMNS=${COLUMNS##* }
    3238fi
    3339
    3440# When using remote connections, such as a serial port, stty size returns 0
    3541if [ "${COLUMNS}" = "0" ]; then
    36         COLUMNS=80
     42   COLUMNS=80
    3743fi
    3844
     
    4450# If formatting is needed, $ECHO should be used
    4551case "`echo -e -n test`" in
    46         -[en]*)
    47                 ECHO=/bin/echo
    48                 ;;
    49         *)
    50                 ECHO=echo
    51                 ;;
     52   -[en]*)
     53      ECHO=/bin/echo
     54      ;;
     55   *)
     56      ECHO=echo
     57      ;;
    5258esac
    5359
     
    8591#
    8692# Dependencies: - sed for parsing strings.
    87 #               - grep for counting string length.
     93#          - grep for counting string length.
    8894#               
    8995# Todo:         
     
    9197boot_mesg()
    9298{
    93         local ECHOPARM=""
    94 
    95         while true
    96         do
    97                 case "${1}" in
    98                         -n)
    99                                 ECHOPARM=" -n "
    100                                 shift 1
    101                                 ;;
    102                         -*)
    103                                 echo "Unknown Option: ${1}"
    104                                 return 1
    105                                 ;;
    106                         *)
    107                                 break
    108                                 ;;
    109                 esac
    110         done
    111 
    112         ## Figure out the length of what is to be printed to be used
    113         ## for warning messages.
    114         STRING_LENGTH=$((${#1} + 1))
    115 
    116         # Print the message to the screen
    117         ${ECHO} ${ECHOPARM} -e "${2}${1}"
    118        
     99   local ECHOPARM=""
     100
     101   while true
     102   do
     103      case "${1}" in
     104         -n)
     105            ECHOPARM=" -n "
     106            shift 1
     107            ;;
     108         -*)
     109            echo "Unknown Option: ${1}"
     110            return 1
     111            ;;
     112         *)
     113            break
     114            ;;
     115      esac
     116   done
     117
     118   ## Figure out the length of what is to be printed to be used
     119   ## for warning messages.
     120   STRING_LENGTH=$((${#1} + 1))
     121
     122   # Print the message to the screen
     123   ${ECHO} ${ECHOPARM} -e "${2}${1}"
     124
     125   # Log the message
     126   ${ECHO} ${ECHOPARM} -e "${2}${1}" >> /run/var/bootlog
    119127}
    120128
    121129boot_mesg_flush()
    122130{
    123         # Reset STRING_LENGTH for next message
    124         STRING_LENGTH="0"
    125 }
    126 
    127 boot_log()
    128 {
    129         # Left in for backwards compatibility
    130         :
     131   # Reset STRING_LENGTH for next message
     132   STRING_LENGTH="0"
    131133}
    132134
    133135echo_ok()
    134136{
    135         ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS}  OK  ${BRACKET}]"
    136         ${ECHO} -e "${NORMAL}"
     137   ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS}  OK  ${BRACKET}]"
     138   ${ECHO} -e "${NORMAL}"
    137139        boot_mesg_flush
     140   ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS}  OK  ${BRACKET}]" >> /run/var/bootlog
     141   ${ECHO} -e "${NORMAL}" >> /run/var/bootlog
    138142}
    139143
    140144echo_failure()
    141145{
    142         ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]"
    143         ${ECHO} -e "${NORMAL}"
     146   ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]"
     147   ${ECHO} -e "${NORMAL}"
    144148        boot_mesg_flush
     149   ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" >> /run/var/bootlog
     150   ${ECHO} -e "${NORMAL}" >> /run/var/bootlog
    145151}
    146152
    147153echo_warning()
    148154{
    149         ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
    150         ${ECHO} -e "${NORMAL}"
     155   ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
     156   ${ECHO} -e "${NORMAL}"
    151157        boot_mesg_flush
    152 }
    153 
    154 print_error_msg()
    155 {
    156         echo_failure
    157         # $i is inherited by the rc script
    158         boot_mesg -n "FAILURE:\n\nYou should not be reading this error message.\n\n" ${FAILURE}
    159         boot_mesg -n " It means that an unforeseen error took"
    160         boot_mesg -n " place in ${i}, which exited with a return value of"
    161         boot_mesg " ${error_value}.\n"
    162         boot_mesg_flush
    163         boot_mesg -n "If you're able to track this"
    164         boot_mesg -n " error down to a bug in one of the files provided by"
    165         boot_mesg -n " the LFS book, please be so kind to inform us at"
    166         boot_mesg " lfs-dev@linuxfromscratch.org.\n"
    167         boot_mesg_flush
    168         boot_mesg -n "Press Enter to continue..." ${INFO}
    169         boot_mesg "" ${NORMAL}
    170         read ENTER
    171 }
    172 
    173 check_script_status()
    174 {
    175         # $i is inherited by the rc script
    176         if [ ! -f ${i} ]; then
    177                 boot_mesg "${i} is not a valid symlink." ${WARNING}
    178                 echo_warning
    179                 continue
    180         fi
    181 
    182         if [ ! -x ${i} ]; then
    183                 boot_mesg "${i} is not executable, skipping." ${WARNING}
    184                 echo_warning
    185                 continue
    186         fi
     158   ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" >> /run/var/bootlog
     159   ${ECHO} -e "${NORMAL}" >> /run/var/bootlog
     160}
     161
     162echo_skipped()
     163{
     164   ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]"
     165   ${ECHO} -e "${NORMAL}"
     166        boot_mesg_flush
     167   ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]" >> /run/var/bootlog
     168   ${ECHO} -e "${NORMAL}" >> /run/var/bootlog
     169}
     170
     171wait_for_user()
     172{
     173   # Wait for the user by default
     174   [ "${HEADLESS=0}" = "0" ] && read ENTER
    187175}
    188176
    189177evaluate_retval()
    190178{
    191         error_value="${?}"
    192 
    193         if [ ${error_value} = 0 ]; then
    194                 echo_ok
    195         else
    196                 echo_failure
    197         fi
    198 
    199         # This prevents the 'An Unexpected Error Has Occurred' from trivial
    200         # errors.
    201         return 0
     179   error_value="${?}"
     180
     181   if [ ${error_value} = 0 ]; then
     182      echo_ok
     183   else
     184      echo_failure
     185   fi
     186
     187   # This prevents the 'An Unexpected Error Has Occurred' from trivial
     188   # errors.
     189   return 0
    202190}
    203191
    204192print_status()
    205193{
    206         if [ "${#}" = "0" ]; then
    207                 echo "Usage: ${0} {success|warning|failure}"
    208                 return 1
    209         fi
    210 
    211         case "${1}" in
    212 
    213                 success)
    214                         echo_ok
    215                         ;;
    216 
    217                 warning)
    218                         # Leave this extra case in because old scripts
    219                         # may call it this way.
    220                         case "${2}" in
    221                                 running)
    222                                         ${ECHO} -e -n "${CURS_UP}"
    223                                         ${ECHO} -e -n "\\033[${STRING_LENGTH}G   "
    224                                         boot_mesg "Already running." ${WARNING}
    225                                         echo_warning
    226                                         ;;
    227                                 not_running)
    228                                         ${ECHO} -e -n "${CURS_UP}"
    229                                         ${ECHO} -e -n "\\033[${STRING_LENGTH}G   "
    230                                         boot_mesg "Not running." ${WARNING}
    231                                         echo_warning
    232                                         ;;
    233                                 not_available)
    234                                         ${ECHO} -e -n "${CURS_UP}"
    235                                         ${ECHO} -e -n "\\033[${STRING_LENGTH}G   "
    236                                         boot_mesg "Not available." ${WARNING}
    237                                         echo_warning
    238                                         ;;
    239                                 *)
    240                                         # This is how it is supposed to
    241                                         # be called
    242                                         echo_warning
    243                                         ;;
    244                         esac
    245                 ;;
    246 
    247                 failure)
    248                         echo_failure
    249                 ;;
    250 
    251         esac
     194   if [ "${#}" = "0" ]; then
     195      echo "Usage: ${0} {success|warning|failure}"
     196      return 1
     197   fi
     198
     199   case "${1}" in
     200
     201      success)
     202         echo_ok
     203         ;;
     204
     205      warning)
     206         # Leave this extra case in because old scripts
     207         # may call it this way.
     208         case "${2}" in
     209            running)
     210               ${ECHO} -e -n "${CURS_UP}"
     211               ${ECHO} -e -n "\\033[${STRING_LENGTH}G   "
     212               boot_mesg "Already running." ${WARNING}
     213               echo_warning
     214               ;;
     215            not_running)
     216               ${ECHO} -e -n "${CURS_UP}"
     217               ${ECHO} -e -n "\\033[${STRING_LENGTH}G   "
     218               boot_mesg "Not running." ${WARNING}
     219               echo_warning
     220               ;;
     221            not_available)
     222               ${ECHO} -e -n "${CURS_UP}"
     223               ${ECHO} -e -n "\\033[${STRING_LENGTH}G   "
     224               boot_mesg "Not available." ${WARNING}
     225               echo_warning
     226               ;;
     227            *)
     228               # This is how it is supposed to
     229               # be called
     230               echo_warning
     231               ;;
     232         esac
     233      ;;
     234
     235      failure)
     236         echo_failure
     237      ;;
     238
     239   esac
    252240
    253241}
     
    255243reloadproc()
    256244{
    257         local pidfile=""
    258         local failure=0
    259 
    260         while true
    261         do
    262                 case "${1}" in
    263                         -p)
    264                                 pidfile="${2}"
    265                                 shift 2
    266                                 ;;
    267                         -*)
    268                                 log_failure_msg "Unknown Option: ${1}"
    269                                 return 2
    270                                 ;;
    271                         *)
    272                                 break
    273                                 ;;
    274                 esac
    275         done
    276 
    277         if [ "${#}" -lt "1" ]; then
    278                 log_failure_msg "Usage: reloadproc [-p pidfile] pathname"
    279                 return 2
    280         fi
    281 
    282         # This will ensure compatibility with previous LFS Bootscripts
    283         if [ -n "${PIDFILE}" ]; then
    284                 pidfile="${PIDFILE}"
    285         fi
    286 
    287         # Is the process running?
    288         if [ -z "${pidfile}" ]; then
    289                 pidofproc -s "${1}"
    290         else
    291                 pidofproc -s -p "${pidfile}" "${1}"
    292         fi
    293 
    294         # Warn about stale pid file
    295         if [ "$?" = 1 ]; then
    296                 boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING}
    297                 rm -f "${pidfile}"
    298         fi
    299 
    300         if [ -n "${pidlist}" ]; then
    301                 for pid in ${pidlist}
    302                 do
    303                         kill -"${RELOADSIG}" "${pid}" || failure="1"
    304                 done
    305 
    306                 (exit ${failure})
    307                 evaluate_retval
    308 
    309         else
    310                 boot_mesg "Process ${1} not running." ${WARNING}
    311                 echo_warning
    312         fi
     245   local pidfile=""
     246   local failure=0
     247
     248   while true
     249   do
     250      case "${1}" in
     251         -p)
     252            pidfile="${2}"
     253            shift 2
     254            ;;
     255         -*)
     256            log_failure_msg "Unknown Option: ${1}"
     257            return 2
     258            ;;
     259         *)
     260            break
     261            ;;
     262      esac
     263   done
     264
     265   if [ "${#}" -lt "1" ]; then
     266      log_failure_msg "Usage: reloadproc [-p pidfile] pathname"
     267      return 2
     268   fi
     269
     270   # This will ensure compatibility with previous LFS Bootscripts
     271   if [ -n "${PIDFILE}" ]; then
     272      pidfile="${PIDFILE}"
     273   fi
     274
     275   # Is the process running?
     276   if [ -z "${pidfile}" ]; then
     277      pidofproc -s "${1}"
     278   else
     279      pidofproc -s -p "${pidfile}" "${1}"
     280   fi
     281
     282   # Warn about stale pid file
     283   if [ "$?" = 1 ]; then
     284      boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING}
     285      rm -f "${pidfile}"
     286   fi
     287
     288   if [ -n "${pidlist}" ]; then
     289      for pid in ${pidlist}
     290      do
     291         kill -"${RELOADSIG}" "${pid}" || failure="1"
     292      done
     293
     294      (exit ${failure})
     295      evaluate_retval
     296
     297   else
     298      boot_mesg "Process ${1} not running." ${WARNING}
     299      echo_warning
     300   fi
    313301}
    314302
    315303statusproc()
    316304{
    317         local pidfile=""
    318         local base=""
    319         local ret=""
    320 
    321         while true
    322         do
    323                 case "${1}" in
    324                         -p)
    325                                 pidfile="${2}"
    326                                 shift 2
    327                                 ;;
    328                         -*)
    329                                 log_failure_msg "Unknown Option: ${1}"
    330                                 return 2
    331                                 ;;
    332                         *)
    333                                 break
    334                                 ;;
    335                 esac
    336         done
    337 
    338         if [ "${#}" != "1" ]; then
    339                 shift 1
    340                 log_failure_msg "Usage: statusproc [-p pidfile] pathname"
    341                 return 2
    342         fi
    343 
    344         # Get the process basename
    345         base="${1##*/}"
    346 
    347         # This will ensure compatibility with previous LFS Bootscripts
    348         if [ -n "${PIDFILE}" ]; then
    349                 pidfile="${PIDFILE}"
    350         fi
    351 
    352         # Is the process running?
    353         if [ -z "${pidfile}" ]; then
    354                 pidofproc -s "${1}"
    355         else
    356                 pidofproc -s -p "${pidfile}" "${1}"
    357         fi
    358 
    359         # Store the return status
    360         ret=$?
    361 
    362         if [ -n "${pidlist}" ]; then
    363                 ${ECHO} -e "${INFO}${base} is running with Process"\
    364                         "ID(s) ${pidlist}.${NORMAL}"
    365         else
    366                 if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
    367                         ${ECHO} -e "${WARNING}${1} is not running but"\
    368                                 "/var/run/${base}.pid exists.${NORMAL}"
    369                 else
    370                         if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
    371                                 ${ECHO} -e "${WARNING}${1} is not running"\
    372                                         "but ${pidfile} exists.${NORMAL}"
    373                         else
    374                                 ${ECHO} -e "${INFO}${1} is not running.${NORMAL}"
    375                         fi
    376                 fi
    377         fi
    378 
    379         # Return the status from pidofproc
    380         return $ret
     305   local pidfile=""
     306   local base=""
     307   local ret=""
     308
     309   while true
     310   do
     311      case "${1}" in
     312         -p)
     313            pidfile="${2}"
     314            shift 2
     315            ;;
     316         -*)
     317            log_failure_msg "Unknown Option: ${1}"
     318            return 2
     319            ;;
     320         *)
     321            break
     322            ;;
     323      esac
     324   done
     325
     326   if [ "${#}" != "1" ]; then
     327      shift 1
     328      log_failure_msg "Usage: statusproc [-p pidfile] pathname"
     329      return 2
     330   fi
     331
     332   # Get the process basename
     333   base="${1##*/}"
     334
     335   # This will ensure compatibility with previous LFS Bootscripts
     336   if [ -n "${PIDFILE}" ]; then
     337      pidfile="${PIDFILE}"
     338   fi
     339
     340   # Is the process running?
     341   if [ -z "${pidfile}" ]; then
     342      pidofproc -s "${1}"
     343   else
     344      pidofproc -s -p "${pidfile}" "${1}"
     345   fi
     346
     347   # Store the return status
     348   ret=$?
     349
     350   if [ -n "${pidlist}" ]; then
     351      ${ECHO} -e "${INFO}${base} is running with Process"\
     352         "ID(s) ${pidlist}.${NORMAL}"
     353   else
     354      if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
     355         ${ECHO} -e "${WARNING}${1} is not running but"\
     356            "/var/run/${base}.pid exists.${NORMAL}"
     357      else
     358         if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
     359            ${ECHO} -e "${WARNING}${1} is not running"\
     360               "but ${pidfile} exists.${NORMAL}"
     361         else
     362            ${ECHO} -e "${INFO}${1} is not running.${NORMAL}"
     363         fi
     364      fi
     365   fi
     366
     367   # Return the status from pidofproc
     368   return $ret
    381369}
    382370
     
    406394pidofproc()
    407395{
    408         local pidfile=""
    409         local lpids=""
    410         local silent=""
    411         pidlist=""
    412         while true
    413         do
    414                 case "${1}" in
    415                         -p)
    416                                 pidfile="${2}"
    417                                 shift 2
    418                                 ;;
    419 
    420                         -s)
    421                                 # Added for legacy opperation of getpids
    422                                 # eliminates several '> /dev/null'
    423                                 silent="1"
    424                                 shift 1
    425                                 ;;
    426                         -*)
    427                                 log_failure_msg "Unknown Option: ${1}"
    428                                 return 2
    429                                 ;;
    430                         *)
    431                                 break
    432                                 ;;
    433                 esac
    434         done
    435 
    436         if [ "${#}" != "1" ]; then
    437                 shift 1
    438                 log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname"
    439                 return 2
    440         fi
    441 
    442         if [ -n "${pidfile}" ]; then
    443                 if [ ! -r "${pidfile}" ]; then
    444                         return 3 # Program is not running
    445                 fi
    446 
    447                 lpids=`head -n 1 ${pidfile}`
    448                 for pid in ${lpids}
    449                 do
    450                         if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
    451                                 kill -0 "${pid}" 2>/dev/null &&
    452                                 pidlist="${pidlist} ${pid}"
    453                         fi
    454                        
    455                         if [ "${silent}" != "1" ]; then
    456                                 echo "${pidlist}"
    457                         fi
    458 
    459                         test -z "${pidlist}" &&
    460                         # Program is dead, pidfile exists
    461                         return 1
    462                         # else
    463                         return 0
    464                 done
    465 
    466         else
    467                 pidlist=`pidof -o $$ -o $PPID -x "$1"`
    468                 if [ "${silent}" != "1" ]; then
    469                         echo "${pidlist}"
    470                 fi
    471 
    472                 # Get provide correct running status
    473                 if [ -n "${pidlist}" ]; then
    474                         return 0
    475                 else
    476                         return 3
    477                 fi
    478 
    479         fi
    480 
    481         if [ "$?" != "0" ]; then
    482                 return 3 # Program is not running
    483         fi
     396   local pidfile=""
     397   local lpids=""
     398   local silent=""
     399   pidlist=""
     400   while true
     401   do
     402      case "${1}" in
     403         -p)
     404            pidfile="${2}"
     405            shift 2
     406            ;;
     407
     408         -s)
     409            # Added for legacy opperation of getpids
     410            # eliminates several '> /dev/null'
     411            silent="1"
     412            shift 1
     413            ;;
     414         -*)
     415            log_failure_msg "Unknown Option: ${1}"
     416            return 2
     417            ;;
     418         *)
     419            break
     420            ;;
     421      esac
     422   done
     423
     424   if [ "${#}" != "1" ]; then
     425      shift 1
     426      log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname"
     427      return 2
     428   fi
     429
     430   if [ -n "${pidfile}" ]; then
     431      if [ ! -r "${pidfile}" ]; then
     432         return 3 # Program is not running
     433      fi
     434
     435      lpids=`head -n 1 ${pidfile}`
     436      for pid in ${lpids}
     437      do
     438         if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
     439            kill -0 "${pid}" 2>/dev/null &&
     440            pidlist="${pidlist} ${pid}"
     441         fi
     442         
     443         if [ "${silent}" != "1" ]; then
     444            echo "${pidlist}"
     445         fi
     446
     447         test -z "${pidlist}" &&
     448         # Program is dead, pidfile exists
     449         return 1
     450         # else
     451         return 0
     452      done
     453
     454   else
     455      pidlist=`pidof -o $$ -o $PPID -x "$1"`
     456      if [ "${silent}" != "1" ]; then
     457         echo "${pidlist}"
     458      fi
     459
     460      # Get provide correct running status
     461      if [ -n "${pidlist}" ]; then
     462         return 0
     463      else
     464         return 3
     465      fi
     466
     467   fi
     468
     469   if [ "$?" != "0" ]; then
     470      return 3 # Program is not running
     471   fi
    484472}
    485473
     
    511499loadproc()
    512500{
    513         local pidfile=""
    514         local forcestart=""
    515         local nicelevel="10"
     501   local pidfile=""
     502   local forcestart=""
     503   local nicelevel="10"
    516504
    517505# This will ensure compatibility with previous LFS Bootscripts
    518         if [ -n "${PIDFILE}" ]; then
    519                 pidfile="${PIDFILE}"
    520         fi
     506   if [ -n "${PIDFILE}" ]; then
     507      pidfile="${PIDFILE}"
     508   fi
    521509
    522510  while true
    523         do
    524                 case "${1}" in
    525                         -f)
    526                                 forcestart="1"
    527                                 shift 1
    528                                 ;;
    529                         -n)
    530                                 nicelevel="${2}"
    531                                 shift 2
    532                                 ;;
    533                         -p)
    534                                 pidfile="${2}"
    535                                 shift 2
    536                                 ;;
    537                         -*)
    538                                 log_failure_msg "Unknown Option: ${1}"
    539                                 return 2 #invalid or excess argument(s)
    540                                 ;;
    541                         *)
    542                                 break
    543                                 ;;
    544                 esac
    545         done
    546 
    547         if [ "${#}" = "0" ]; then
    548                 log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
    549                 return 2 #invalid or excess argument(s)
    550         fi
    551 
    552         if [ -z "${forcestart}" ]; then
    553                 if [ -z "${pidfile}" ]; then
    554                         pidofproc -s "${1}"
    555                 else
    556                         pidofproc -s -p "${pidfile}" "${1}"
    557                 fi
    558 
    559                 case "${?}" in
    560                         0)
    561                                 log_warning_msg "Unable to continue: ${1} is running"
    562                                 return 0 # 4
    563                                 ;;
    564                         1)
    565                                 boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING}
    566                                 rm -f "${pidfile}"
    567                                 ;;
    568                         3)
    569                                 ;;
    570                         *)
    571                                 log_failure_msg "Unknown error code from pidofproc: ${?}"
    572                                 return 4
    573                                 ;;
    574                 esac
    575         fi
    576 
    577         nice -n "${nicelevel}" "${@}"
    578         evaluate_retval # This is "Probably" not LSB compliant,
     511   do
     512      case "${1}" in
     513         -f)
     514            forcestart="1"
     515            shift 1
     516            ;;
     517         -n)
     518            nicelevel="${2}"
     519            shift 2
     520            ;;
     521         -p)
     522            pidfile="${2}"
     523            shift 2
     524            ;;
     525         -*)
     526            log_failure_msg "Unknown Option: ${1}"
     527            return 2 #invalid or excess argument(s)
     528            ;;
     529         *)
     530            break
     531            ;;
     532      esac
     533   done
     534
     535   if [ "${#}" = "0" ]; then
     536      log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
     537      return 2 #invalid or excess argument(s)
     538   fi
     539
     540   if [ -z "${forcestart}" ]; then
     541      if [ -z "${pidfile}" ]; then
     542         pidofproc -s "${1}"
     543      else
     544         pidofproc -s -p "${pidfile}" "${1}"
     545      fi
     546
     547      case "${?}" in
     548         0)
     549            log_warning_msg "Unable to continue: ${1} is running"
     550            return 0 # 4
     551            ;;
     552         1)
     553            boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING}
     554            rm -f "${pidfile}"
     555            ;;
     556         3)
     557            ;;
     558         *)
     559            log_failure_msg "Unknown error code from pidofproc: ${?}"
     560            return 4
     561            ;;
     562      esac
     563   fi
     564
     565   nice -n "${nicelevel}" "${@}"
     566   evaluate_retval # This is "Probably" not LSB compliant,
    579567#                         but required to be compatible with older bootscripts
    580         return 0
     568   return 0
    581569}
    582570
     
    604592killproc()
    605593{
    606         local pidfile=""
    607         local killsig=TERM # default signal is SIGTERM
    608         pidlist=""
    609 
    610         # This will ensure compatibility with previous LFS Bootscripts
    611         if [ -n "${PIDFILE}" ]; then
    612                 pidfile="${PIDFILE}"
    613         fi
    614 
    615         while true
    616         do
    617                 case "${1}" in
    618                         -p)
    619                                 pidfile="${2}"
    620                                 shift 2
    621                                 ;;
    622                         -*)
    623                                 log_failure_msg "Unknown Option: ${1}"
    624                                 return 2
    625                                 ;;
    626                         *)
    627                                 break
    628                                 ;;
    629                 esac
    630         done
    631 
    632         if [ "${#}" = "2" ]; then
    633                 killsig="${2}"
    634         elif [ "${#}" != "1" ]; then
    635                 shift 2
    636                 log_failure_msg "Usage: killproc  [-p pidfile] pathname [signal]"
    637                 return 2
    638         fi
    639 
    640         # Is the process running?
    641         if [ -z "${pidfile}" ]; then
    642                 pidofproc -s "${1}"
    643         else
    644                 pidofproc -s -p "${pidfile}" "${1}"
    645         fi
    646 
    647         # Remove stale pidfile
    648         if [ "$?" = 1 ]; then
    649                 boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING}
    650                 rm -f "${pidfile}"
    651         fi
     594   local pidfile=""
     595   local killsig=TERM # default signal is SIGTERM
     596   pidlist=""
     597
     598   # This will ensure compatibility with previous LFS Bootscripts
     599   if [ -n "${PIDFILE}" ]; then
     600      pidfile="${PIDFILE}"
     601   fi
     602
     603   while true
     604   do
     605      case "${1}" in
     606         -p)
     607            pidfile="${2}"
     608            shift 2
     609            ;;
     610         -*)
     611            log_failure_msg "Unknown Option: ${1}"
     612            return 2
     613            ;;
     614         *)
     615            break
     616            ;;
     617      esac
     618   done
     619
     620   if [ "${#}" = "2" ]; then
     621      killsig="${2}"
     622   elif [ "${#}" != "1" ]; then
     623      shift 2
     624      log_failure_msg "Usage: killproc  [-p pidfile] pathname [signal]"
     625      return 2
     626   fi
     627
     628   # Is the process running?
     629   if [ -z "${pidfile}" ]; then
     630      pidofproc -s "${1}"
     631   else
     632      pidofproc -s -p "${pidfile}" "${1}"
     633   fi
     634
     635   # Remove stale pidfile
     636   if [ "$?" = 1 ]; then
     637      boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING}
     638      rm -f "${pidfile}"
     639   fi
    652640
    653641    # If running, send the signal
    654642    if [ -n "${pidlist}" ]; then
    655         for pid in ${pidlist}
    656         do
    657                 kill -${killsig} ${pid} 2>/dev/null
    658 
    659                 # Wait up to 3 seconds, for ${pid} to terminate
    660                 case "${killsig}" in
    661                 TERM|SIGTERM|KILL|SIGKILL)
    662                         # sleep in 1/10ths of seconds and
    663                         # multiply KILLDELAY by 10
    664                         local dtime="${KILLDELAY}0"
    665                         while [ "${dtime}" != "0" ]
    666                         do
    667                                 kill -0 ${pid} 2>/dev/null || break
    668                                 sleep 0.1
    669                                 dtime=$(( ${dtime} - 1))
    670                         done
    671                         # If ${pid} is still running, kill it
    672                         kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null
    673                         ;;
    674                 esac
    675         done
    676 
    677         # Check if the process is still running if we tried to stop it
    678         case "${killsig}" in
    679         TERM|SIGTERM|KILL|SIGKILL)
    680                 if [ -z "${pidfile}" ]; then
    681                         pidofproc -s "${1}"
    682                 else
    683                         pidofproc -s -p "${pidfile}" "${1}"
    684                 fi
    685 
    686                 # Program was terminated
    687                 if [ "$?" != "0" ]; then
    688                         # Remove the pidfile if necessary
    689                         if [ -f "${pidfile}" ]; then
    690                                 rm -f "${pidfile}"
    691                         fi
    692                         echo_ok
    693                         return 0
    694                 else # Program is still running
    695                         echo_failure
    696                         return 4 # Unknown Status
    697                 fi
    698                 ;;
    699         *)
    700                 # Just see if the kill returned successfully
    701                 evaluate_retval
    702                 ;;
    703         esac
     643   for pid in ${pidlist}
     644   do
     645      kill -${killsig} ${pid} 2>/dev/null
     646
     647      # Wait up to 3 seconds, for ${pid} to terminate
     648      case "${killsig}" in
     649      TERM|SIGTERM|KILL|SIGKILL)
     650         # sleep in 1/10ths of seconds and
     651         # multiply KILLDELAY by 10
     652         local dtime="${KILLDELAY}0"
     653         while [ "${dtime}" != "0" ]
     654         do
     655            kill -0 ${pid} 2>/dev/null || break
     656            sleep 0.1
     657            dtime=$(( ${dtime} - 1))
     658         done
     659         # If ${pid} is still running, kill it
     660         kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null
     661         ;;
     662      esac
     663   done
     664
     665   # Check if the process is still running if we tried to stop it
     666   case "${killsig}" in
     667   TERM|SIGTERM|KILL|SIGKILL)
     668      if [ -z "${pidfile}" ]; then
     669         pidofproc -s "${1}"
     670      else
     671         pidofproc -s -p "${pidfile}" "${1}"
     672      fi
     673
     674      # Program was terminated
     675      if [ "$?" != "0" ]; then
     676         # Remove the pidfile if necessary
     677         if [ -f "${pidfile}" ]; then
     678            rm -f "${pidfile}"
     679         fi
     680         echo_ok
     681         return 0
     682      else # Program is still running
     683         echo_failure
     684         return 4 # Unknown Status
     685      fi
     686      ;;
     687   *)
     688      # Just see if the kill returned successfully
     689      evaluate_retval
     690      ;;
     691   esac
    704692    else # process not running
    705         print_status warning not_running
     693   print_status warning not_running
    706694    fi
    707695}
     
    724712log_success_msg()
    725713{
    726         ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
    727         ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}""  OK  ""${BRACKET}""]""${NORMAL}"
    728         return 0
     714   ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
     715   ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}""  OK  ""${BRACKET}""]""${NORMAL}"
     716   ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" >> /run/var/bootlog
     717   ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}""  OK  ""${BRACKET}""]""${NORMAL}" \
     718         >> /run/var/bootlog
     719   return 0
    729720}
    730721
     
    744735#*******************************************************************************
    745736log_failure_msg() {
    746         ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
    747         ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
    748         return 0
     737   ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
     738   ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
     739   ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" >> /run/var/bootlog
     740   ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" \
     741         >> /run/var/bootlog
     742   return 0
    749743}
    750744
     
    764758#*******************************************************************************
    765759log_warning_msg() {
    766         ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
    767         ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
    768         return 0
    769 }
    770 
    771 # End $rc_base/init.d/functions
     760   ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
     761   ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
     762   ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" >> /run/var/bootlog
     763   ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" \
     764         >> /run/var/bootlog
     765   return 0
     766}
     767
     768#*******************************************************************************
     769# Function - log_skipped_msg "message"
     770#
     771# Purpose: print a message that the script was skipped
     772#
     773# Inputs: $@ - Message
     774#
     775# Outputs: Text output to screen
     776#
     777# Dependencies: echo
     778#
     779# Todo: logging
     780#
     781#*******************************************************************************
     782log_skipped_msg() {
     783   ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
     784   ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" SKIP ""${BRACKET}""]""${NORMAL}"
     785   ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" >> /run/var/bootlog
     786   ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" SKIP ""${BRACKET}""]""${NORMAL}" \
     787         >> /run/var/bootlog
     788   return 0
     789}
     790
     791# End boot functions
  • bootscripts/lfs/init.d/halt

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/halt
     3# Begin halt
    44#
    55# Description : Halt Script
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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:            halt
     16# Required-Start:
     17# Should-Start:
     18# Required-Stop:
     19# Should-Stop:
     20# Default-Start:       0
     21# Default-Stop:
     22# Short-Description:   Halts the system.
     23# Description:         Halts the System.
     24# X-LFS-Provided-By:   LFS
     25### END INIT INFO
    1726
    1827case "${1}" in
    19         stop)
    20                 halt -d -f -i -p
    21                 ;;
    22         *)
    23                 echo "Usage: {stop}"
    24                 exit 1
    25                 ;;
     28   stop)
     29      halt -d -f -i -p
     30      ;;
     31
     32   *)
     33      echo "Usage: {stop}"
     34      exit 1
     35      ;;
    2636esac
    2737
    28 # End $rc_base/init.d/halt
     38# End halt
  • bootscripts/lfs/init.d/localnet

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/localnet
     3# Begin localnet
    44#
    55# Description : Loopback device
    66#
    77# Authors     : Gerard Beekmans  - gerard@linuxfromscratch.org
     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:            localnet
     16# Required-Start:      $local_fs
     17# Should-Start:
     18# Required-Stop:
     19# Should-Stop:
     20# Default-Start:       S
     21# Default-Stop:        0 6
     22# Short-Description:   Starts the local network.
     23# Description:         Sets the hostname of the machine and starts the
     24#                      loopback interface.
     25# X-LFS-Provided-By:   LFS
     26### END INIT INFO
     27
     28. /lib/boot/functions
    1729. /etc/sysconfig/network
    1830
    1931case "${1}" in
    20         start)
    21                 boot_mesg "Bringing up the loopback interface..."
    22                 ip addr add 127.0.0.1/8 label lo dev lo
    23                 ip link set lo up
    24                 evaluate_retval
     32   start)
     33      boot_mesg "Bringing up the loopback interface..."
     34      ip addr add 127.0.0.1/8 label lo dev lo
     35      ip link set lo up
     36      evaluate_retval
    2537
    26                 boot_mesg "Setting hostname to ${HOSTNAME}..."
    27                 hostname ${HOSTNAME}
    28                 evaluate_retval
    29                 ;;
     38      boot_mesg "Setting hostname to ${HOSTNAME}..."
     39      hostname ${HOSTNAME}
     40      evaluate_retval
     41      ;;
    3042
    31         stop)
    32                 boot_mesg "Bringing down the loopback interface..."
    33                 ip link set lo down
    34                 evaluate_retval
    35                 ;;
     43   stop)
     44      boot_mesg "Bringing down the loopback interface..."
     45      ip link set lo down
     46      evaluate_retval
     47      ;;
    3648
    37         restart)
    38                 ${0} stop
    39                 sleep 1
    40                 ${0} start
    41                 ;;
     49   restart)
     50      ${0} stop
     51      sleep 1
     52      ${0} start
     53      ;;
    4254
    43         status)
    44                 echo "Hostname is: $(hostname)"
    45                 ip link show lo
    46                 ;;
     55   status)
     56      echo "Hostname is: $(hostname)"
     57      ip link show lo
     58      ;;
    4759
    48         *)
    49                 echo "Usage: ${0} {start|stop|restart|status}"
    50                 exit 1
    51                 ;;
     60   *)
     61      echo "Usage: ${0} {start|stop|restart|status}"
     62      exit 1
     63      ;;
    5264esac
    5365
    54 # End $rc_base/init.d/localnet
     66# End localnet
  • 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
  • bootscripts/lfs/init.d/mountfs

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/mountfs
     3# Begin mountfs
    44#
    55# Description : File System Mount Script
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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:            $local_fs
     16# Required-Start:      udev checkfs
     17# Should-Start:
     18# Required-Stop:       swap
     19# Should-Stop:
     20# Default-Start:       S
     21# Default-Stop:        0 6
     22# Short-Description:   Mounts/unmounts local filesystems defined in /etc/fstab.
     23# Description:         Remounts root filesystem read/write and mounts all
     24#                      remaining local filesystems defined in /etc/fstab on
     25#                      start.  Remounts root filesystem read-only and unmounts
     26#                      remaining filesystems on stop.
     27# X-LFS-Provided-By:   LFS
     28### END INIT INFO
     29
     30. /lib/boot/functions
    1731
    1832case "${1}" in
    19         start)
    20                 boot_mesg "Remounting root file system in read-write mode..."
    21                 mount -n -o remount,rw / >/dev/null
    22                 evaluate_retval
     33   start)
     34      boot_mesg "Remounting root file system in read-write mode..."
     35      mount -n -o remount,rw / >/dev/null
     36      evaluate_retval
    2337
    24                 # Remove fsck-related file system watermarks.
    25                 rm -f /fastboot /forcefsck
     38      # Remove fsck-related file system watermarks.
     39      rm -f /fastboot /forcefsck
    2640
    27                 boot_mesg "Recording existing mounts in /etc/mtab..."
    28                 > /etc/mtab
     41      boot_mesg "Recording existing mounts in /etc/mtab..."
     42      > /etc/mtab
    2943
    30                 mount -f / || failed=1
    31                 mount -f /proc || failed=1
    32                 mount -f /sys || failed=1
    33                 mount -f /run || failed=1
    34                 (exit ${failed})
    35                 evaluate_retval
     44      mount -f /    || failed=1
     45      mount -f /proc || failed=1
     46      mount -f /sys || failed=1
     47      mount -f /run || failed=1
     48      (exit ${failed})
     49      evaluate_retval
    3650
    37                 # This will mount all filesystems that do not have _netdev in
    38                 # their option list.  _netdev denotes a network filesystem.
    39                 boot_mesg "Mounting remaining file systems..."
    40                 mount -a -O no_netdev >/dev/null
    41                 evaluate_retval
    42                 ;;
     51      # This will mount all filesystems that do not have _netdev in
     52      # their option list.  _netdev denotes a network filesystem.
     53      boot_mesg "Mounting remaining file systems..."
     54      mount -a -O no_netdev >/dev/null
     55      evaluate_retval
     56      ;;
    4357
    44         stop)
    45                 boot_mesg "Unmounting all other currently mounted file systems..."
    46                 umount -a -d -r >/dev/null
    47                 evaluate_retval
    48                 ;;
     58   stop)
     59      boot_mesg "Unmounting all other currently mounted file systems..."
     60      umount -a -d -r >/dev/null
     61      evaluate_retval
     62      ;;
    4963
    50         *)
    51                 echo "Usage: ${0} {start|stop}"
    52                 exit 1
    53                 ;;
     64   *)
     65      echo "Usage: ${0} {start|stop}"
     66      exit 1
     67      ;;
    5468esac
    5569
    56 # End $rc_base/init.d/mountfs
     70# End mountfs
  • bootscripts/lfs/init.d/mountvirtfs

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/mountvirtfs
     3# Begin mountvirtfs
    44#
    55# Description : Mount proc, sysfs, and run
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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:            mountvirtfs
     16# Required-Start:
     17# Should-Start:
     18# Required-Stop:
     19# Should-Stop:
     20# Default-Start:       S
     21# Default-Stop:
     22# Short-Description:   Mounts /sys and /proc virtual (kernel) filesystems.
     23#                      Mounts /run tmpfs.
     24# Description:         Mounts /sys and /proc virtual (kernel) filesystems.
     25#                      Mounts /run tmpfs.
     26# X-LFS-Provided-By:   LFS
     27### END INIT INFO
     28
     29. /lib/boot/functions
    1730
    1831case "${1}" in
    19         start)
    20                 boot_mesg -n "Mounting virtual file systems:" ${INFO}
     32   start)
     33      mkdir -p /run
     34      mount -n /run || failed=1
     35      mkdir -p /run/{var,lock,shm}
    2136
    22                 if ! mountpoint /proc >/dev/null; then
    23                         boot_mesg -n " /proc" ${NORMAL}
    24                         mount -n /proc || failed=1
    25                 fi
    2637
    27                 if ! mountpoint /sys >/dev/null; then
    28                         boot_mesg -n " /sys" ${NORMAL}
    29                         mount -n /sys || failed=1
    30                 fi
     38      boot_mesg -n "Mounting virtual file systems:" ${INFO}
     39      boot_mesg -n " /run" ${NORMAL}
    3140
    32                 if ! mountpoint /run >/dev/null; then
    33                         boot_mesg -n " /run" ${NORMAL}
    34                         mount -n /run || failed=1
    35                         mkdir /run/{var,lock,shm}
    36                 fi
     41      if ! mountpoint /proc >/dev/null; then
     42         boot_mesg -n " /proc" ${NORMAL}
     43         mount -n /proc || failed=1
     44      fi
    3745
    38                 boot_mesg "" ${NORMAL}
     46      if ! mountpoint /sys >/dev/null; then
     47         boot_mesg -n " /sys" ${NORMAL}
     48         mount -n /sys || failed=1
     49      fi
    3950
    40                 (exit ${failed})
    41                 evaluate_retval
    42                 ;;
     51      boot_mesg "" ${NORMAL}
    4352
    44         *)
    45                 echo "Usage: ${0} {start}"
    46                 exit 1
    47                 ;;
     53      (exit ${failed})
     54      evaluate_retval
     55      ;;
     56
     57   *)
     58      echo "Usage: ${0} {start}"
     59      exit 1
     60      ;;
    4861esac
    4962
    50 # End $rc_base/init.d/mountvertfs
     63# End mountvertfs
  • bootscripts/lfs/init.d/network

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/network
     3# Begin network
    44#
    55# Description : Network Control Script
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
    8 #               Nathan Coulson - nathan@linuxfromscratch.org
    9 #               Kevin P. Fleming - kpfleming@linuxfromscratch.org
     8#               Nathan Coulson - nathan@linuxfromscratch.org
     9#               Kevin P. Fleming - kpfleming@linuxfromscratch.org
     10# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    1011#
    11 # Version     : 00.00
    12 #
    13 # Notes       :
     12# Version     : LFS 7.0
    1413#
    1514########################################################################
    1615
    17 . /etc/sysconfig/rc
    18 . ${rc_functions}
    19 . /etc/sysconfig/network
     16### BEGIN INIT INFO
     17# Provides:            $network
     18# Required-Start:      $local_fs swap localnet
     19# Should-Start:        $syslog
     20# Required-Stop:       $local_fs swap localnet
     21# Should-Stop:         $syslog
     22# Default-Start:       3 4 5
     23# Default-Stop:        0 1 2 6
     24# Short-Description:   Starts and configures network interfaces.
     25# Description:         Starts and configures network interfaces.
     26# X-LFS-Provided-By:   LFS
     27### END INIT INFO
    2028
    2129case "${1}" in
    22         start)
    23                 # Start all network interfaces
    24                 for file in ${network_devices}/ifconfig.*
    25                 do
    26                         interface=${file##*/ifconfig.}
     30   start)
     31      # Start all network interfaces
     32      for file in /etc/sysconfig/ifconfig.*
     33      do
     34         interface=${file##*/ifconfig.}
    2735
    28                         # skip if $file is * (because nothing was found)
    29                         if [ "${interface}" = "*" ]
    30                         then
    31                                 continue
    32                         fi
     36         # skip if $file is * (because nothing was found)
     37         if [ "${interface}" = "*" ]
     38         then
     39            continue
     40         fi
    3341
    34                         IN_BOOT=1 ${network_devices}/ifup ${interface}
    35                 done
    36                 ;;
     42         /sbin/ifup ${interface}
     43      done
     44      ;;
    3745
    38         stop)
    39                 # Reverse list
    40                 FILES=""
    41                 for file in ${network_devices}/ifconfig.*
    42                 do
    43                         FILES="${file} ${FILES}"
    44                 done
     46   stop)
     47      # Reverse list
     48      FILES=""
     49      for file in  /etc/sysconfig/ifconfig.*
     50      do
     51         FILES="${file} ${FILES}"
     52      done
    4553
    46                 # Stop all network interfaces
    47                 for file in ${FILES}
    48                 do
    49                         interface=${file##*/ifconfig.}
     54      # Stop all network interfaces
     55      for file in ${FILES}
     56      do
     57         interface=${file##*/ifconfig.}
    5058
    51                         # skip if $file is * (because nothing was found)
    52                         if [ "${interface}" = "*" ]
    53                         then
    54                                 continue
    55                         fi
     59         # skip if $file is * (because nothing was found)
     60         if [ "${interface}" = "*" ]
     61         then
     62            continue
     63         fi
    5664
    57                         IN_BOOT=1 ${network_devices}/ifdown ${interface}
    58                 done
    59                 ;;
     65         /sbin/ifdown ${interface}
     66      done
     67      ;;
    6068
    61         restart)
    62                 ${0} stop
    63                 sleep 1
    64                 ${0} start
    65                 ;;
     69   restart)
     70      ${0} stop
     71      sleep 1
     72      ${0} start
     73      ;;
    6674
    67         *)
    68                 echo "Usage: ${0} {start|stop|restart}"
    69                 exit 1
    70                 ;;
     75   *)
     76      echo "Usage: ${0} {start|stop|restart}"
     77      exit 1
     78      ;;
    7179esac
    7280
    73 # End /etc/rc.d/init.d/network
     81# End network
  • bootscripts/lfs/init.d/rc

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/rc
     3# Begin rc
    44#
    55# Description : Main Run Level Control Script
    66#
    77# Authors     : Gerard Beekmans  - gerard@linuxfromscratch.org
     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. /lib/boot/functions
     15
     16print_error_msg()
     17{
     18   echo_failure
     19   # $i is set when called
     20   boot_mesg -n "FAILURE:\n\nYou should not be reading this error message.\n\n" ${FAILURE}
     21   boot_mesg -n " It means that an unforeseen error took"
     22   boot_mesg -n " place in ${i}, which exited with a return value of"
     23   boot_mesg " ${error_value}.\n"
     24   boot_mesg_flush
     25   boot_mesg -n "If you're able to track this"
     26   boot_mesg -n " error down to a bug in one of the files provided by"
     27   boot_mesg -n " the LFS book, please be so kind to inform us at"
     28   boot_mesg " lfs-dev@linuxfromscratch.org.\n"
     29   boot_mesg_flush
     30   boot_mesg -n "Press Enter to continue..." ${INFO}
     31   boot_mesg "" ${NORMAL}
     32   wait_for_user
     33}
     34
     35check_script_status()
     36{
     37   # $i is set when called
     38   if [ ! -f ${i} ]; then
     39      boot_mesg "${i} is not a valid symlink." ${WARNING}
     40      echo_warning
     41      continue
     42   fi
     43
     44   if [ ! -x ${i} ]; then
     45      boot_mesg "${i} is not executable, skipping." ${WARNING}
     46      echo_warning
     47      continue
     48   fi
     49}
    1750
    1851# This sets a few default terminal options.
     
    2558
    2659if [ "${runlevel}" = "" ]; then
    27         echo "Usage: ${0} <runlevel>" >&2
    28         exit 1
     60   echo "Usage: ${0} <runlevel>" >&2
     61   exit 1
    2962fi
    3063
     
    3265[ "${previous}" = "" ] && previous=N
    3366
    34 if [ ! -d ${rc_base}/rc${runlevel}.d ]; then
    35         boot_mesg "${rc_base}/rc${runlevel}.d does not exist." ${WARNING}
    36         boot_mesg_flush
    37         exit 1
     67if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then
     68   boot_mesg "/etc/rc.d/rc${runlevel}.d does not exist."
     69   exit 1
    3870fi
    3971
    40 # Attempt to stop all service started by previous runlevel,
     72# Attempt to stop all services started by the previous runlevel,
    4173# and killed in this runlevel
    4274if [ "${previous}" != "N" ]; then
    43         for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null)
    44         do
    45                 check_script_status
     75   for i in $(ls -v /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null)
     76   do
     77      check_script_status
    4678
    47                 suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]}
    48                 prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
    49                 sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix
     79      suffix=${i#/etc/rc.d/rc$runlevel.d/K[0-9][0-9]}
     80      prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix
     81      sysinit_start=/etc/rc.d/rcsysinit.d/S[0-9][0-9]$suffix
    5082
    51                 if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then
    52                         if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
    53                                 boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING}
    54                                 boot_mesg -n " executed because it was not"
    55                                 boot_mesg -n " not started in the previous"
    56                                 boot_mesg -n " runlevel (${previous})."
    57                                 boot_mesg "" ${NORMAL}
    58                                 boot_mesg_flush
    59                                 continue
    60                         fi
    61                 fi
    62                 ${i} stop
    63                 error_value=${?}
     83      if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then
     84         if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then
     85            boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING}
     86            boot_mesg -n " executed because it was not"
     87            boot_mesg -n " not started in the previous"
     88            boot_mesg -n " runlevel (${previous})."
     89            boot_mesg "" ${NORMAL}
     90            boot_mesg_flush
     91            continue
     92         fi
     93      fi
     94      ${i} stop
     95      error_value=${?}
    6496
    65                 if [ "${error_value}" != "0" ]; then
    66                         print_error_msg
    67                 fi
    68         done
     97      if [ "${error_value}" != "0" ]; then
     98         print_error_msg
     99      fi
     100   done
    69101fi
    70102
     103[ "${previous}" = "N" ] && IN_BOOT=1
     104
    71105#Start all functions in this runlevel
    72 for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null)
     106for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null)
    73107do
    74         if [ "${previous}" != "N" ]; then
    75                 suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]}
    76                 stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix
    77                 prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix
     108   if [ "${previous}" != "N" ]; then
     109      suffix=${i#/etc/rc.d/rc$runlevel.d/S[0-9][0-9]}
     110      stop=/etc/rc.d/rc$runlevel.d/K[0-9][0-9]$suffix
     111      prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix
    78112
    79                 [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue
    80         fi
     113      [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue
     114   fi
    81115
    82         check_script_status
     116   check_script_status
    83117
    84         case ${runlevel} in
    85                 0|6)
    86                         ${i} stop
    87                         ;;
    88                 *)
    89                         ${i} start
    90                         ;;
    91         esac
    92         error_value=${?}
     118   case ${runlevel} in
     119      0|6)
     120         ${i} stop
     121         ;;
     122      *)
     123         ${i} start
     124         ;;
     125   esac
     126   error_value=${?}
    93127
    94         if [ "${error_value}" != "0" ]; then
    95                 print_error_msg
    96         fi
     128   if [ "${error_value}" != "0" ]; then
     129      print_error_msg
     130   fi
    97131done
    98132
    99 # End $rc_base/init.d/rc
     133# End rc
  • bootscripts/lfs/init.d/reboot

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/reboot
     3# Begin reboot
    44#
    55# Description : Reboot Scripts
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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:            reboot
     16# Required-Start:
     17# Should-Start:
     18# Required-Stop:
     19# Should-Stop:
     20# Default-Start:       6
     21# Default-Stop:
     22# Short-Description:   Reboots the system.
     23# Description:         Reboots the System.
     24# X-LFS-Provided-By:   LFS
     25### END INIT INFO
     26
     27. /lib/boot/functions
    1728
    1829case "${1}" in
    19         stop)
    20                 boot_mesg "Restarting system..."
    21                 reboot -d -f -i
    22                 ;;
     30   stop)
     31      boot_mesg "Restarting system..."
     32      reboot -d -f -i
     33      ;;
    2334
    24         *)
    25                 echo "Usage: ${0} {stop}"
    26                 exit 1
    27                 ;;
     35   *)
     36      echo "Usage: ${0} {stop}"
     37      exit 1
     38      ;;
    2839
    2940esac
    3041
    31 # End $rc_base/init.d/reboot
     42# End reboot
  • bootscripts/lfs/init.d/sendsignals

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/sendsignals
     3# Begin sendsignals
    44#
    55# Description : Sendsignals Script
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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:            sendsignals
     16# Required-Start:
     17# Should-Start:
     18# Required-Stop:       $local_fs swap localnet
     19# Should-Stop:
     20# Default-Start:
     21# Default-Stop:        0 6
     22# Short-Description:   Attempts to kill remaining processes.
     23# Description:         Attempts to kill remaining processes.
     24# X-LFS-Provided-By:   LFS
     25### END INIT INFO
     26
     27. /lib/boot//functions
    1728
    1829case "${1}" in
    19         stop)
    20                 boot_mesg "Sending all processes the TERM signal..."
    21                 killall5 -15
    22                 error_value=${?}
     30   stop)
     31      boot_mesg "Sending all processes the TERM signal..."
     32      killall5 -15
     33      error_value=${?}
    2334
    24                 sleep ${KILLDELAY}
     35      sleep ${KILLDELAY}
    2536
    26                 if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
    27                         echo_ok
    28                 else
    29                         echo_failure
    30                 fi
     37      if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
     38         echo_ok
     39      else
     40         echo_failure
     41      fi
    3142
    32                 boot_mesg "Sending all processes the KILL signal..."
    33                 killall5 -9
    34                 error_value=${?}
     43      boot_mesg "Sending all processes the KILL signal..."
     44      killall5 -9
     45      error_value=${?}
    3546
    36                 sleep ${KILLDELAY}
     47      sleep ${KILLDELAY}
    3748
    38                 if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
    39                         echo_ok
    40                 else
    41                         echo_failure
    42                 fi
    43                 ;;
     49      if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
     50         echo_ok
     51      else
     52         echo_failure
     53      fi
     54      ;;
    4455
    45         *)
    46                 echo "Usage: ${0} {stop}"
    47                 exit 1
    48                 ;;
     56   *)
     57      echo "Usage: ${0} {stop}"
     58      exit 1
     59      ;;
    4960
    5061esac
    5162
    52 # End $rc_base/init.d/sendsignals
     63# End sendsignals
  • bootscripts/lfs/init.d/setclock

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/setclock
     3# Begin setclock
    44#
    55# Description : Setting Linux Clock
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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}
    17 . /etc/sysconfig/clock
     14### BEGIN INIT INFO
     15# Provides:            $time
     16# Required-Start:
     17# Should-Start:        modules
     18# Required-Stop:
     19# Should-Stop:         $syslog
     20# Default-Start:       S
     21# Default-Stop:
     22# Short-Description:   Stores and restores time from the hardware clock
     23# Description:         On boot, system time is obtained from hwclock.  The
     24#                      hardware clock can also be set on shutdown.
     25# X-LFS-Provided-By:   LFS BLFS
     26### END INIT INFO
     27
     28. /lib/boot/functions
     29
     30[ -r /etc/sysconfig/clock ] &&  . /etc/sysconfig/clock
     31
    1832
    1933case "${UTC}" in
    20         yes|true|1)
    21                 CLOCKPARAMS="${CLOCKPARAMS} --utc"
    22                 ;;
     34   yes|true|1)
     35      CLOCKPARAMS="${CLOCKPARAMS} --utc"
     36      ;;
    2337
    24         no|false|0)
    25                 CLOCKPARAMS="${CLOCKPARAMS} --localtime"
    26                 ;;
     38   no|false|0)
     39      CLOCKPARAMS="${CLOCKPARAMS} --localtime"
     40      ;;
    2741
    2842esac
    2943
    3044case ${1} in
    31         start)
    32                 boot_mesg "Setting system clock..."
    33                 hwclock --hctosys ${CLOCKPARAMS} >/dev/null
    34                 evaluate_retval
    35                 ;;
     45   start)
     46      boot_mesg "Setting system clock..."
     47      hwclock --hctosys ${CLOCKPARAMS} >/dev/null
     48      evaluate_retval
     49      ;;
    3650
    37         stop)
    38                 boot_mesg "Setting hardware clock..."
    39                 hwclock --systohc ${CLOCKPARAMS} >/dev/null
    40                 evaluate_retval
    41                 ;;
     51   stop)
     52      boot_mesg "Setting hardware clock..."
     53      hwclock --systohc ${CLOCKPARAMS} >/dev/null
     54      evaluate_retval
     55      ;;
    4256
    43         *)
    44                 echo "Usage: ${0} {start|stop}"
    45                 ;;
     57   *)
     58      echo "Usage: ${0} {start|stop}"
     59      ;;
    4660
    4761esac
  • bootscripts/lfs/init.d/swap

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/swap
     3# Begin swap
    44#
    55# Description : Swap Control Script
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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:            swap
     16# Required-Start:      udev
     17# Should-Start:        modules
     18# Required-Stop:       localnet
     19# Should-Stop:
     20# Default-Start:       S
     21# Default-Stop:        0 6
     22# Short-Description:   Mounts and unmounts swap partitions.
     23# Description:         Mounts and unmounts swap partitions defined in
     24#                      /etc/fstab.
     25# X-LFS-Provided-By:   LFS
     26### END INIT INFO
     27
     28. /lib/boot/functions
    1729
    1830case "${1}" in
    19         start)
    20                 boot_mesg "Activating all swap files/partitions..."
    21                 swapon -a
    22                 evaluate_retval
    23                 ;;
     31   start)
     32      boot_mesg "Activating all swap files/partitions..."
     33      swapon -a
     34      evaluate_retval
     35      ;;
    2436
    25         stop)
    26                 boot_mesg "Deactivating all swap files/partitions..."
    27                 swapoff -a
    28                 evaluate_retval
    29                 ;;
     37   stop)
     38      boot_mesg "Deactivating all swap files/partitions..."
     39      swapoff -a
     40      evaluate_retval
     41      ;;
    3042
    31         restart)
    32                 ${0} stop
    33                 sleep 1
    34                 ${0} start
    35                 ;;
     43   restart)
     44      ${0} stop
     45      sleep 1
     46      ${0} start
     47      ;;
    3648
    37         status)
    38                 boot_mesg "Retrieving swap status." ${INFO}
    39                 echo_ok
    40                 echo
    41                 swapon -s
    42                 ;;
     49   status)
     50      boot_mesg "Retrieving swap status." ${INFO}
     51      echo_ok
     52      echo
     53      swapon -s
     54      ;;
    4355
    44         *)
    45                 echo "Usage: ${0} {start|stop|restart|status}"
    46                 exit 1
    47                 ;;
     56   *)
     57      echo "Usage: ${0} {start|stop|restart|status}"
     58      exit 1
     59      ;;
    4860esac
    4961
    50 # End $rc_base/init.d/swap
     62# End swap
  • bootscripts/lfs/init.d/sysctl

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/sysctl
     3# Begin sysctl
    44#
    55# Description : File uses /etc/sysctl.conf to set kernel runtime
     
    88# Authors     : Nathan Coulson (nathan@linuxfromscratch.org)
    99#               Matthew Burgress (matthew@linuxfromscratch.org)
     10# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    1011#
    11 # Version     : 00.00
    12 #
    13 # Notes       :
     12# Version     : LFS 7.0
    1413#
    1514########################################################################
    1615
    17 . /etc/sysconfig/rc
    18 . ${rc_functions}
     16### BEGIN INIT INFO
     17# Provides:            sysctl
     18# Required-Start:      mountkernfs
     19# Should-Start:
     20# Required-Stop:
     21# Should-Stop:
     22# Default-Start:       S
     23# Default-Stop:
     24# Short-Description:   Makes changes to the proc filesystem
     25# Description:         Makes changes to the proc filesystem as defined in
     26#                      /etc/sysctl.conf.  See 'man sysctl(8)'.
     27# X-LFS-Provided-By:   LFS
     28### END INIT INFO
     29
     30. /lib/boot/functions
    1931
    2032case "${1}" in
    21         start)
    22                 if [ -f "/etc/sysctl.conf" ]; then
    23                         boot_mesg "Setting kernel runtime parameters..."
    24                         sysctl -q -p
    25                         evaluate_retval
    26                 fi
    27                 ;;
     33   start)
     34      if [ -f "/etc/sysctl.conf" ]; then
     35         boot_mesg "Setting kernel runtime parameters..."
     36         sysctl -q -p
     37         evaluate_retval
     38      fi
     39      ;;
    2840
    29         status)
    30                 sysctl -a       
    31                 ;;
     41   status)
     42      sysctl -a
     43      ;;
    3244
    33         *)
    34                 echo "Usage: ${0} {start|status}"
    35                 exit 1
    36                 ;;
     45   *)
     46      echo "Usage: ${0} {start|status}"
     47      exit 1
     48      ;;
    3749esac
    3850
    39 # End $rc_base/init.d/sysctl
     51# End sysctl
  • bootscripts/lfs/init.d/sysklogd

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/sysklogd
     3# Begin sysklogd
    44#
    55# Description : Sysklogd loader
    66#
    77# Authors     : Gerard Beekmans - gerard@linuxfromscratch.org
     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:            $syslog
     16# Required-Start:      localnet
     17# Should-Start:
     18# Required-Stop:       $local_fs sendsignals
     19# Should-Stop:
     20# Default-Start:       2 3 4 5
     21# Default-Stop:        0 1 6
     22# Short-Description:   Starts kernel and system log daemons.
     23# Description:         Starts kernel and system log daemons.
     24#                      /etc/fstab.
     25# X-LFS-Provided-By:   LFS
     26### END INIT INFO
     27
     28. /lib/boot/functions
    1729
    1830case "${1}" in
    19         start)
    20                 boot_mesg "Starting system log daemon..."
    21                 loadproc syslogd -m 0
     31   start)
     32      boot_mesg "Starting system log daemon..."
     33      PARMS=${SYSKLOGD_PARMS=-'-m 0'}
     34      loadproc syslogd $PARMS
    2235
    23                 boot_mesg "Starting kernel log daemon..."
    24                 loadproc klogd
    25                 ;;
     36      boot_mesg "Starting kernel log daemon..."
     37      loadproc klogd
     38      ;;
    2639
    27         stop)
    28                 boot_mesg "Stopping kernel log daemon..."
    29                 killproc klogd
     40   stop)
     41      boot_mesg "Stopping kernel log daemon..."
     42      killproc klogd
    3043
    31                 boot_mesg "Stopping system log daemon..."
    32                 killproc syslogd
    33                 ;;
     44      boot_mesg "Stopping system log daemon..."
     45      killproc syslogd
     46      ;;
    3447
    35         reload)
    36                 boot_mesg "Reloading system log daemon config file..."
    37                 reloadproc syslogd
    38                 ;;
     48   reload)
     49      boot_mesg "Reloading system log daemon config file..."
     50      reloadproc syslogd
     51      ;;
    3952
    40         restart)
    41                 ${0} stop
    42                 sleep 1
    43                 ${0} start
    44                 ;;
     53   restart)
     54      ${0} stop
     55      sleep 1
     56      ${0} start
     57      ;;
    4558
    46         status)
    47                 statusproc syslogd
    48                 statusproc klogd
    49                 ;;
     59   status)
     60      statusproc syslogd
     61      statusproc klogd
     62      ;;
    5063
    51         *)
    52                 echo "Usage: ${0} {start|stop|reload|restart|status}"
    53                 exit 1
    54                 ;;
     64   *)
     65      echo "Usage: ${0} {start|stop|reload|restart|status}"
     66      exit 1
     67      ;;
    5568esac
    5669
    57 # End $rc_base/init.d/sysklogd
     70# End sysklogd
  • bootscripts/lfs/init.d/template

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/
     3# Begin scriptname
    44#
    55# Description :
     
    77# Authors     :
    88#
    9 # Version     : 00.00
     9# Version     : LFS x.x
    1010#
    1111# Notes       :
     
    1313########################################################################
    1414
    15 . /etc/sysconfig/rc
    16 . ${rc_functions}
     15### BEGIN INIT INFO
     16# Provides:            template
     17# Required-Start:
     18# Should-Start:
     19# Required-Stop:
     20# Should-Stop:
     21# Default-Start:
     22# Default-Stop:
     23# Short-Description:
     24# Description:
     25# X-LFS-Provided-By:
     26### END INIT INFO
     27
     28. /lib/boot/functions
    1729
    1830case "${1}" in
    19         start)
    20                 boot_mesg "Starting..."
    21                 loadproc
    22                 ;;
     31   start)
     32      boot_mesg "Starting..."
     33      loadproc
     34      ;;
    2335
    24         stop)
    25                 boot_mesg "Stopping..."
    26                 killproc
    27                 ;;
     36   stop)
     37      boot_mesg "Stopping..."
     38      killproc
     39      ;;
    2840
    29         reload)
    30                 boot_mesg "Reloading..."
    31                 reloadproc
    32                 ;;
     41   reload)
     42      boot_mesg "Reloading..."
     43      reloadproc
     44      ;;
    3345
    34         restart)
    35                 ${0} stop
    36                 sleep 1
    37                 ${0} start
    38                 ;;
     46   restart)
     47      ${0} stop
     48      sleep 1
     49      ${0} start
     50      ;;
    3951
    40         status)
    41                 statusproc
    42                 ;;
     52   status)
     53      statusproc
     54      ;;
    4355
    44         *)
    45                 echo "Usage: ${0} {start|stop|reload|restart|status}"
    46                 exit 1
    47                 ;;
     56   *)
     57      echo "Usage: ${0} {start|stop|reload|restart|status}"
     58      exit 1
     59      ;;
    4860esac
    4961
    50 # End $rc_base/init.d/
     62# End scriptname
  • bootscripts/lfs/init.d/udev

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/udev
     3# Begin udev
    44#
    55# Description : Udev cold-plugging script
    66#
    77# Authors     : Zack Winkles, Alexander E. Patrakov
     8# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    89#
    9 # Version     : 00.02
    10 #
    11 # Notes       :
     10# Version     : LFS 7.0
    1211#
    1312########################################################################
    1413
    15 . /etc/sysconfig/rc
    16 . ${rc_functions}
     14### BEGIN INIT INFO
     15# Provides:            udev
     16# Required-Start:
     17# Should-Start:        modules
     18# Required-Stop:
     19# Should-Stop:
     20# Default-Start:       S
     21# Default-Stop:
     22# Short-Description:   Populates /dev with device nodes.
     23# Description:         Mounts a tempfs on /dev and starts the udevd daemon.
     24#                      Device nodes are created as defined by udev.
     25# X-LFS-Provided-By:   LFS
     26### END INIT INFO
     27
     28. /lib/boot/functions
    1729
    1830case "${1}" in
    19         start)
    20                 boot_mesg "Populating /dev with device nodes..."
    21                 if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
    22                         echo_failure
    23                         boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
    24                         boot_mesg -n " devices without a SysFS filesystem"
    25                         boot_mesg -n "\n\nAfter you press Enter, this system"
    26                         boot_mesg -n " will be halted and powered off."
    27                         boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
    28                         boot_mesg "" ${NORMAL}
    29                         read ENTER
    30                         /etc/rc.d/init.d/halt stop
    31                 fi
     31   start)
     32      boot_mesg "Populating /dev with device nodes..."
     33      if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
     34         echo_failure
     35         boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
     36         boot_mesg -n " devices without a SysFS filesystem"
     37         boot_mesg -n "\n\nAfter you press Enter, this system"
     38         boot_mesg -n " will be halted and powered off."
     39         boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
     40         boot_mesg "" ${NORMAL}
     41         wait_for_user
     42         /etc/rc.d/init.d/halt stop
     43      fi
    3244
    33                 # Mount a temporary file system over /dev, so that any devices
    34                 # made or removed during this boot don't affect the next one.
    35                 # The reason we don't write to mtab is because we don't ever
    36                 # want /dev to be unavailable (such as by `umount -a').
    37                 if ! mountpoint /dev > /dev/null; then
    38                         mount -n -t tmpfs tmpfs /dev -o mode=755
    39                 fi
    40                 if [ ${?} != 0 ]; then
    41                         echo_failure
    42                         boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
    43                         boot_mesg -n " onto /dev, this system will be halted."
    44                         boot_mesg -n "\n\nAfter you press Enter, this system"
    45                         boot_mesg -n " will be halted and powered off."
    46                         boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
    47                         boot_mesg "" ${NORMAL}
    48                         read ENTER
    49                         /etc/rc.d/init.d/halt stop
    50                 fi
     45      # Mount a temporary file system over /dev, so that any devices
     46      # made or removed during this boot don't affect the next one.
     47      # The reason we don't write to mtab is because we don't ever
     48      # want /dev to be unavailable (such as by `umount -a').
     49      if ! mountpoint /dev > /dev/null; then
     50         mount -n -t tmpfs tmpfs /dev -o mode=755
     51      fi
     52      if [ ${?} != 0 ]; then
     53         echo_failure
     54         boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
     55         boot_mesg -n " onto /dev, this system will be halted."
     56         boot_mesg -n "\n\nAfter you press Enter, this system"
     57         boot_mesg -n " will be halted and powered off."
     58         boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
     59         boot_mesg "" ${NORMAL}
     60         wait_for_user
     61         /etc/rc.d/init.d/halt stop
     62      fi
    5163
    52                 ln -s /run/shm /dev/shm
     64      ln -s /run/shm /dev/shm
    5365
    54                 # Udev handles uevents itself, so we don't need to have
    55                 # the kernel call out to any binary in response to them
    56                 echo > /proc/sys/kernel/hotplug
     66      # Udev handles uevents itself, so we don't need to have
     67      # the kernel call out to any binary in response to them
     68      echo > /proc/sys/kernel/hotplug
    5769
    58                 # Copy the only static device node that Udev >= 155 doesn't
    59                 # handle to /dev
    60                 cp -a /lib/udev/devices/null /dev
     70      # Copy the only static device node that Udev >= 155 doesn't
     71      # handle to /dev
     72      cp -a /lib/udev/devices/null /dev
    6173
    62                 # Start the udev daemon to continually watch for, and act on,
    63                 # uevents
    64                 /sbin/udevd --daemon
     74      # Start the udev daemon to continually watch for, and act on,
     75      # uevents
     76      /sbin/udevd --daemon
    6577
    66                 # Now traverse /sys in order to "coldplug" devices that have
    67                 # already been discovered
    68                 /sbin/udevadm trigger --action=add --type=subsystems
    69                 /sbin/udevadm trigger --action=add --type=devices
     78      # Now traverse /sys in order to "coldplug" devices that have
     79      # already been discovered
     80      /sbin/udevadm trigger --action=add --type=subsystems
     81      /sbin/udevadm trigger --action=add --type=devices
    7082
    71                 # Now wait for udevd to process the uevents we triggered
    72                 /sbin/udevadm settle
    73                 evaluate_retval
     83      # Now wait for udevd to process the uevents we triggered
     84      /sbin/udevadm settle
     85      evaluate_retval
     86      ;;
    7487
    75                 ;;
    76 
    77         *)
    78                 echo "Usage ${0} {start}"
    79                 exit 1
    80                 ;;
     88   *)
     89      echo "Usage ${0} {start}"
     90      exit 1
     91      ;;
    8192esac
    8293
    83 # End $rc_base/init.d/udev
     94# End udev
  • bootscripts/lfs/init.d/udev_retry

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $rc_base/init.d/udev_retry
     3# Begin udev_retry
    44#
    55# Description : Udev cold-plugging script (retry)
    66#
    77# Authors     : Alexander E. Patrakov
     8# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    89#
    9 # Version     : 00.02
    10 #
    11 # Notes       :
     10# Version     : LFS 7.0
    1211#
    1312########################################################################
    1413
    15 . /etc/sysconfig/rc
    16 . ${rc_functions}
     14### BEGIN INIT INFO
     15# Provides:            udev_retry
     16# Required-Start:      udev
     17# Should-Start:        $local_fs
     18# Required-Stop:
     19# Should-Stop:
     20# Default-Start:       S
     21# Default-Stop:
     22# Short-Description:   Replays failed uevents and creates additonal devices.
     23# Description:         Replays any failed uevents that were skipped due to
     24#                      slow hardware initialization, and creates those needed
     25#                      device nodes
     26# X-LFS-Provided-By:   LFS
     27### END INIT INFO
     28
     29. /lib/boot/functions
    1730
    1831case "${1}" in
    19         start)
    20                 boot_mesg "Retrying failed uevents, if any..."
     32   start)
     33      boot_mesg "Retrying failed uevents, if any..."
    2134
    22                 # From Debian: "copy the rules generated before / was mounted
    23                 # read-write":
    24                 for file in /dev/.udev/tmp-rules--*; do
    25                         dest=${file##*tmp-rules--}
    26                         [ "$dest" = '*' ] && break
    27                         cat $file >> /etc/udev/rules.d/$dest
    28                         rm -f $file
    29                 done
     35      RUNDIR=$(/sbin/udevadm info --run)
     36      # From Debian: "copy the rules generated before / was mounted
     37      # read-write":
     38   
     39      for file in ${RUNDIR}/tmp-rules--*; do
     40         dest=${file##*tmp-rules--}
     41         [ "$dest" = '*' ] && break
     42         cat $file >> /etc/udev/rules.d/$dest
     43         rm -f $file
     44      done
    3045
    31                 # Re-trigger the failed uevents in hope they will succeed now
    32                 /sbin/udevadm trigger --type=failed --action=add
    33                
    34                 # Now wait for udevd to process the uevents we triggered
    35                 /sbin/udevadm settle
    36                 evaluate_retval
    37                 ;;
     46      # Re-trigger the failed uevents in hope they will succeed now
     47      /sbin/udevadm trigger --type=failed --action=add
    3848
    39         *)
    40                 echo "Usage ${0} {start}"
    41                 exit 1
    42                 ;;
     49      # Now wait for udevd to process the uevents we triggered
     50      /sbin/udevadm settle
     51      evaluate_retval
     52      ;;
     53
     54   *)
     55      echo "Usage ${0} {start}"
     56      exit 1
     57      ;;
    4358esac
    4459
    45 # End $rc_base/init.d/udev_retry
     60# End udev_retry
  • bootscripts/lfs/sysconfig/network-devices/ifdown

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $network_devices/ifdown
     3# Begin /sbin/ifdown
    44#
    55# Description : Interface Down
     
    77# Authors     : Nathan Coulson - nathan@linuxfromscratch.org
    88#               Kevin P. Fleming - kpfleming@linuxfromscratch.org
     9# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    910#
    10 # Version     : 00.01
     11# Version     : LFS 7.0
    1112#
    1213# Notes       : the IFCONFIG variable is passed to the scripts found
    13 #               in the services directory, to indicate what file the
     14#               in the /lib/boot directory, to indicate what file the
    1415#               service should source to get environmental variables.
    1516#
    1617########################################################################
    1718
    18 . /etc/sysconfig/rc
    19 . ${rc_functions}
     19file=/etc/sysconfig/ifconfig.${1}
    2020
    21 # Collect a list of configuration files for our interface
    22 if [ -n "${2}" ]; then
    23         for file in ${@#$1}; do # All parameters except $1
    24                 FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
    25         done
    26 elif [ -d "${network_devices}/ifconfig.${1}" ]; then
    27         FILES=`echo ${network_devices}/ifconfig.${1}/*`
    28 else
    29         FILES="${network_devices}/ifconfig.${1}"
     21# Skip backup files
     22[ "${file}" = "${file%""~""}" ] || exit 0
     23
     24. /lib/boot/functions
     25
     26if [ ! -r "${file}" ]; then
     27   boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
     28   echo_warning
     29   exit 1
    3030fi
    3131
    32 # Reverse the order configuration files are processed in
    33 for file in ${FILES}; do
    34         FILES2="${file} ${FILES2}"
    35 done
    36 FILES=${FILES2}
     32. ${file}
    3733
    38 # Process each configuration file
    39 for file in ${FILES}; do
    40         # skip backup files
    41         if [ "${file}" != "${file%""~""}" ]; then
    42                 continue
    43         fi
    44 
    45         if [ ! -f "${file}" ]; then
    46                 boot_mesg "${file} is not a network configuration file or directory." ${WARNING}
    47                 echo_warning
    48                 continue
    49         fi
    50         (
    51                 . ${file}
    52 
    53                 # Will not process this service if started by boot, and ONBOOT
    54                 # is not set to yes
    55                 if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
    56                         continue
    57                 fi
    58 
    59                 # Will not process this service if started by hotplug, and
    60                 # ONHOTPLUG is not set to yes
    61                 if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" ]; then
    62                         continue
    63                 fi
    64        
    65                 # This will run the service script, if SERVICE is set
    66                 if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then
    67                         if ip link show ${1} > /dev/null 2>&1
    68                         then
    69                                 IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} down
    70                         else
    71                                 boot_mesg "Interface ${1} doesn't exist." ${WARNING}
    72                                 echo_warning
    73                         fi
    74                 else
    75                         boot_mesg -n "Unable to process ${file}.  Either" ${FAILURE}
    76                         boot_mesg -n " the SERVICE variable was not set,"
    77                         boot_mesg " or the specified service cannot be executed."
    78                         echo_failure
    79                         continue
    80                 fi
    81         )
    82 done
    83 
    84 if [ -z "${2}" ]; then
    85         link_status=`ip link show $1 2>/dev/null`
    86         if [ -n "${link_status}" ]; then
    87                 if echo "${link_status}" | grep -q UP; then
    88                         boot_mesg "Bringing down the ${1} interface..."
    89                         ip link set ${1} down
    90                         evaluate_retval
    91                 fi
    92         fi
     34if [ "$IFACE" = "" ]; then
     35   boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE}
     36   echo_failure
     37   exit 1
    9338fi
    9439
    95 # End $network_devices/ifdown
     40# This will run the service script, if SERVICE is set
     41if [ -n "${SERVICE}" -a -x "/lib/boot/${SERVICE}" ]; then
     42   if ip link show ${IFACE} > /dev/null 2>&1; then
     43      IFCONFIG=${file} /lib/boot/${SERVICE} ${IFACE} down
     44   else
     45      boot_mesg "Interface ${1} doesn't exist." ${WARNING}
     46      echo_warning
     47   fi
     48else
     49   boot_mesg "Unable to process ${file}.  Either" ${FAILURE}
     50   boot_mesg "the SERVICE variable was not set"
     51   boot_mesg "or the specified service cannot be executed."
     52   echo_failure
     53   exit 1
     54fi
     55
     56link_status=`ip link show ${IFACE} 2>/dev/null`
     57
     58if [ -n "${link_status}" ]; then
     59   if echo "${link_status}" | grep -q UP; then
     60      boot_mesg "Bringing down the ${IFACE} interface..."
     61      ip link set ${IFACE} down
     62      evaluate_retval
     63   fi
     64fi
     65
     66# End /sbin/ifdown
  • bootscripts/lfs/sysconfig/network-devices/ifup

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $network_devices/ifup
     3# Begin /sbin/ifup
    44#
    55# Description : Interface Up
     
    77# Authors     : Nathan Coulson - nathan@linuxfromscratch.org
    88#               Kevin P. Fleming - kpfleming@linuxfromscratch.org
     9# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    910#
    10 # Version     : 00.00
     11# Version     : LFS 7.0
    1112#
    12 # Notes       : the IFCONFIG variable is passed to the scripts found
    13 #               in the services directory, to indicate what file the
     13# Notes       : The IFCONFIG variable is passed to the SERVICE script
     14#               in the /lib/boot directory, to indicate what file the
    1415#               service should source to get environmental variables.
    1516#
    1617########################################################################
    1718
    18 . /etc/sysconfig/rc
    19 . ${rc_functions}
     19file=/etc/sysconfig/ifconfig.${1}
    2020
    21 # Collect a list of configuration files for our interface
    22 if [ -n "${2}" ]; then
    23         for file in ${@#$1} # All parameters except $1
    24   do
    25                 FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
    26         done
    27 elif [ -d "${network_devices}/ifconfig.${1}" ]; then
    28         FILES=`echo ${network_devices}/ifconfig.${1}/*`
    29 else
    30         FILES="${network_devices}/ifconfig.${1}"
    31 fi
     21# Skip backup files
     22[ "${file}" = "${file%""~""}" ] || exit 0
     23
     24. /lib/boot/functions
    3225
    3326boot_mesg "Bringing up the ${1} interface..."
    3427boot_mesg_flush
    3528
    36 # Process each configruation file
    37 for file in ${FILES}; do
    38         # skip backup files
    39         if [ "${file}" != "${file%""~""}" ]; then
    40                 continue
    41         fi
     29if [ ! -r "${file}" ]; then
     30   boot_mesg "${file} is missing or cannot be accessed." ${WARNING}
     31   echo_warning
     32   exit 1
     33fi
    4234
    43         if [ ! -f "${file}" ]; then
    44                 boot_mesg "${file} is not a network configuration file or directory." ${WARNING}
    45                 echo_warning
    46                 continue
    47         fi
     35. $file
    4836
    49         (
    50                 . ${file}
     37if [ "$IFACE" = "" ]; then
     38   boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE}
     39   echo_failure
     40   exit 1
     41fi
    5142
    52                 # Will not process this service if started by boot, and ONBOOT
    53                 # is not set to yes
    54                 if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
    55                         continue
    56                 fi
    57                 # Will not process this service if started by hotplug, and
    58                 # ONHOTPLUG is not set to yes
    59                 if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" \
    60                     -a "${HOSTNAME}" != "(none)" ]; then continue
    61                 fi
     43# Do not process this service if started by boot, and ONBOOT
     44# is not set to yes
     45if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
     46   echo_skipped
     47   exit 0
     48fi
    6249
    63                 if [ -n "${SERVICE}" -a -x "${network_devices}/services/${SERVICE}" ]; then
    64                         if [ -z "${CHECK_LINK}" -o "${CHECK_LINK}" = "y" \
    65                             -o "${CHECK_LINK}" = "yes" -o "${CHECK_LINK}" = "1" ]; then
    66                                 if ip link show ${1} > /dev/null 2>&1; then
    67                                         link_status=`ip link show ${1}`
    68                                         if [ -n "${link_status}" ]; then
    69                                                 if ! echo "${link_status}" | grep -q UP; then
    70                                                         ip link set ${1} up
    71                                                 fi
    72                                         fi
    73                                 else
    74                                         boot_mesg "Interface ${1} doesn't exist." ${WARNING}
    75                                         echo_warning
    76                                         continue
    77                                 fi
    78                         fi
    79                         IFCONFIG=${file} ${network_devices}/services/${SERVICE} ${1} up
    80                 else
    81                         boot_mesg "Unable to process ${file}.  Either" ${FAILURE}
    82                         boot_mesg " the SERVICE variable was not set,"
    83                         boot_mesg " or the specified service cannot be executed."
    84                         echo_failure
    85                         continue
    86                 fi
    87         )
    88 done
     50if [ -n "${SERVICE}" -a -x "/lib/boot/${SERVICE}" ]; then
     51   if [ -z "${CHECK_LINK}"         -o \
     52           "${CHECK_LINK}" = "y"   -o \
     53           "${CHECK_LINK}" = "yes" -o \
     54           "${CHECK_LINK}" = "1" ]; then
    8955
    90 # End $network_devices/ifup
     56      #  Bring up the interface
     57      if ip link show ${IFACE} > /dev/null 2>&1; then
     58         link_status=`ip link show ${IFACE}`
     59
     60         if [ -n "${link_status}" ]; then
     61            if ! echo "${link_status}" | grep -q UP; then
     62               ip link set ${IFACE} up
     63            fi
     64         fi
     65
     66      else
     67         boot_mesg "Interface ${IFACE} doesn't exist." ${WARNING}
     68         echo_warning
     69      fi
     70   fi
     71
     72   IFCONFIG=${file} /lib/boot/${SERVICE} ${IFACE} up
     73
     74else
     75   boot_mesg "Unable to process ${file}.  Either" ${FAILURE}
     76   boot_mesg "the SERVICE variable was not set"
     77   boot_mesg "or the specified service cannot be executed."
     78   echo_failure
     79   exit 1
     80fi
     81
     82# End /sbin/ifup
  • bootscripts/lfs/sysconfig/network-devices/services/ipv4-static

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $network_devices/services/ipv4-static
     3# Begin /lib/boot/ipv4-static
    44#
    55# Description : IPV4 Static Boot Script
    66#
    77# Authors     : Nathan Coulson - nathan@linuxfromscratch.org
    8 #               Kevin P. Fleming - kpfleming@linuxfromscratch.org
     8#               Kevin P. Fleming - kpfleming@linuxfromscratch.org
     9# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    910#
    10 # Version     : 00.00
    11 #
    12 # Notes       :
     11# Version     : LFS 7.0
    1312#
    1413########################################################################
    1514
    16 . /etc/sysconfig/rc
    17 . ${rc_functions}
     15. /lib/boot/functions
    1816. ${IFCONFIG}
    1917
    2018if [ -z "${IP}" ]; then
    21         boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
    22         echo_failure
    23         exit 1
     19   boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
     20   echo_failure
     21   exit 1
    2422fi
    2523
    2624if [ -z "${PREFIX}" -a -z "${PEER}" ]; then
    27         boot_mesg -n "PREFIX variable missing from ${IFCONFIG}," ${WARNING}
    28         boot_mesg " assuming 24."
    29         echo_warning
    30         PREFIX=24
    31         args="${args} ${IP}/${PREFIX}"
     25   boot_mesg -n "PREFIX variable missing from ${IFCONFIG}," ${WARNING}
     26   boot_mesg " assuming 24."
     27   echo_warning
     28   PREFIX=24
     29   args="${args} ${IP}/${PREFIX}"
     30
    3231elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then
    33         boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE}
    34         echo_failure
    35         exit 1
     32   boot_mesg "PREFIX and PEER both specified in ${IFCONFIG}, cannot continue." ${FAILURE}
     33   echo_failure
     34   exit 1
     35
    3636elif [ -n "${PREFIX}" ]; then
    37         args="${args} ${IP}/${PREFIX}"
     37   args="${args} ${IP}/${PREFIX}"
     38
    3839elif [ -n "${PEER}" ]; then
    39         args="${args} ${IP} peer ${PEER}"
     40   args="${args} ${IP} peer ${PEER}"
    4041fi
    4142
    4243if [ -n "${BROADCAST}" ]; then
    43         args="${args} broadcast ${BROADCAST}"
     44   args="${args} broadcast ${BROADCAST}"
    4445fi
    4546
    4647case "${2}" in
    47         up)
    48                 boot_mesg "Adding IPv4 address ${IP} to the ${1} interface..."
    49                 ip addr add ${args} dev ${1}
    50                 evaluate_retval
    51        
    52                 if [ -n "${GATEWAY}" ]; then
    53                         if ip route | grep -q default; then
    54                                 boot_mesg "Gateway already setup; skipping." ${WARNING}
    55                                 echo_warning
    56                         else
    57                                 boot_mesg "Setting up default gateway..."
    58                                 ip route add default via ${GATEWAY} dev ${1}
    59                                 evaluate_retval
    60                         fi
    61                 fi
    62         ;;
    63        
    64         down)
    65                 if [ -n "${GATEWAY}" ]; then
    66                         boot_mesg "Removing default gateway..."
    67                         ip route del default
    68                         evaluate_retval
    69                 fi
    70        
    71                 boot_mesg "Removing IPv4 address ${IP} from the ${1} interface..."
    72                 ip addr del ${args} dev ${1}
    73                 evaluate_retval
    74         ;;
    75        
    76         *)
    77                 echo "Usage: ${0} [interface] {up|down}"
    78                 exit 1
    79         ;;
     48   up)
     49      boot_mesg "Adding IPv4 address ${IP} to the ${1} interface..."
     50      ip addr add ${args} dev ${1}
     51      evaluate_retval
     52
     53      if [ -n "${GATEWAY}" ]; then
     54         if ip route | grep -q default; then
     55            boot_mesg "Gateway already setup; skipping." ${WARNING}
     56            echo_warning
     57         else
     58            boot_mesg "Setting up default gateway..."
     59            ip route add default via ${GATEWAY} dev ${1}
     60            evaluate_retval
     61          fi
     62      fi
     63   ;;
     64
     65   down)
     66      if [ -n "${GATEWAY}" ]; then
     67         boot_mesg "Removing default gateway..."
     68         ip route del default
     69         evaluate_retval
     70      fi
     71
     72      boot_mesg "Removing IPv4 address ${IP} from the ${1} interface..."
     73      ip addr del ${args} dev ${1}
     74      evaluate_retval
     75   ;;
     76
     77   *)
     78      echo "Usage: ${0} [interface] {up|down}"
     79      exit 1
     80   ;;
    8081esac
    8182
    82 # End $network_devices/services/ipv4-static
     83# End /lib/boot/ipv4-static
  • bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $network_devices/services/ipv4-static-route
     3# Begin /lib/boot/ipv4-static-route
    44#
    55# Description : IPV4 Static Route Script
    66#
    77# Authors     : Kevin P. Fleming - kpfleming@linuxfromscratch.org
     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. /lib/boot/functions
    1715. ${IFCONFIG}
    1816
    1917case "${TYPE}" in
    20         ("" | "network")
    21                 need_ip=1
    22                 need_gateway=1
    23         ;;
     18   ("" | "network")
     19      need_ip=1
     20      need_gateway=1
     21   ;;
    2422
    25         ("default")
    26                 need_gateway=1
    27                 args="${args} default"
    28                 desc="default"
    29         ;;
     23   ("default")
     24      need_gateway=1
     25      args="${args} default"
     26      desc="default"
     27   ;;
    3028
    31         ("host")
    32                 need_ip=1
    33         ;;
     29   ("host")
     30      need_ip=1
     31   ;;
    3432
    35         ("unreachable")
    36                 need_ip=1
    37                 args="${args} unreachable"
    38                 desc="unreachable "
    39         ;;
     33   ("unreachable")
     34      need_ip=1
     35      args="${args} unreachable"
     36      desc="unreachable "
     37   ;;
    4038
    41         (*)
    42                 boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
    43                 echo_failure
    44                 exit 1
    45         ;;
     39   (*)
     40      boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
     41      echo_failure
     42      exit 1
     43   ;;
    4644esac
    4745
    4846if [ -n "${need_ip}" ]; then
    49         if [ -z "${IP}" ]; then
    50                 boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
    51                 echo_failure
    52                 exit 1
    53         fi
     47   if [ -z "${IP}" ]; then
     48      boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
     49      echo_failure
     50      exit 1
     51   fi
    5452
    55         if [ -z "${PREFIX}" ]; then
    56                 boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
    57                 echo_failure
    58                 exit 1
    59         fi
    60        
    61         args="${args} ${IP}/${PREFIX}"
    62         desc="${desc}${IP}/${PREFIX}"
     53   if [ -z "${PREFIX}" ]; then
     54      boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
     55      echo_failure
     56      exit 1
     57   fi
     58   
     59   args="${args} ${IP}/${PREFIX}"
     60   desc="${desc}${IP}/${PREFIX}"
    6361fi
    6462
    6563if [ -n "${need_gateway}" ]; then
    66         if [ -z "${GATEWAY}" ]; then
    67                 boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
    68                 echo_failure
    69                 exit 1
    70         fi
    71         args="${args} via ${GATEWAY}"
     64   if [ -z "${GATEWAY}" ]; then
     65      boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
     66      echo_failure
     67      exit 1
     68   fi
     69   args="${args} via ${GATEWAY}"
    7270fi
    7371
     
    7775
    7876case "${2}" in
    79         up)
    80                 boot_mesg "Adding '${desc}' route to the ${1} interface..."
    81                 ip route add ${args} dev ${1}
    82                 evaluate_retval
    83         ;;
    84        
    85         down)
    86                 boot_mesg "Removing '${desc}' route from the ${1} interface..."
    87                 ip route del ${args} dev ${1}
    88                 evaluate_retval
    89         ;;
    90        
    91         *)
    92                 echo "Usage: ${0} [interface] {up|down}"
    93                 exit 1
    94         ;;
     77   up)
     78      boot_mesg "Adding '${desc}' route to the ${1} interface..."
     79      ip route add ${args} dev ${1}
     80      evaluate_retval
     81   ;;
     82   
     83   down)
     84      boot_mesg "Removing '${desc}' route from the ${1} interface..."
     85      ip route del ${args} dev ${1}
     86      evaluate_retval
     87   ;;
     88   
     89   *)
     90      echo "Usage: ${0} [interface] {up|down}"
     91      exit 1
     92   ;;
    9593esac
    9694
    97 # End $network_devices/services/ipv4-static-route
     95# End /bib/boot/ipv4-static-route
  • chapter01/changelog.xml

    r75fe599 r0cda898  
    3838-->
    3939    <listitem>
     40      <para>2011-08-01</para>
     41      <itemizedlist>
     42        <listitem>
     43          <para>[bdubbs] - Rewrite bootscripts and Chaper 7.</para>
     44          <itemizedlist>
     45             <listitem><para>Make scripts compatible with initd format (see BLFS).</para></listitem>
     46             <listitem><para>Move functions and services to /lib/boot.</para></listitem>
     47             <listitem><para>Log boot messages to /run/var/bootlog.</para></listitem>
     48             <listitem><para>Move ifup/ifdown to /sbin.</para></listitem>
     49             <listitem><para>Move network device configuration files to
     50                             /etc/sysconfig/ifconfig.*.</para></listitem>
     51             <listitem><para>Add IFACE variable to network configuration files.
     52                             </para></listitem>
     53             <listitem><para>Read optional configuration file /etc/sysconfig/init_params
     54                             in functions.</para></listitem>
     55          </itemizedlist>
     56        </listitem>
     57      </itemizedlist>
     58    </listitem>
     59
     60    <listitem>
    4061      <para>2011-07-17</para>
    4162      <itemizedlist>
  • chapter06/sysvinit.xml

    r75fe599 r0cda898  
    7575  </sect2>
    7676
    77   <sect2 id="conf-sysvinit" role="configuration">
    78     <title>Configuring Sysvinit</title>
    79 
    80     <indexterm zone="conf-sysvinit">
    81       <primary sortas="a-Sysvinit">Sysvinit</primary>
    82       <secondary>configuring</secondary>
    83     </indexterm>
    84 
    85     <indexterm zone="conf-sysvinit">
    86       <primary sortas="e-/etc/inittab">/etc/inittab</primary>
    87     </indexterm>
    88 
    89     <para>Create a new file <filename>/etc/inittab</filename> by running the
    90     following:</para>
    91 
    92 <screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
    93 <literal># Begin /etc/inittab
    94 
    95 id:3:initdefault:
    96 
    97 si::sysinit:/etc/rc.d/init.d/rc sysinit
    98 
    99 l0:0:wait:/etc/rc.d/init.d/rc 0
    100 l1:S1:wait:/etc/rc.d/init.d/rc 1
    101 l2:2:wait:/etc/rc.d/init.d/rc 2
    102 l3:3:wait:/etc/rc.d/init.d/rc 3
    103 l4:4:wait:/etc/rc.d/init.d/rc 4
    104 l5:5:wait:/etc/rc.d/init.d/rc 5
    105 l6:6:wait:/etc/rc.d/init.d/rc 6
    106 
    107 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
    108 
    109 su:S016:once:/sbin/sulogin
    110 
    111 1:2345:respawn:/sbin/agetty tty1 9600
    112 2:2345:respawn:/sbin/agetty tty2 9600
    113 3:2345:respawn:/sbin/agetty tty3 9600
    114 4:2345:respawn:/sbin/agetty tty4 9600
    115 5:2345:respawn:/sbin/agetty tty5 9600
    116 6:2345:respawn:/sbin/agetty tty6 9600
    117 
    118 # End /etc/inittab</literal>
    119 EOF</userinput></screen>
    120 
    121   </sect2>
    122 
    12377  <sect2 id="contents-sysvinit" role="content">
    12478    <title>Contents of Sysvinit</title>
  • chapter07/bootscripts.xml

    r75fe599 r0cda898  
    5050  <sect2 id="contents-bootscripts" role="content">
    5151    <title>Contents of LFS-Bootscripts</title>
    52 
    5352    <segmentedlist>
    5453      <segtitle>Installed scripts</segtitle>
     
    6059        sendsignals, setclock, static, swap, sysctl, sysklogd, template,
    6160        udev, and udev_retry</seg>
    62         <seg>/etc/rc.d, /etc/sysconfig</seg>
     61        <seg>/etc/rc.d, /etc/sysconfig, /lib/boot</seg>
    6362      </seglistitem>
    6463    </segmentedlist>
     
    141140        <term><command>ifdown</command></term>
    142141        <listitem>
    143           <para>Assists the network script with stopping network devices</para>
     142          <para>Stops a network device</para>
    144143          <indexterm zone="ch-scripts-bootscripts ifdown-bootscripts">
    145144            <primary sortas="d-ifdown">ifdown</primary>
     
    151150        <term><command>ifup</command></term>
    152151        <listitem>
    153           <para>Assists the network script with starting network devices</para>
     152          <para>Initializes a network device</para>
    154153          <indexterm zone="ch-scripts-bootscripts ifup-bootscripts">
    155154            <primary sortas="d-ifup">ifup</primary>
     
    326325        <listitem>
    327326          <para>Retries failed udev uevents, and copies generated rules
    328           files from <filename class="directory">/dev/.udev</filename> to
     327          files from to
    329328          <filename class="directory">/etc/udev/rules.d</filename> if required</para>
    330329          <indexterm zone="ch-scripts-bootscripts udev-retry-bootscripts">
  • chapter07/chapter07.xml

    r75fe599 r0cda898  
    1313
    1414  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
     15  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
     16  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hosts.xml"/>
     17  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
     18  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
    1519  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
    1620  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
     21  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostname.xml"/>
    1722  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/>
    1823  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/>
    1924  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/>
     25  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>
    2026  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>
    21   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>
    22   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
    23   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
    24   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostname.xml"/>
    25   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hosts.xml"/>
    26   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
    2727
    2828</chapter>
  • chapter07/hostname.xml

    r75fe599 r0cda898  
    99  <?dbhtml filename="hostname.html"?>
    1010
    11   <title>Configuring the localnet Script</title>
     11  <title>Configuring the system hostname</title>
    1212
    1313  <indexterm zone="ch-scripts-hostname">
    14     <primary sortas="d-localnet">localnet</primary>
     14    <primary sortas="d-hostname">hostname</primary>
    1515    <secondary>configuring</secondary>
    1616  </indexterm>
     
    2727  <para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the name given
    2828  to the computer. Do not enter the Fully Qualified Domain Name (FQDN) here. That
    29   information will be put in the <filename>/etc/hosts</filename> file in the next
    30   section.</para>
     29  information is put in the <filename>/etc/hosts</filename> file.</para>
    3130
    3231</sect1>
  • chapter07/hosts.xml

    r75fe599 r0cda898  
    6262  <para>The <replaceable>&lt;192.168.1.1&gt;</replaceable> and
    6363  <replaceable>&lt;HOSTNAME.example.org&gt;</replaceable>
    64   values need to be changed for specific users or requirements (if
     64  values need to be changed for specific uses or requirements (if
    6565  assigned an IP address by a network/system administrator and the
    6666  machine will be connected to an existing network). The optional alias
  • chapter07/introduction.xml

    r75fe599 r0cda898  
    1111  <title>Introduction</title>
    1212
    13   <para>This chapter details how to install and configure the LFS-Bootscripts
    14   package. Most of these scripts will work without modification, but a few require
    15   additional configuration files because they deal with hardware-dependent
    16   information.</para>
     13  <para>This chapter discusses configuration files and boot scripts. 
     14  First, the general configuration files needed to set up networking are
     15  presented.</para>
     16 
     17  <itemizedlist>
     18     <listitem>
     19       <para><xref linkend="ch-scripts-network" role="."/></para>
     20     </listitem>
     21     <listitem>
     22       <para><xref linkend="ch-scripts-hosts" role="."/></para>
     23     </listitem>
     24  </itemizedlist>
     25 
     26  <para>Second, issues that affect the proper setup of devices diescussed.</para>
    1727
     28  <itemizedlist>
     29     <listitem>
     30       <para><xref linkend="ch-scripts-udev" role="."/></para>
     31     </listitem>
     32     <listitem>
     33       <para><xref linkend="ch-scripts-symlinks" role="."/></para>
     34     </listitem>
     35  </itemizedlist>
     36
     37  <para>The next sections detail how to install and configure the LFS system
     38  scripts needed during the boot process. Most of these scripts will work
     39  without modification, but a few require additional configuration files
     40  because they deal with hardware-dependent information.</para>
     41 
    1842  <para>System-V style init scripts are employed in this book because they are
    19   widely used. For additional options, a hint detailing the BSD style init setup
    20   is available at <ulink url="&hints-root;bsd-init.txt"/>.
    21   Searching the LFS mailing lists for <quote>depinit</quote> will also offer
    22   additional choices.</para>
     43  widely used and relatively simple. For additional options, a hint detailing
     44  the BSD style init setup is available at <ulink
     45  url="&hints-root;bsd-init.txt"/>.  Searching the LFS mailing lists for
     46  <quote>depinit</quote>, <quote>upstart</quote>, or <quote>systemd</quote>
     47  will also offer additional information.</para>
     48 
     49  <para>If using an alternative style of init scripts, skip these sections.</para>
    2350
    24   <para>If using an alternative style of init scripts, skip this chapter
    25   and move on to <xref linkend="chapter-bootable"/>.</para>
     51  <para>A listing of the boot scripts are found in <xref linkend="scripts"
     52  role="."/>.</para>
     53
     54
     55  <itemizedlist>
     56     <listitem>
     57       <para><xref linkend="ch-scripts-bootscripts" role="."/></para>
     58     </listitem>
     59     <listitem>
     60       <para><xref linkend="ch-scripts-usage" role="."/></para>
     61     </listitem>
     62     <listitem>
     63       <para><xref linkend="ch-scripts-hostname" role="."/></para>
     64     </listitem>
     65     <listitem>
     66       <para><xref linkend="ch-scripts-setclock" role="."/></para>
     67     </listitem>
     68     <listitem>
     69       <para><xref linkend="ch-scripts-console" role="."/></para>
     70     </listitem>
     71     <listitem>
     72       <para><xref linkend="ch-scripts-sysklogd" role="."/></para>
     73     </listitem>
     74  </itemizedlist>
     75 
     76 
     77  <para>Finally, there is a brief introduction to the scripts and configuration
     78  files used when the user logs into the system.</para>
     79
     80  <itemizedlist>
     81     <listitem>
     82       <para><xref linkend="ch-scripts-profile" role="."/></para>
     83     </listitem>
     84     <listitem>
     85       <para><xref linkend="ch-scripts-inputrc" role="."/></para>
     86     </listitem>
     87  </itemizedlist>
     88
    2689
    2790</sect1>
  • chapter07/network.xml

    r75fe599 r0cda898  
    99  <?dbhtml filename="network.html"?>
    1010
    11   <title>Configuring the network Script</title>
     11  <title>General Network Configuration</title>
    1212
    1313  <indexterm zone="ch-scripts-network">
     
    2626  <sect2>
    2727    <title>Creating stable names for network interfaces</title>
     28
     29    <para>If there is only one network interface in the system to be
     30    configured, this section is optional, although it will never be wrong to do
     31    it.  In many cases (e.g. a laptop with a wireless and a wired interface),
     32    accomplishing the configuration in this section is necessary.</para> 
    2833
    2934    <para>With Udev and modular network drivers, the network interface numbering
     
    113118
    114119    <para>Which interfaces are brought up and down by the network script
    115     depends on the files and directories in the <filename
    116     class="directory">/etc/sysconfig/network-devices</filename> hierarchy.
    117     This directory should contain a sub-directory for each interface to be
    118     configured, such as <filename>ifconfig.xyz</filename>, where
    119     <quote>xyz</quote> is a network interface name. Inside this directory
    120     would be files defining the attributes to this interface, such as its IP
    121     address(es), subnet masks, and so forth.</para>
    122 
    123     <para>The following command creates a sample <filename>ipv4</filename>
    124     file for the <emphasis>eth0</emphasis> device:</para>
    125 
    126 <screen><userinput>cd /etc/sysconfig/network-devices
    127 mkdir -v ifconfig.eth0
    128 cat &gt; ifconfig.eth0/ipv4 &lt;&lt; "EOF"
     120    depends on the files in <filename
     121    class="directory">/etc/sysconfig/</filename>.  This directory should
     122    contain a file for each interface to be configured, such as
     123    <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is is
     124    meaningful to the administrator such as the device name (e.g. eth0).
     125    Inside this file are attributes to this interface, such as its IP
     126    address(es), subnet masks, and so forth.  It is necessary that
     127    the stem of the filename be <emphasis>ifconfig</emphasis>.</para>
     128
     129    <para>The following command creates a sample file for the
     130    <emphasis>eth0</emphasis> device with a static IP address:</para>
     131
     132<screen><userinput>cd /etc/sysconfig/
     133cat &gt; ifconfig.eth0 &lt;&lt; "EOF"
    129134<literal>ONBOOT=yes
     135IFACE=eth0
    130136SERVICE=ipv4-static
    131137IP=192.168.1.1
     
    136142
    137143    <para>The values of these variables must be changed in every file to match
    138     the proper setup. If the <envar>ONBOOT</envar> variable is set to
    139     <quote>yes</quote> the network script will bring up the Network Interface
    140     Card (NIC) during booting of the system. If set to anything but
    141     <quote>yes</quote> the NIC will be ignored by the network script and not
    142     be brought up.</para>
     144    the proper setup.</para>
     145
     146    <para>If the <envar>ONBOOT</envar> variable is set to <quote>yes</quote> the
     147    network script will bring up the Network Interface Card (NIC) during
     148    booting of the system. If set to anything but <quote>yes</quote> the NIC
     149    will be ignored by the network script and not be automatically brought up.
     150    The interface can be manually started or stopped with the
     151    <command>ifup</command> and <command>ifdown</command> commands.</para>
     152
     153    <para>The <envar>IFACE</envar> variable defines the interface name,
     154    for example, eth0.  It is required for all network device configuration
     155    files. </para>
    143156
    144157    <para>The <envar>SERVICE</envar> variable defines the method used for
    145158    obtaining the IP address. The LFS-Bootscripts package has a modular IP
    146159    assignment format, and creating additional files in the <filename
    147     class="directory">/etc/sysconfig/network-devices/services</filename>
    148     directory allows other IP assignment methods. This is commonly used for
    149     Dynamic Host Configuration Protocol (DHCP), which is addressed in the
    150     BLFS book.</para>
     160    class="directory">/lib/boot/</filename> directory allows other IP
     161    assignment methods. This is commonly used for Dynamic Host Configuration
     162    Protocol (DHCP), which is addressed in the BLFS book.</para>
    151163
    152164    <para>The <envar>GATEWAY</envar> variable should contain the default
     
    190202EOF</userinput></screen>
    191203
     204    <para>The <varname>domain</varname> statement can be omitted
     205    or replaced with a <varname>search</varname> statement.  See the man page for
     206    resolv.conf for more details.</para>
     207
    192208    <para>Replace <replaceable>&lt;IP address of the nameserver&gt;</replaceable>
    193209    with the IP address of the DNS most appropriate for the setup. There will
     
    197213    may also be a router on the local network.</para>
    198214
     215    <note><para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para></note>
     216
    199217  </sect2>
    200218
  • chapter07/setclock.xml

    r75fe599 r0cda898  
    6363  time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
    6464
     65  <note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set
     66  in the <filename>/etc/sysconfig/init_params</filename> file.</para></note>
     67
    6568</sect1>
  • chapter07/sysklogd.xml

    r75fe599 r0cda898  
    1717
    1818  <para>The <filename>sysklogd</filename> script invokes the
    19   <command>syslogd</command> program with the <parameter>-m 0</parameter> option.
    20   This option turns off the periodic timestamp mark that
    21   <command>syslogd</command> writes to the log files every 20 minutes by default.
    22   If you want to turn on this periodic timestamp mark, edit the
    23   <filename>sysklogd</filename> script and make the changes accordingly. See
    24   <userinput>man syslogd</userinput> for more information.</para>
     19  <command>syslogd</command> program with the <parameter>-m 0</parameter>
     20  option.  This option turns off the periodic timestamp mark that
     21  <command>syslogd</command> writes to the log files every 20 minutes by
     22  default.  If you want to turn on this periodic timestamp mark, create or edit
     23  <filename>/etc/sysconfig/init_params</filename> and define the variable
     24  SYSKLOGD_PARMS to the desired value.  For instance, to remove all parameters,
     25  set the variable to a null value:</para>
     26
     27<screen role="nodump">SYSKLOGD_PARMS=</screen>
     28
     29  <para>See <userinput>man syslogd</userinput> for more options.</para>
    2530
    2631</sect1>
  • chapter07/udev.xml

    r75fe599 r0cda898  
    9696      <title>Udev Bootscript</title>
    9797
    98       <para>The <command>S10udev</command> initscript takes care of creating
     98      <para>The <command>/etc/rc.d/init.d/udev</command> initscript takes care of creating
    9999      device nodes when Linux is booted. The script unsets the uevent handler
    100100      from the default of <command>/sbin/hotplug</command>.  This is done
     
    201201      arrange module loading by other means. With Linux-&linux-version;, Udev is
    202202      known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI,
    203       SERIO and FireWire devices.</para>
     203      SERIO, and FireWire devices.</para>
    204204
    205205      <para>To determine if the device driver you require has the necessary
     
    244244
    245245      <para>If the module in question is not a wrapper and is useful by itself,
    246       configure the <command>S05modules</command> bootscript to load this
     246      configure the <command>modules</command> bootscript to load this
    247247      module on system boot. To do this, add the module name to the
    248248      <filename>/etc/sysconfig/modules</filename> file on a separate line.
     
    307307      vendor). The static device node will be copied to
    308308      <filename class="directory">/dev</filename> by the
    309       <command>S10udev</command> bootscript.</para>
     309      <command>udev</command> bootscript.</para>
    310310
    311311    </sect3>
  • chapter07/usage.xml

    r75fe599 r0cda898  
    38386: reboot the computer</literallayout>
    3939
    40   <para>The command used to change run-levels is <command>init
     40  <sect2 id="conf-sysvinit" role="configuration">
     41  <title>Configuring Sysvinit</title>
     42
     43  <indexterm zone="conf-sysvinit">
     44    <primary sortas="a-Sysvinit">Sysvinit</primary>
     45    <secondary>configuring</secondary>
     46  </indexterm>
     47
     48  <indexterm zone="conf-sysvinit">
     49    <primary sortas="e-/etc/inittab">/etc/inittab</primary>
     50  </indexterm>
     51
     52  <para>During the kernel initialization, the first program that is run
     53  is either specified on the command line or, by default
     54  <command>init</command>.  This program reads the initialization file
     55  <filename>/etc/inittab</filename>.  Create this file with:</para>
     56
     57<screen><userinput>cat &gt; /etc/inittab &lt;&lt; "EOF"
     58<literal># Begin /etc/inittab
     59
     60id:3:initdefault:
     61
     62si::sysinit:/etc/rc.d/init.d/rc sysinit
     63
     64l0:0:wait:/etc/rc.d/init.d/rc 0
     65l1:S1:wait:/etc/rc.d/init.d/rc 1
     66l2:2:wait:/etc/rc.d/init.d/rc 2
     67l3:3:wait:/etc/rc.d/init.d/rc 3
     68l4:4:wait:/etc/rc.d/init.d/rc 4
     69l5:5:wait:/etc/rc.d/init.d/rc 5
     70l6:6:wait:/etc/rc.d/init.d/rc 6
     71
     72ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
     73
     74su:S016:once:/sbin/sulogin
     75
     761:2345:respawn:/sbin/agetty tty1 9600
     772:2345:respawn:/sbin/agetty tty2 9600
     783:2345:respawn:/sbin/agetty tty3 9600
     794:2345:respawn:/sbin/agetty tty4 9600
     805:2345:respawn:/sbin/agetty tty5 9600
     816:2345:respawn:/sbin/agetty tty6 9600
     82
     83# End /etc/inittab</literal>
     84EOF</userinput></screen>
     85
     86  <para>An explanation of this initialization file is in the man page for
     87  <emphasis>inittab</emphasis>.  For LFS, the key command that is run is
     88  <command>rc</command>. The intialization file above will instruct
     89  <command>rc</command> to run all the scripts starting with an S in the
     90  <filename class="directory">/etc/rc.d/rcsysinit.d</filename> directory
     91  followed by all the scripts starting with an S in the <filename
     92  class="directory">/etc/rc.d/rc?.d</filename> directory where the question
     93  mark is specified by the initdefault value.</para>
     94
     95  <para>As a convenience, the <command>rc</command> script reads a library of
     96  functions in <filename class="directory">/lib/boot/functions</filename>.
     97  This library also reads an optional configuration file,
     98  <filename>/etc/sysconfig/init_params</filename>.  Any of the system
     99  configuration file parameters described in subsequent sections can be
     100  alternatively placed in this file allowing consolidation of all system
     101  parameters in thsi one file.</para>
     102
     103  <para>As a debugging convenience, the functions script also logs all output
     104  to <filename>/run/var/bootlog</filename>.  Since the <filename
     105  class="directory">/run</filename> directory is a tmpfs, this file is not
     106  persistent across boots.</para>
     107
     108  </sect2>
     109
     110  <sect2 id="init-levels" >
     111  <title>Changing Run Levels</title>
     112
     113  <para>Changing run-levels is done with <command>init
    41114  <replaceable>&lt;runlevel&gt;</replaceable></command>, where
    42115  <replaceable>&lt;runlevel&gt;</replaceable> is the target run-level. For example, to
     
    60133  <para>The real scripts are in <filename
    61134  class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and
    62   the symlinks all point to them. Killing links and starting links point to
     135  the symlinks all point to them. K links and S links point to
    63136  the same script in <filename class="directory">/etc/rc.d/init.d</filename>.
    64137  This is because the scripts can be called with different parameters like
     
    127200  it can be done.</para>
    128201
     202  </sect2>
     203
    129204</sect1>
  • general.ent

    r75fe599 r0cda898  
    1 <!ENTITY version "SVN-20110717">
    2 <!ENTITY releasedate "July 17, 2011">
     1<!ENTITY version "SVN-20110801">
     2<!ENTITY releasedate "Aug 1, 2011">
    33<!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not &ndash; -->
    4 <!ENTITY milestone "6.9">
     4<!ENTITY milestone "7.0">
    55<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->
    66
  • packages.ent

    r75fe599 r0cda898  
    298298<!ENTITY less-ch6-sbu "less than 0.1 SBU">
    299299
    300 <!ENTITY lfs-bootscripts-version "20110531">                 <!-- Scripts depend on this format -->
     300<!ENTITY lfs-bootscripts-version "20110801">                 <!-- Scripts depend on this format -->
    301301<!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB">         <!-- Updated in Makefile -->
    302302<!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2">
  • prologue/standards.xml

    r75fe599 r0cda898  
    112112        <term><emphasis>LSB Core:</emphasis></term>
    113113        <listitem>
    114           <para>Bc, Cpio, Ed, Fcrontab, PAM, Sendmail (or Postfix or Exim)
    115           </para>
     114          <para>Bc, Cpio, Ed, Fcrontab, Initd-tools, PAM,
     115          Sendmail (or Postfix or Exim) </para>
    116116        </listitem>
    117117      </varlistentry>
     
    165165        <term><emphasis>LSB Core:</emphasis></term>
    166166        <listitem>
    167           <para>At, Batch, Install_initd, Lsb_release, Remove_initd, Test
     167          <para>At, Batch, Lsb_release
    168168          </para>
    169169        </listitem>
Note: See TracChangeset for help on using the changeset viewer.