Changeset 0cda898
- Timestamp:
- 08/02/2011 02:15:42 AM (13 years ago)
- 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
- Files:
-
- 4 deleted
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
bootscripts/ChangeLog
r75fe599 r0cda898 1 2011-05-31 DJ Lucas <dj@linuxfromscratch.org> 1 2011-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 17 2011-05-31 DJ Lucas <dj@linuxfromscratch.org> 2 18 * lfs/init.d/udev: Add multiple udev triggers for both subsystems and 3 19 devices per upstream recommendation. 4 20 5 2011-04-19 21 2011-04-19 Bruce Dubbs <bdubbs@linuxfromscratch.org> 6 22 * lfs/init.d/mountvirtfs: Add creation of /run/{var,lock,shm}. 7 23 * lfs/init.d/udev: Add /dev/shm -> /run/shm symlink. 8 24 9 2011-04-18 25 2011-04-18 Bruce Dubbs <bdubbs@linuxfromscratch.org> 10 26 * lfs/init.d/mountvirtfs: Change name from mountkernfs to mountvirtfs. 11 27 Add mounting of /run filesystem. 12 28 13 2010-05-29 29 2010-05-29 Matt Burgess <matthew@linuxfromscratch.org> 14 30 * lfs/init.d/udev: Only copy /lib/udev/devices/null, as Udev >= 155 copies 15 31 devices from /lib/udev/devices to /dev itself. Udevd still needs /dev/null 16 32 present before starting up though. 17 33 18 2010-04-20 34 2010-04-20 Bryan Kadzban <bryan@linuxfromscratch.org> 19 35 * lfs/init.d/udev, lfs/init.d/udev_retry: Add --action=add, to handle udev 20 36 version 152 and newer, which send "change" events by default in udevtrigger -
bootscripts/Makefile
r75fe599 r0cda898 1 1 ETCDIR=/etc 2 2 EXTDIR=${DESTDIR}${ETCDIR} 3 LIBDIR=${DESTDIR}/lib/boot 3 4 MODE=754 4 5 DIRMODE=755 … … 18 19 install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d 19 20 install -d -m ${DIRMODE} ${EXTDIR}/sysconfig 21 install -d -m ${DIRMODE} ${LIBDIR} 20 22 21 create-service-dir: 22 install -d -m ${DIRMODE} ${EXTDIR}/sysconfig/network-devices/services 23 24 install: create-dirs create-service-dir 23 install: create-dirs 25 24 install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/ 26 25 install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/ 27 26 install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/ 27 install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR} 28 28 install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ 29 29 install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/ … … 38 38 install -m ${MODE} lfs/init.d/sendsignals ${EXTDIR}/rc.d/init.d/ 39 39 install -m ${MODE} lfs/init.d/setclock ${EXTDIR}/rc.d/init.d/ 40 install -m ${MODE} lfs/init.d/sysklogd 40 install -m ${MODE} lfs/init.d/sysklogd ${EXTDIR}/rc.d/init.d/ 41 41 install -m ${MODE} lfs/init.d/swap ${EXTDIR}/rc.d/init.d/ 42 42 install -m ${MODE} lfs/init.d/sysctl ${EXTDIR}/rc.d/init.d/ … … 45 45 install -m ${MODE} lfs/init.d/udev_retry ${EXTDIR}/rc.d/init.d/ 46 46 ln -sf ../init.d/network ${EXTDIR}/rc.d/rc0.d/K80network 47 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc0.d/K90sysklogd47 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc0.d/K90sysklogd 48 48 ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals 49 49 ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc0.d/S70mountfs … … 52 52 ln -sf ../init.d/halt ${EXTDIR}/rc.d/rc0.d/S99halt 53 53 ln -sf ../init.d/network ${EXTDIR}/rc.d/rc1.d/K80network 54 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc1.d/K90sysklogd54 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc1.d/K90sysklogd 55 55 ln -sf ../init.d/network ${EXTDIR}/rc.d/rc2.d/K80network 56 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc2.d/K90sysklogd57 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc3.d/S10sysklogd56 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc2.d/K90sysklogd 57 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc3.d/S10sysklogd 58 58 ln -sf ../init.d/network ${EXTDIR}/rc.d/rc3.d/S20network 59 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc4.d/S10sysklogd59 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc4.d/S10sysklogd 60 60 ln -sf ../init.d/network ${EXTDIR}/rc.d/rc4.d/S20network 61 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc5.d/S10sysklogd61 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc5.d/S10sysklogd 62 62 ln -sf ../init.d/network ${EXTDIR}/rc.d/rc5.d/S20network 63 63 ln -sf ../init.d/network ${EXTDIR}/rc.d/rc6.d/K80network 64 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc6.d/K90sysklogd64 ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc6.d/K90sysklogd 65 65 ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc6.d/S60sendsignals 66 66 ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc6.d/S70mountfs … … 80 80 ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rcsysinit.d/S80localnet 81 81 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} 89 95 90 96 install-consolelog: create-dirs … … 92 98 ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcsysinit.d/S00consolelog 93 99 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 100 minimal: create-dirs 101 101 install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/ 102 102 install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/ 103 103 install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/ 104 install -m ${CONFMODE} lfs/init.d/functions ${LIBDIR} 104 105 install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ 105 106 install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/ … … 126 127 ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rcsysinit.d/S40mountfs 127 128 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 129 132 130 .PHONY: all create-dirs create-service-dir \ 131 install install-service-mtu 133 .PHONY: all create-dirs install 132 134 -
bootscripts/README
r75fe599 r0cda898 1 1 Network Configuration: 2 3 4 sysconfig/network-devices/ifup5 sysconfig/network-devices/ifdown6 sysconfig/network-devices/services/*2 Script Files: 3 /etc/rc.d/init.d/network 4 /sbin/ifup 5 /sbin/ifdown 6 /lib/boot/*/* 7 7 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 19 20 20 21 21 /etc/sysconfig/network 22 - HOSTNAME: Value of the system's hostname 22 23 23 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 32 33 34 35 36 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) 37 38 38 39 39 40 SetClock 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 42 44 43 44 45 46 47 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 48 50 49 51 CleanFS configuration: 50 51 52 Script Files: 53 /etc/rc.d/init.d/cleanfs 52 54 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 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/checkfs3 # Begin checkfs 4 4 # 5 5 # Description : File System Check … … 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 8 # A. Luebke - luebke@users.sourceforge.net 9 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 9 10 # 10 # Version : 00.00 11 # 12 # Notes : 11 # Version : LFS 7.0 13 12 # 14 13 # Based on checkfs script from LFS-3.1 and earlier. … … 26 25 ######################################################################### 27 26 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 30 41 31 42 case "${1}" in 32 33 34 35 36 37 38 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 39 50 40 41 42 51 boot_mesg "Mounting root file system in read-only mode..." 52 mount -n -o remount,ro / >/dev/null 53 evaluate_retval 43 54 44 45 46 47 48 49 50 51 52 53 read ENTER 54 ${rc_base}/init.d/halt stop55 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 56 67 57 58 59 60 61 62 63 64 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 65 76 66 67 68 69 70 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=${?} 71 82 72 73 74 83 if [ "${error_value}" = 0 ]; then 84 echo_ok 85 fi 75 86 76 77 78 79 boot_mesg -n " were found and have been corrected."80 boot_mesg -n "You may want to double-check that"81 82 83 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 84 95 85 86 87 88 89 90 91 92 93 94 95 read ENTER 96 97 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 98 109 99 100 101 102 103 104 105 106 107 108 109 110 111 112 read ENTER 113 ${rc_base}/init.d/halt stop114 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 115 126 116 117 118 119 120 121 122 123 124 125 126 127 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 ;; 129 140 esac 130 141 131 # End $rc_base/init.d/checkfs142 # End checkfs -
bootscripts/lfs/init.d/cleanfs
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/cleanfs3 # Begin cleanfs 4 4 # 5 5 # Description : Clean file system 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 30 18 31 # Function to create files/directory on boot. … … 22 35 while read name type perm usr grp dtype maj min junk 23 36 do 24 25 37 # Ignore comments and blank lines. 26 38 case "${name}" in … … 74 86 boot_mesg -n "Cleaning file systems:" ${INFO} 75 87 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 80 93 81 94 > /var/run/utmp … … 101 114 esac 102 115 103 # End $rc_base/init.d/cleanfs116 # End cleanfs -
bootscripts/lfs/init.d/console
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/console3 # Begin console 4 4 # 5 5 # Description : Sets keymap and screen font 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Alexander E. Patrakov 8 # Alexander E. Patrakov 9 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 9 10 # 10 # Version : 00.03 11 # 12 # Notes : 11 # Version : LFS 7.0 13 12 # 14 13 ######################################################################## 15 14 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 18 30 19 31 # Native English speakers probably don't have /etc/sysconfig/console at all 20 if [ -f /etc/sysconfig/console ] 21 then 22 . /etc/sysconfig/console 32 if [ -r /etc/sysconfig/console ]; then 33 . /etc/sysconfig/console 23 34 else 24 35 exit 0 25 36 fi 26 37 27 38 is_true() { 28 39 [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] 29 40 } 30 41 … … 32 43 33 44 case "${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! 52 48 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 67 51 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" 78 57 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. 84 60 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 ;; 94 105 esac 95 106 96 # End $rc_base/init.d/console107 # End console -
bootscripts/lfs/init.d/consolelog
r75fe599 r0cda898 1 1 #!/bin/sh 2 # Begin $rc_base/init.d/consolelog3 4 2 ######################################################################## 3 # Begin consolelog 5 4 # 6 5 # Description : Set the kernel log level for the console 7 6 # 8 7 # Authors : Dan Nicholson - dnicholson@linuxfromscratch.org 8 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 9 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 9 10 # 10 # Version : 00.0011 # Version : LFS 7.0 11 12 # 12 13 # Notes : /proc must be mounted before this can run … … 14 15 ######################################################################## 15 16 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 18 31 19 32 # set the default loglevel 20 33 LOGLEVEL=7 21 if [ -r /etc/sysconfig/console ]; then 22 . /etc/sysconfig/console 23 fi 34 35 [ -r /etc/sysconfig/console ] && . /etc/sysconfig/console 24 36 25 37 case "${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 ;; 47 51 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 54 60 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 ;; 59 71 esac 60 72 61 # End $rc_base/init.d/consolelog73 # End consolelog -
bootscripts/lfs/init.d/functions
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/functions3 # Begin boot functions 4 4 # 5 5 # Description : Run Level Control Functions 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # 9 # Version : 00.00 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 9 # 10 # Version : LFS 7.0 10 11 # 11 12 # 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 13 16 # 14 17 ######################################################################## 18 19 # Set any needed environment variables e.g. HEADLESS 20 [ -r /etc/sysconfig/init_params ] && . /etc/sysconfig/init_params 15 21 16 22 ## Environmental setup … … 28 34 # Find current screen size 29 35 if [ -z "${COLUMNS}" ]; then 30 31 36 COLUMNS=$(stty size) 37 COLUMNS=${COLUMNS##* } 32 38 fi 33 39 34 40 # When using remote connections, such as a serial port, stty size returns 0 35 41 if [ "${COLUMNS}" = "0" ]; then 36 42 COLUMNS=80 37 43 fi 38 44 … … 44 50 # If formatting is needed, $ECHO should be used 45 51 case "`echo -e -n test`" in 46 47 48 49 50 51 52 -[en]*) 53 ECHO=/bin/echo 54 ;; 55 *) 56 ECHO=echo 57 ;; 52 58 esac 53 59 … … 85 91 # 86 92 # Dependencies: - sed for parsing strings. 87 # 93 # - grep for counting string length. 88 94 # 89 95 # Todo: … … 91 97 boot_mesg() 92 98 { 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 119 127 } 120 128 121 129 boot_mesg_flush() 122 130 { 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" 131 133 } 132 134 133 135 echo_ok() 134 136 { 135 136 137 ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]" 138 ${ECHO} -e "${NORMAL}" 137 139 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 138 142 } 139 143 140 144 echo_failure() 141 145 { 142 143 146 ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" 147 ${ECHO} -e "${NORMAL}" 144 148 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 145 151 } 146 152 147 153 echo_warning() 148 154 { 149 150 155 ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" 156 ${ECHO} -e "${NORMAL}" 151 157 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 162 echo_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 171 wait_for_user() 172 { 173 # Wait for the user by default 174 [ "${HEADLESS=0}" = "0" ] && read ENTER 187 175 } 188 176 189 177 evaluate_retval() 190 178 { 191 192 193 194 195 196 197 198 199 200 201 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 202 190 } 203 191 204 192 print_status() 205 193 { 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 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 252 240 253 241 } … … 255 243 reloadproc() 256 244 { 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 if [ -n "${PIDFILE}" ];then284 285 286 287 288 if [ -z "${pidfile}" ];then289 290 291 292 293 294 295 296 297 298 299 300 if [ -n "${pidlist}" ];then301 302 303 304 305 306 307 308 309 310 311 312 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 313 301 } 314 302 315 303 statusproc() 316 304 { 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 if [ -n "${PIDFILE}" ];then349 350 351 352 353 if [ -z "${pidfile}" ];then354 355 356 357 358 359 360 361 362 if [ -n "${pidlist}" ];then363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 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 381 369 } 382 370 … … 406 394 pidofproc() 407 395 { 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 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 484 472 } 485 473 … … 511 499 loadproc() 512 500 { 513 514 515 501 local pidfile="" 502 local forcestart="" 503 local nicelevel="10" 516 504 517 505 # This will ensure compatibility with previous LFS Bootscripts 518 if [ -n "${PIDFILE}" ];then519 520 506 if [ -n "${PIDFILE}" ]; then 507 pidfile="${PIDFILE}" 508 fi 521 509 522 510 while true 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 if [ -z "${pidfile}" ];then554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 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, 579 567 # but required to be compatible with older bootscripts 580 568 return 0 581 569 } 582 570 … … 604 592 killproc() 605 593 { 606 607 608 609 610 611 if [ -n "${PIDFILE}" ];then612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 elif [ "${#}" != "1" ];then635 636 637 638 639 640 641 if [ -z "${pidfile}" ];then642 643 644 645 646 647 648 649 650 651 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 652 640 653 641 # If running, send the signal 654 642 if [ -n "${pidlist}" ]; then 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 if [ -z "${pidfile}" ];then681 682 683 684 685 686 687 688 689 if [ -f "${pidfile}" ];then690 691 692 693 694 695 696 697 698 699 700 701 702 703 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 704 692 else # process not running 705 693 print_status warning not_running 706 694 fi 707 695 } … … 724 712 log_success_msg() 725 713 { 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 729 720 } 730 721 … … 744 735 #******************************************************************************* 745 736 log_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 749 743 } 750 744 … … 764 758 #******************************************************************************* 765 759 log_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 #******************************************************************************* 782 log_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 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/halt3 # Begin halt 4 4 # 5 5 # Description : Halt Script 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 26 18 27 case "${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 ;; 26 36 esac 27 37 28 # End $rc_base/init.d/halt38 # End halt -
bootscripts/lfs/init.d/localnet
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/localnet3 # Begin localnet 4 4 # 5 5 # Description : Loopback device 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 29 . /etc/sysconfig/network 18 30 19 31 case "${1}" in 20 21 22 23 24 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 25 37 26 27 28 29 38 boot_mesg "Setting hostname to ${HOSTNAME}..." 39 hostname ${HOSTNAME} 40 evaluate_retval 41 ;; 30 42 31 32 33 34 35 43 stop) 44 boot_mesg "Bringing down the loopback interface..." 45 ip link set lo down 46 evaluate_retval 47 ;; 36 48 37 38 39 40 41 49 restart) 50 ${0} stop 51 sleep 1 52 ${0} start 53 ;; 42 54 43 44 45 46 55 status) 56 echo "Hostname is: $(hostname)" 57 ip link show lo 58 ;; 47 59 48 49 50 51 60 *) 61 echo "Usage: ${0} {start|stop|restart|status}" 62 exit 1 63 ;; 52 64 esac 53 65 54 # End $rc_base/init.d/localnet66 # End localnet -
bootscripts/lfs/init.d/modules
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/modules3 # Begin modules 4 4 # 5 5 # Description : Module auto-loading script 6 6 # 7 7 # Authors : Zack Winkles 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 28 18 29 # Assure that the kernel has module support. … … 20 31 21 32 case "${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 23 39 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} 29 41 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 31 45 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 35 50 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 40 54 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 44 63 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 53 68 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 ;; 58 76 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 ;; 70 81 esac 71 82 72 # End $rc_base/init.d/modules83 # End modules -
bootscripts/lfs/init.d/mountfs
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/mountfs3 # Begin mountfs 4 4 # 5 5 # Description : File System Mount Script 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 31 18 32 case "${1}" in 19 20 21 22 33 start) 34 boot_mesg "Remounting root file system in read-write mode..." 35 mount -n -o remount,rw / >/dev/null 36 evaluate_retval 23 37 24 25 38 # Remove fsck-related file system watermarks. 39 rm -f /fastboot /forcefsck 26 40 27 28 41 boot_mesg "Recording existing mounts in /etc/mtab..." 42 > /etc/mtab 29 43 30 mount -f /|| failed=131 32 mount -f /sys|| failed=133 mount -f /run|| failed=134 35 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 36 50 37 38 39 40 41 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 ;; 43 57 44 45 46 47 48 58 stop) 59 boot_mesg "Unmounting all other currently mounted file systems..." 60 umount -a -d -r >/dev/null 61 evaluate_retval 62 ;; 49 63 50 51 52 53 64 *) 65 echo "Usage: ${0} {start|stop}" 66 exit 1 67 ;; 54 68 esac 55 69 56 # End $rc_base/init.d/mountfs70 # End mountfs -
bootscripts/lfs/init.d/mountvirtfs
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/mountvirtfs3 # Begin mountvirtfs 4 4 # 5 5 # Description : Mount proc, sysfs, and run 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 30 18 31 case "${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} 21 36 22 if ! mountpoint /proc >/dev/null; then23 boot_mesg -n " /proc" ${NORMAL}24 mount -n /proc || failed=125 fi26 37 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} 31 40 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 37 45 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 39 50 40 (exit ${failed}) 41 evaluate_retval 42 ;; 51 boot_mesg "" ${NORMAL} 43 52 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 ;; 48 61 esac 49 62 50 # End $rc_base/init.d/mountvertfs63 # End mountvertfs -
bootscripts/lfs/init.d/network
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/network3 # Begin network 4 4 # 5 5 # Description : Network Control Script 6 6 # 7 7 # 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 10 11 # 11 # Version : 00.00 12 # 13 # Notes : 12 # Version : LFS 7.0 14 13 # 15 14 ######################################################################## 16 15 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 20 28 21 29 case "${1}" in 22 23 24 for file in ${network_devices}/ifconfig.*25 26 30 start) 31 # Start all network interfaces 32 for file in /etc/sysconfig/ifconfig.* 33 do 34 interface=${file##*/ifconfig.} 27 35 28 29 30 31 32 36 # skip if $file is * (because nothing was found) 37 if [ "${interface}" = "*" ] 38 then 39 continue 40 fi 33 41 34 IN_BOOT=1 ${network_devices}/ifup ${interface}35 36 42 /sbin/ifup ${interface} 43 done 44 ;; 37 45 38 39 40 41 for file in ${network_devices}/ifconfig.*42 43 44 46 stop) 47 # Reverse list 48 FILES="" 49 for file in /etc/sysconfig/ifconfig.* 50 do 51 FILES="${file} ${FILES}" 52 done 45 53 46 47 48 49 54 # Stop all network interfaces 55 for file in ${FILES} 56 do 57 interface=${file##*/ifconfig.} 50 58 51 52 53 54 55 59 # skip if $file is * (because nothing was found) 60 if [ "${interface}" = "*" ] 61 then 62 continue 63 fi 56 64 57 IN_BOOT=1 ${network_devices}/ifdown ${interface}58 59 65 /sbin/ifdown ${interface} 66 done 67 ;; 60 68 61 62 63 64 65 69 restart) 70 ${0} stop 71 sleep 1 72 ${0} start 73 ;; 66 74 67 68 69 70 75 *) 76 echo "Usage: ${0} {start|stop|restart}" 77 exit 1 78 ;; 71 79 esac 72 80 73 # End /etc/rc.d/init.d/network81 # End network -
bootscripts/lfs/init.d/rc
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/rc3 # Begin rc 4 4 # 5 5 # Description : Main Run Level Control Script 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 15 . /etc/sysconfig/rc 16 . ${rc_functions} 14 . /lib/boot/functions 15 16 print_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 35 check_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 } 17 50 18 51 # This sets a few default terminal options. … … 25 58 26 59 if [ "${runlevel}" = "" ]; then 27 28 60 echo "Usage: ${0} <runlevel>" >&2 61 exit 1 29 62 fi 30 63 … … 32 65 [ "${previous}" = "" ] && previous=N 33 66 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 67 if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then 68 boot_mesg "/etc/rc.d/rc${runlevel}.d does not exist." 69 exit 1 38 70 fi 39 71 40 # Attempt to stop all service started byprevious runlevel,72 # Attempt to stop all services started by the previous runlevel, 41 73 # and killed in this runlevel 42 74 if [ "${previous}" != "N" ]; then 43 for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null)44 45 75 for i in $(ls -v /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null) 76 do 77 check_script_status 46 78 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]$suffix49 sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix79 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 50 82 51 52 53 54 55 56 57 58 59 60 61 62 63 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=${?} 64 96 65 66 67 68 97 if [ "${error_value}" != "0" ]; then 98 print_error_msg 99 fi 100 done 69 101 fi 70 102 103 [ "${previous}" = "N" ] && IN_BOOT=1 104 71 105 #Start all functions in this runlevel 72 for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null)106 for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null) 73 107 do 74 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]$suffix77 prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix108 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 78 112 79 80 113 [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue 114 fi 81 115 82 116 check_script_status 83 117 84 85 86 87 88 89 90 91 92 118 case ${runlevel} in 119 0|6) 120 ${i} stop 121 ;; 122 *) 123 ${i} start 124 ;; 125 esac 126 error_value=${?} 93 127 94 95 96 128 if [ "${error_value}" != "0" ]; then 129 print_error_msg 130 fi 97 131 done 98 132 99 # End $rc_base/init.d/rc133 # End rc -
bootscripts/lfs/init.d/reboot
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/reboot3 # Begin reboot 4 4 # 5 5 # Description : Reboot Scripts 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 28 18 29 case "${1}" in 19 20 21 22 30 stop) 31 boot_mesg "Restarting system..." 32 reboot -d -f -i 33 ;; 23 34 24 25 26 27 35 *) 36 echo "Usage: ${0} {stop}" 37 exit 1 38 ;; 28 39 29 40 esac 30 41 31 # End $rc_base/init.d/reboot42 # End reboot -
bootscripts/lfs/init.d/sendsignals
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/sendsignals3 # Begin sendsignals 4 4 # 5 5 # Description : Sendsignals Script 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 28 18 29 case "${1}" in 19 20 21 22 30 stop) 31 boot_mesg "Sending all processes the TERM signal..." 32 killall5 -15 33 error_value=${?} 23 34 24 35 sleep ${KILLDELAY} 25 36 26 27 28 29 30 37 if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then 38 echo_ok 39 else 40 echo_failure 41 fi 31 42 32 33 34 43 boot_mesg "Sending all processes the KILL signal..." 44 killall5 -9 45 error_value=${?} 35 46 36 47 sleep ${KILLDELAY} 37 48 38 39 40 41 42 43 49 if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then 50 echo_ok 51 else 52 echo_failure 53 fi 54 ;; 44 55 45 46 47 48 56 *) 57 echo "Usage: ${0} {stop}" 58 exit 1 59 ;; 49 60 50 61 esac 51 62 52 # End $rc_base/init.d/sendsignals63 # End sendsignals -
bootscripts/lfs/init.d/setclock
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/setclock3 # Begin setclock 4 4 # 5 5 # Description : Setting Linux Clock 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 18 32 19 33 case "${UTC}" in 20 21 22 34 yes|true|1) 35 CLOCKPARAMS="${CLOCKPARAMS} --utc" 36 ;; 23 37 24 25 26 38 no|false|0) 39 CLOCKPARAMS="${CLOCKPARAMS} --localtime" 40 ;; 27 41 28 42 esac 29 43 30 44 case ${1} in 31 32 33 34 35 45 start) 46 boot_mesg "Setting system clock..." 47 hwclock --hctosys ${CLOCKPARAMS} >/dev/null 48 evaluate_retval 49 ;; 36 50 37 38 39 40 41 51 stop) 52 boot_mesg "Setting hardware clock..." 53 hwclock --systohc ${CLOCKPARAMS} >/dev/null 54 evaluate_retval 55 ;; 42 56 43 44 45 57 *) 58 echo "Usage: ${0} {start|stop}" 59 ;; 46 60 47 61 esac -
bootscripts/lfs/init.d/swap
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/swap3 # Begin swap 4 4 # 5 5 # Description : Swap Control Script 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 29 18 30 case "${1}" in 19 20 21 22 23 31 start) 32 boot_mesg "Activating all swap files/partitions..." 33 swapon -a 34 evaluate_retval 35 ;; 24 36 25 26 27 28 29 37 stop) 38 boot_mesg "Deactivating all swap files/partitions..." 39 swapoff -a 40 evaluate_retval 41 ;; 30 42 31 32 33 34 35 43 restart) 44 ${0} stop 45 sleep 1 46 ${0} start 47 ;; 36 48 37 38 39 40 41 42 49 status) 50 boot_mesg "Retrieving swap status." ${INFO} 51 echo_ok 52 echo 53 swapon -s 54 ;; 43 55 44 45 46 47 56 *) 57 echo "Usage: ${0} {start|stop|restart|status}" 58 exit 1 59 ;; 48 60 esac 49 61 50 # End $rc_base/init.d/swap62 # End swap -
bootscripts/lfs/init.d/sysctl
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/sysctl3 # Begin sysctl 4 4 # 5 5 # Description : File uses /etc/sysctl.conf to set kernel runtime … … 8 8 # Authors : Nathan Coulson (nathan@linuxfromscratch.org) 9 9 # Matthew Burgress (matthew@linuxfromscratch.org) 10 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 10 11 # 11 # Version : 00.00 12 # 13 # Notes : 12 # Version : LFS 7.0 14 13 # 15 14 ######################################################################## 16 15 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 19 31 20 32 case "${1}" in 21 22 23 24 25 26 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 ;; 28 40 29 30 sysctl -a 31 41 status) 42 sysctl -a 43 ;; 32 44 33 34 35 36 45 *) 46 echo "Usage: ${0} {start|status}" 47 exit 1 48 ;; 37 49 esac 38 50 39 # End $rc_base/init.d/sysctl51 # End sysctl -
bootscripts/lfs/init.d/sysklogd
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/sysklogd3 # Begin sysklogd 4 4 # 5 5 # Description : Sysklogd loader 6 6 # 7 7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 29 18 30 case "${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 22 35 23 24 25 36 boot_mesg "Starting kernel log daemon..." 37 loadproc klogd 38 ;; 26 39 27 28 29 40 stop) 41 boot_mesg "Stopping kernel log daemon..." 42 killproc klogd 30 43 31 32 33 44 boot_mesg "Stopping system log daemon..." 45 killproc syslogd 46 ;; 34 47 35 36 37 38 48 reload) 49 boot_mesg "Reloading system log daemon config file..." 50 reloadproc syslogd 51 ;; 39 52 40 41 42 43 44 53 restart) 54 ${0} stop 55 sleep 1 56 ${0} start 57 ;; 45 58 46 47 48 49 59 status) 60 statusproc syslogd 61 statusproc klogd 62 ;; 50 63 51 52 53 54 64 *) 65 echo "Usage: ${0} {start|stop|reload|restart|status}" 66 exit 1 67 ;; 55 68 esac 56 69 57 # End $rc_base/init.d/sysklogd70 # End sysklogd -
bootscripts/lfs/init.d/template
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/3 # Begin scriptname 4 4 # 5 5 # Description : … … 7 7 # Authors : 8 8 # 9 # Version : 00.009 # Version : LFS x.x 10 10 # 11 11 # Notes : … … 13 13 ######################################################################## 14 14 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 17 29 18 30 case "${1}" in 19 20 21 22 31 start) 32 boot_mesg "Starting..." 33 loadproc 34 ;; 23 35 24 25 26 27 36 stop) 37 boot_mesg "Stopping..." 38 killproc 39 ;; 28 40 29 30 31 32 41 reload) 42 boot_mesg "Reloading..." 43 reloadproc 44 ;; 33 45 34 35 36 37 38 46 restart) 47 ${0} stop 48 sleep 1 49 ${0} start 50 ;; 39 51 40 41 42 52 status) 53 statusproc 54 ;; 43 55 44 45 46 47 56 *) 57 echo "Usage: ${0} {start|stop|reload|restart|status}" 58 exit 1 59 ;; 48 60 esac 49 61 50 # End $rc_base/init.d/62 # End scriptname -
bootscripts/lfs/init.d/udev
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/udev3 # Begin udev 4 4 # 5 5 # Description : Udev cold-plugging script 6 6 # 7 7 # Authors : Zack Winkles, Alexander E. Patrakov 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.02 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 29 18 30 case "${1}" in 19 20 21 22 23 24 25 26 27 28 29 read ENTER 30 31 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 32 44 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 read ENTER 49 50 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 51 63 52 64 ln -s /run/shm /dev/shm 53 65 54 55 56 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 57 69 58 59 60 70 # Copy the only static device node that Udev >= 155 doesn't 71 # handle to /dev 72 cp -a /lib/udev/devices/null /dev 61 73 62 63 64 74 # Start the udev daemon to continually watch for, and act on, 75 # uevents 76 /sbin/udevd --daemon 65 77 66 67 68 69 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 70 82 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 ;; 74 87 75 ;; 76 77 *) 78 echo "Usage ${0} {start}" 79 exit 1 80 ;; 88 *) 89 echo "Usage ${0} {start}" 90 exit 1 91 ;; 81 92 esac 82 93 83 # End $rc_base/init.d/udev94 # End udev -
bootscripts/lfs/init.d/udev_retry
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $rc_base/init.d/udev_retry3 # Begin udev_retry 4 4 # 5 5 # Description : Udev cold-plugging script (retry) 6 6 # 7 7 # Authors : Alexander E. Patrakov 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.02 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 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 17 30 18 31 case "${1}" in 19 20 32 start) 33 boot_mesg "Retrying failed uevents, if any..." 21 34 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 30 45 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 38 48 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 ;; 43 58 esac 44 59 45 # End $rc_base/init.d/udev_retry60 # End udev_retry -
bootscripts/lfs/sysconfig/network-devices/ifdown
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $network_devices/ifdown3 # Begin /sbin/ifdown 4 4 # 5 5 # Description : Interface Down … … 7 7 # Authors : Nathan Coulson - nathan@linuxfromscratch.org 8 8 # Kevin P. Fleming - kpfleming@linuxfromscratch.org 9 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 9 10 # 10 # Version : 00.0111 # Version : LFS 7.0 11 12 # 12 13 # Notes : the IFCONFIG variable is passed to the scripts found 13 # in the servicesdirectory, to indicate what file the14 # in the /lib/boot directory, to indicate what file the 14 15 # service should source to get environmental variables. 15 16 # 16 17 ######################################################################## 17 18 18 . /etc/sysconfig/rc 19 . ${rc_functions} 19 file=/etc/sysconfig/ifconfig.${1} 20 20 21 # Collect a list of configuration files for our interface22 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}" ]; then27 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 26 if [ ! -r "${file}" ]; then 27 boot_mesg "${file} is missing or cannot be accessed." ${WARNING} 28 echo_warning 29 exit 1 30 30 fi 31 31 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} 37 33 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 34 if [ "$IFACE" = "" ]; then 35 boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE} 36 echo_failure 37 exit 1 93 38 fi 94 39 95 # End $network_devices/ifdown 40 # This will run the service script, if SERVICE is set 41 if [ -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 48 else 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 54 fi 55 56 link_status=`ip link show ${IFACE} 2>/dev/null` 57 58 if [ -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 64 fi 65 66 # End /sbin/ifdown -
bootscripts/lfs/sysconfig/network-devices/ifup
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $network_devices/ifup3 # Begin /sbin/ifup 4 4 # 5 5 # Description : Interface Up … … 7 7 # Authors : Nathan Coulson - nathan@linuxfromscratch.org 8 8 # Kevin P. Fleming - kpfleming@linuxfromscratch.org 9 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 9 10 # 10 # Version : 00.0011 # Version : LFS 7.0 11 12 # 12 # Notes : the IFCONFIG variable is passed to the scripts found13 # in the servicesdirectory, to indicate what file the13 # Notes : The IFCONFIG variable is passed to the SERVICE script 14 # in the /lib/boot directory, to indicate what file the 14 15 # service should source to get environmental variables. 15 16 # 16 17 ######################################################################## 17 18 18 . /etc/sysconfig/rc 19 . ${rc_functions} 19 file=/etc/sysconfig/ifconfig.${1} 20 20 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 32 25 33 26 boot_mesg "Bringing up the ${1} interface..." 34 27 boot_mesg_flush 35 28 36 # Process each configruation file 37 for file in ${FILES}; do 38 # skip backup files 39 if [ "${file}" != "${file%""~""}" ]; then 40 continue 41 fi 29 if [ ! -r "${file}" ]; then 30 boot_mesg "${file} is missing or cannot be accessed." ${WARNING} 31 echo_warning 32 exit 1 33 fi 42 34 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 48 36 49 ( 50 . ${file} 37 if [ "$IFACE" = "" ]; then 38 boot_mesg "${file} does not define an interface [IFACE]." ${FAILURE} 39 echo_failure 40 exit 1 41 fi 51 42 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 45 if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then 46 echo_skipped 47 exit 0 48 fi 62 49 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 50 if [ -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 89 55 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 74 else 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 80 fi 81 82 # End /sbin/ifup -
bootscripts/lfs/sysconfig/network-devices/services/ipv4-static
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $network_devices/services/ipv4-static3 # Begin /lib/boot/ipv4-static 4 4 # 5 5 # Description : IPV4 Static Boot Script 6 6 # 7 7 # 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 9 10 # 10 # Version : 00.00 11 # 12 # Notes : 11 # Version : LFS 7.0 13 12 # 14 13 ######################################################################## 15 14 16 . /etc/sysconfig/rc 17 . ${rc_functions} 15 . /lib/boot/functions 18 16 . ${IFCONFIG} 19 17 20 18 if [ -z "${IP}" ]; then 21 22 23 19 boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} 20 echo_failure 21 exit 1 24 22 fi 25 23 26 24 if [ -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 32 31 elif [ -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 36 36 elif [ -n "${PREFIX}" ]; then 37 args="${args} ${IP}/${PREFIX}" 37 args="${args} ${IP}/${PREFIX}" 38 38 39 elif [ -n "${PEER}" ]; then 39 40 args="${args} ${IP} peer ${PEER}" 40 41 fi 41 42 42 43 if [ -n "${BROADCAST}" ]; then 43 44 args="${args} broadcast ${BROADCAST}" 44 45 fi 45 46 46 47 case "${2}" in 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 if [ -n "${GATEWAY}" ];then66 67 68 69 70 71 72 73 74 75 76 77 78 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 ;; 80 81 esac 81 82 82 # End $network_devices/services/ipv4-static83 # End /lib/boot/ipv4-static -
bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route
r75fe599 r0cda898 1 1 #!/bin/sh 2 2 ######################################################################## 3 # Begin $network_devices/services/ipv4-static-route3 # Begin /lib/boot/ipv4-static-route 4 4 # 5 5 # Description : IPV4 Static Route Script 6 6 # 7 7 # Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org 8 # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org 8 9 # 9 # Version : 00.00 10 # 11 # Notes : 10 # Version : LFS 7.0 12 11 # 13 12 ######################################################################## 14 13 15 . /etc/sysconfig/rc 16 . ${rc_functions} 14 . /lib/boot/functions 17 15 . ${IFCONFIG} 18 16 19 17 case "${TYPE}" in 20 21 22 23 18 ("" | "network") 19 need_ip=1 20 need_gateway=1 21 ;; 24 22 25 26 27 28 29 23 ("default") 24 need_gateway=1 25 args="${args} default" 26 desc="default" 27 ;; 30 28 31 32 33 29 ("host") 30 need_ip=1 31 ;; 34 32 35 36 37 38 39 33 ("unreachable") 34 need_ip=1 35 args="${args} unreachable" 36 desc="unreachable " 37 ;; 40 38 41 42 43 44 45 39 (*) 40 boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE} 41 echo_failure 42 exit 1 43 ;; 46 44 esac 47 45 48 46 if [ -n "${need_ip}" ]; then 49 50 51 52 53 47 if [ -z "${IP}" ]; then 48 boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE} 49 echo_failure 50 exit 1 51 fi 54 52 55 56 57 58 59 60 61 62 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}" 63 61 fi 64 62 65 63 if [ -n "${need_gateway}" ]; then 66 67 68 69 70 71 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}" 72 70 fi 73 71 … … 77 75 78 76 case "${2}" in 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 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 ;; 95 93 esac 96 94 97 # End $network_devices/services/ipv4-static-route95 # End /bib/boot/ipv4-static-route -
chapter01/changelog.xml
r75fe599 r0cda898 38 38 --> 39 39 <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> 40 61 <para>2011-07-17</para> 41 62 <itemizedlist> -
chapter06/sysvinit.xml
r75fe599 r0cda898 75 75 </sect2> 76 76 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 the90 following:</para>91 92 <screen><userinput>cat > /etc/inittab << "EOF"93 <literal># Begin /etc/inittab94 95 id:3:initdefault:96 97 si::sysinit:/etc/rc.d/init.d/rc sysinit98 99 l0:0:wait:/etc/rc.d/init.d/rc 0100 l1:S1:wait:/etc/rc.d/init.d/rc 1101 l2:2:wait:/etc/rc.d/init.d/rc 2102 l3:3:wait:/etc/rc.d/init.d/rc 3103 l4:4:wait:/etc/rc.d/init.d/rc 4104 l5:5:wait:/etc/rc.d/init.d/rc 5105 l6:6:wait:/etc/rc.d/init.d/rc 6106 107 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now108 109 su:S016:once:/sbin/sulogin110 111 1:2345:respawn:/sbin/agetty tty1 9600112 2:2345:respawn:/sbin/agetty tty2 9600113 3:2345:respawn:/sbin/agetty tty3 9600114 4:2345:respawn:/sbin/agetty tty4 9600115 5:2345:respawn:/sbin/agetty tty5 9600116 6:2345:respawn:/sbin/agetty tty6 9600117 118 # End /etc/inittab</literal>119 EOF</userinput></screen>120 121 </sect2>122 123 77 <sect2 id="contents-sysvinit" role="content"> 124 78 <title>Contents of Sysvinit</title> -
chapter07/bootscripts.xml
r75fe599 r0cda898 50 50 <sect2 id="contents-bootscripts" role="content"> 51 51 <title>Contents of LFS-Bootscripts</title> 52 53 52 <segmentedlist> 54 53 <segtitle>Installed scripts</segtitle> … … 60 59 sendsignals, setclock, static, swap, sysctl, sysklogd, template, 61 60 udev, and udev_retry</seg> 62 <seg>/etc/rc.d, /etc/sysconfig </seg>61 <seg>/etc/rc.d, /etc/sysconfig, /lib/boot</seg> 63 62 </seglistitem> 64 63 </segmentedlist> … … 141 140 <term><command>ifdown</command></term> 142 141 <listitem> 143 <para> Assists the network script with stopping network devices</para>142 <para>Stops a network device</para> 144 143 <indexterm zone="ch-scripts-bootscripts ifdown-bootscripts"> 145 144 <primary sortas="d-ifdown">ifdown</primary> … … 151 150 <term><command>ifup</command></term> 152 151 <listitem> 153 <para> Assists the network script with starting network devices</para>152 <para>Initializes a network device</para> 154 153 <indexterm zone="ch-scripts-bootscripts ifup-bootscripts"> 155 154 <primary sortas="d-ifup">ifup</primary> … … 326 325 <listitem> 327 326 <para>Retries failed udev uevents, and copies generated rules 328 files from <filename class="directory">/dev/.udev</filename>to327 files from to 329 328 <filename class="directory">/etc/udev/rules.d</filename> if required</para> 330 329 <indexterm zone="ch-scripts-bootscripts udev-retry-bootscripts"> -
chapter07/chapter07.xml
r75fe599 r0cda898 13 13 14 14 <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"/> 15 19 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/> 16 20 <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"/> 17 22 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/> 18 23 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/> 19 24 <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"/> 20 26 <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"/>27 27 28 28 </chapter> -
chapter07/hostname.xml
r75fe599 r0cda898 9 9 <?dbhtml filename="hostname.html"?> 10 10 11 <title>Configuring the localnet Script</title>11 <title>Configuring the system hostname</title> 12 12 13 13 <indexterm zone="ch-scripts-hostname"> 14 <primary sortas="d- localnet">localnet</primary>14 <primary sortas="d-hostname">hostname</primary> 15 15 <secondary>configuring</secondary> 16 16 </indexterm> … … 27 27 <para><replaceable><lfs></replaceable> needs to be replaced with the name given 28 28 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> 31 30 32 31 </sect1> -
chapter07/hosts.xml
r75fe599 r0cda898 62 62 <para>The <replaceable><192.168.1.1></replaceable> and 63 63 <replaceable><HOSTNAME.example.org></replaceable> 64 values need to be changed for specific use rs or requirements (if64 values need to be changed for specific uses or requirements (if 65 65 assigned an IP address by a network/system administrator and the 66 66 machine will be connected to an existing network). The optional alias -
chapter07/introduction.xml
r75fe599 r0cda898 11 11 <title>Introduction</title> 12 12 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> 17 27 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 18 42 <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> 23 50 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 26 89 27 90 </sect1> -
chapter07/network.xml
r75fe599 r0cda898 9 9 <?dbhtml filename="network.html"?> 10 10 11 <title> Configuring the network Script</title>11 <title>General Network Configuration</title> 12 12 13 13 <indexterm zone="ch-scripts-network"> … … 26 26 <sect2> 27 27 <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> 28 33 29 34 <para>With Udev and modular network drivers, the network interface numbering … … 113 118 114 119 <para>Which interfaces are brought up and down by the network script 115 depends on the files and directories in the<filename116 class="directory">/etc/sysconfig/ network-devices</filename> hierarchy.117 This directory should contain a sub-directory for each interface to be118 configured, such as <filename>ifconfig.xyz</filename>, where119 <quote>xyz</quote> is a network interface name. Inside this directory120 would be files defining the attributes to this interface, such as its IP121 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 > ifconfig.eth0 /ipv4<< "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/ 133 cat > ifconfig.eth0 << "EOF" 129 134 <literal>ONBOOT=yes 135 IFACE=eth0 130 136 SERVICE=ipv4-static 131 137 IP=192.168.1.1 … … 136 142 137 143 <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> 143 156 144 157 <para>The <envar>SERVICE</envar> variable defines the method used for 145 158 obtaining the IP address. The LFS-Bootscripts package has a modular IP 146 159 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> 151 163 152 164 <para>The <envar>GATEWAY</envar> variable should contain the default … … 190 202 EOF</userinput></screen> 191 203 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 192 208 <para>Replace <replaceable><IP address of the nameserver></replaceable> 193 209 with the IP address of the DNS most appropriate for the setup. There will … … 197 213 may also be a router on the local network.</para> 198 214 215 <note><para>The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4.</para></note> 216 199 217 </sect2> 200 218 -
chapter07/setclock.xml
r75fe599 r0cda898 63 63 time zones, UTC, and the <envar>TZ</envar> environment variable.</para> 64 64 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 65 68 </sect1> -
chapter07/sysklogd.xml
r75fe599 r0cda898 17 17 18 18 <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> 25 30 26 31 </sect1> -
chapter07/udev.xml
r75fe599 r0cda898 96 96 <title>Udev Bootscript</title> 97 97 98 <para>The <command> S10udev</command> initscript takes care of creating98 <para>The <command>/etc/rc.d/init.d/udev</command> initscript takes care of creating 99 99 device nodes when Linux is booted. The script unsets the uevent handler 100 100 from the default of <command>/sbin/hotplug</command>. This is done … … 201 201 arrange module loading by other means. With Linux-&linux-version;, Udev is 202 202 known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, 203 SERIO and FireWire devices.</para>203 SERIO, and FireWire devices.</para> 204 204 205 205 <para>To determine if the device driver you require has the necessary … … 244 244 245 245 <para>If the module in question is not a wrapper and is useful by itself, 246 configure the <command> S05modules</command> bootscript to load this246 configure the <command>modules</command> bootscript to load this 247 247 module on system boot. To do this, add the module name to the 248 248 <filename>/etc/sysconfig/modules</filename> file on a separate line. … … 307 307 vendor). The static device node will be copied to 308 308 <filename class="directory">/dev</filename> by the 309 <command> S10udev</command> bootscript.</para>309 <command>udev</command> bootscript.</para> 310 310 311 311 </sect3> -
chapter07/usage.xml
r75fe599 r0cda898 38 38 6: reboot the computer</literallayout> 39 39 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 > /etc/inittab << "EOF" 58 <literal># Begin /etc/inittab 59 60 id:3:initdefault: 61 62 si::sysinit:/etc/rc.d/init.d/rc sysinit 63 64 l0:0:wait:/etc/rc.d/init.d/rc 0 65 l1:S1:wait:/etc/rc.d/init.d/rc 1 66 l2:2:wait:/etc/rc.d/init.d/rc 2 67 l3:3:wait:/etc/rc.d/init.d/rc 3 68 l4:4:wait:/etc/rc.d/init.d/rc 4 69 l5:5:wait:/etc/rc.d/init.d/rc 5 70 l6:6:wait:/etc/rc.d/init.d/rc 6 71 72 ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now 73 74 su:S016:once:/sbin/sulogin 75 76 1:2345:respawn:/sbin/agetty tty1 9600 77 2:2345:respawn:/sbin/agetty tty2 9600 78 3:2345:respawn:/sbin/agetty tty3 9600 79 4:2345:respawn:/sbin/agetty tty4 9600 80 5:2345:respawn:/sbin/agetty tty5 9600 81 6:2345:respawn:/sbin/agetty tty6 9600 82 83 # End /etc/inittab</literal> 84 EOF</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 41 114 <replaceable><runlevel></replaceable></command>, where 42 115 <replaceable><runlevel></replaceable> is the target run-level. For example, to … … 60 133 <para>The real scripts are in <filename 61 134 class="directory">/etc/rc.d/init.d</filename>. They do the actual work, and 62 the symlinks all point to them. K illing links and startinglinks point to135 the symlinks all point to them. K links and S links point to 63 136 the same script in <filename class="directory">/etc/rc.d/init.d</filename>. 64 137 This is because the scripts can be called with different parameters like … … 127 200 it can be done.</para> 128 201 202 </sect2> 203 129 204 </sect1> -
general.ent
r75fe599 r0cda898 1 <!ENTITY version "SVN-20110 717">2 <!ENTITY releasedate " July 17, 2011">1 <!ENTITY version "SVN-20110801"> 2 <!ENTITY releasedate "Aug 1, 2011"> 3 3 <!ENTITY copyrightdate "1999-2011"><!-- jhalfs needs a literal dash, not – --> 4 <!ENTITY milestone " 6.9">4 <!ENTITY milestone "7.0"> 5 5 <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> 6 6 -
packages.ent
r75fe599 r0cda898 298 298 <!ENTITY less-ch6-sbu "less than 0.1 SBU"> 299 299 300 <!ENTITY lfs-bootscripts-version "20110 531"> <!-- Scripts depend on this format -->300 <!ENTITY lfs-bootscripts-version "20110801"> <!-- Scripts depend on this format --> 301 301 <!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB"> <!-- Updated in Makefile --> 302 302 <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2"> -
prologue/standards.xml
r75fe599 r0cda898 112 112 <term><emphasis>LSB Core:</emphasis></term> 113 113 <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> 116 116 </listitem> 117 117 </varlistentry> … … 165 165 <term><emphasis>LSB Core:</emphasis></term> 166 166 <listitem> 167 <para>At, Batch, Install_initd, Lsb_release, Remove_initd, Test167 <para>At, Batch, Lsb_release 168 168 </para> 169 169 </listitem>
Note:
See TracChangeset
for help on using the changeset viewer.