Changeset 9813d5e3 for bootscripts
- Timestamp:
- 11/14/2011 08:40:06 PM (12 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.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:
- a64fd5a
- Parents:
- b15d6da
- Location:
- bootscripts
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
bootscripts/ChangeLog
rb15d6da r9813d5e3 1 2011-11-14 Bruce Dubbs <bdubbs@linuxfromscratch.org> 2 3 * The following are from suggestions by DJ Lucas 4 ** General cleanup of scripts 5 ** Move consolelog function to rc 6 ** Clean up boot logging functions 7 ** Fix interactive prompt between run level S and target run level 8 1 9 2011-10-06 Bryan Kadzban <bryan@linuxfromscratch.org> 2 10 -
bootscripts/Makefile
rb15d6da r9813d5e3 25 25 install -d -m ${DIRMODE} ${MAN8} 26 26 install -d -m ${DIRMODE} ${SBIN} 27 ln -s vfservices ${DESTDIR}/lib/lsb28 ln -sf 27 ln -sfn services ${DESTDIR}/lib/lsb 28 ln -sfn rc.d/init.d ${EXTDIR}/init.d 29 29 30 30 files: create-dirs … … 33 33 install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/ 34 34 install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/ 35 install -m ${MODE} lfs/init.d/consolelog ${EXTDIR}/rc.d/init.d/36 35 install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/ 37 36 install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/ … … 53 52 install -m ${MODE} lfs/sbin/ifdown ${SBIN} 54 53 install -m ${MODE} lfs/sbin/ifup.8 ${MAN8} 55 ln -sf ifup.8${MAN8}/ifdown.854 ln -sf ifup.8 ${MAN8}/ifdown.8 56 55 install -m ${MODE} lfs/lib/services/ipv4-static-route ${LIBDIR} 57 56 install -m ${MODE} lfs/lib/services/ipv4-static ${LIBDIR} … … 77 76 rcS: files 78 77 ln -sf ../init.d/mountvirtfs ${EXTDIR}/rc.d/rcS.d/S00mountvirtfs 79 ln -sf ../init.d/consolelog ${EXTDIR}/rc.d/rcS.d/S02consolelog80 78 ln -sf ../init.d/modules ${EXTDIR}/rc.d/rcS.d/S05modules 81 79 ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rcS.d/S08localnet -
bootscripts/lfs/init.d/checkfs
rb15d6da r9813d5e3 80 80 log_info_msg "Checking file systems..." 81 81 # Note: -a option used to be -p; but this fails e.g. on fsck.minix 82 fsck ${options} -a -A -C -T 82 fsck ${options} -a -A -C -T >/dev/null 83 83 error_value=${?} 84 84 -
bootscripts/lfs/init.d/cleanfs
rb15d6da r9813d5e3 91 91 92 92 if [ "${SKIPTMPCLEAN}" = "" ]; then 93 log_info_msg2 " \n/tmp"93 log_info_msg2 " /tmp" 94 94 cd /tmp && 95 95 find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1 -
bootscripts/lfs/init.d/mountvirtfs
rb15d6da r9813d5e3 37 37 mkdir -p /run/{var,lock,shm} 38 38 39 log_info_msg "Mounting virtual file systems: /run"39 log_info_msg "Mounting virtual file systems: ${INFO}/run" 40 40 41 41 if ! mountpoint /proc >/dev/null; then 42 log_info_msg2 " /proc"42 log_info_msg2 " ${INFO}/proc" 43 43 mount -n /proc || failed=1 44 44 fi 45 45 46 46 if ! mountpoint /sys >/dev/null; then 47 log_info_msg2 " /sys"47 log_info_msg2 " ${INFO}/sys" 48 48 mount -n /sys || failed=1 49 49 fi -
bootscripts/lfs/init.d/rc
rb15d6da r9813d5e3 94 94 [ "${1}" != "" ] && runlevel=${1} 95 95 96 if [ "${runlevel}" = "" ]; then96 if [ "${runlevel}" == "" ]; then 97 97 echo "Usage: ${0} <runlevel>" >&2 98 98 exit 1 … … 100 100 101 101 previous=${PREVLEVEL} 102 [ "${previous}" = "" ] && previous=N102 [ "${previous}" == "" ] && previous=N 103 103 104 104 if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then … … 107 107 fi 108 108 109 if [ "$runlevel" == "6" ] || [ "$runlevel" == "0" ]; then IPROMPT="no"; fi 109 if [ "$runlevel" == "6" -o "$runlevel" == "0" ]; then IPROMPT="no"; fi 110 111 # Note: In ${LOGLEVEL:-7}, it is ':' 'dash' '7', not minus 7 112 if [ "$runlevel" == "S" ]; then dmesg -n "${LOGLEVEL:-7}"; fi 110 113 111 114 if [ "${IPROMPT}" == "yes" ]; then … … 116 119 icol=$(( ( ${COLUMNS} - ${ilen} ) / 2 )) 117 120 121 echo -e "\n\n" 118 122 echo -e "\\033[${wcol}G${welcome_message}" 119 123 echo -e "\\033[${icol}G${i_message}${NORMAL}" 120 124 echo "" 121 125 read -t "${itime}" -n 1 interactive 2>&1 > /dev/null 122 123 # Make lower case 124 [ "${interactive}" == "I" ] && interactive="i" 125 [ "${interactive}" != "i" ] && interactive="" 126 fi 126 fi 127 128 # Make lower case 129 [ "${interactive}" == "I" ] && interactive="i" 130 [ "${interactive}" != "i" ] && interactive="" 131 132 # Read the state file if it exists from runlevel S 133 [ -r /var/run/interactive ] && source /var/run/interactive 127 134 128 135 # Attempt to stop all services started by the previous runlevel, … … 137 144 sysinit_start=/etc/rc.d/rcS.d/S[0-9][0-9]$suffix 138 145 139 if [ "${runlevel}" != "0" ] && ["${runlevel}" != "6" ]; then140 if [ ! -f ${prev_start} ] && [! -f ${sysinit_start} ]; then146 if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then 147 if [ ! -f ${prev_start} -a ! -f ${sysinit_start} ]; then 141 148 MSG="WARNING:\n\n${i} can't be " 142 149 MSG="${MSG}executed because it was not " … … 157 164 if [ "${previous}" == "N" ]; then export IN_BOOT=1; fi 158 165 159 if [ "$runlevel" == "6" ] && [-n "${FASTBOOT}" ]; then166 if [ "$runlevel" == "6" -a -n "${FASTBOOT}" ]; then 160 167 touch /fastboot 161 168 fi … … 170 177 prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix 171 178 172 [ -f ${prev_start} ] && [! -f ${stop} ] && continue179 [ -f ${prev_start} -a ! -f ${stop} ] && continue 173 180 fi 174 181 … … 189 196 done 190 197 198 # Store interactive variable on switch from runlevel S and remove if not 199 if [ "${runlevel}" == "S" -a "${interactive}" == "i" ]; then 200 echo "interactive=\"i\"" > /var/run/interactive 201 else 202 rm -f /var/run/interactive 2> /dev/null 203 fi 204 191 205 # Copy the boot log on initial boot only 192 206 if [ "${previous}" == "N" ]; then 193 207 cat /run/var/bootlog >> /var/log/boot.log 194 echo "--------" >> /var/log/boot.log # Mark the end of boot 208 209 if [ "${runlevel}" != "S" ]; then 210 # Mark the end of boot 211 echo "--------" >> /var/log/boot.log 212 # Remove the temporary file 213 rm -f /run/var/bootlog 2> /dev/null 214 fi 195 215 fi 196 216 -
bootscripts/lfs/init.d/udev
rb15d6da r9813d5e3 85 85 # Now wait for udevd to process the uevents we triggered 86 86 /sbin/udevadm settle 87 log_success_msg287 #log_success_msg2 88 88 ;; 89 89 -
bootscripts/lfs/init.d/udev_retry
rb15d6da r9813d5e3 57 57 # Now wait for udevd to process the uevents we triggered 58 58 /sbin/udevadm settle 59 evaluate_retval59 #evaluate_retval 60 60 ;; 61 61 -
bootscripts/lfs/lib/services/init-functions
rb15d6da r9813d5e3 44 44 SET_WCOL="\\033[${WCOL}G" # at the $WCOL char 45 45 CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char 46 CURS_ZERO="\\033[0G" 46 47 47 48 ## Set color commands, used via echo … … 60 61 INFO="\\033[1;36m" # Information is light cyan 61 62 BRACKET="\\033[1;34m" # Brackets are blue 63 64 # Use a colored prefix 65 BMPREFIX=" " 66 SUCCESS_PREFIX="${SUCCESS} * ${NORMAL}" 67 FAILURE_PREFIX="${FAILURE}*****${NORMAL}" 68 WARNING_PREFIX="${WARNING} *** ${NORMAL}" 62 69 63 70 BOOTLOG=/run/var/bootlog … … 172 179 173 180 # Do the start! 174 175 181 nice -n "${nice}" "${@}" 176 182 } … … 471 477 # pathname, path to the specified program # 472 478 # # 473 # Note: Output to stdout. Not logged. #474 # #475 479 # Return values: # 476 480 # 0 - Status printed # … … 479 483 statusproc() 480 484 { 485 local pidfile 486 local pidlist 487 481 488 if [ "${#}" = "0" ]; then 482 echo "Usage: statusproc {program}"489 echo "Usage: [-p pidfle] statusproc {program}" 483 490 exit 1 484 491 fi 485 492 486 local pidfile 487 local pidlist 488 489 # Process arguments 490 while true; do 491 case "${1}" in 492 493 -p) 494 pidfile="${2}" 495 shift 2 496 ;; 497 esac 493 # Process arguments 494 while true; do 495 case "${1}" in 496 497 -p) 498 pidfile="${2}" 499 shift 2 500 ;; 501 502 *) 503 if [ -n "${2}" ]; then 504 echo "Too many arguments" 505 return 1 506 else 507 break 508 fi 509 ;; 510 esac 498 511 done 499 512 … … 517 530 "/var/run/${base}.pid exists.${NORMAL}" 518 531 else 519 if [ - z "${pidlist}" -a -n"${pidfile}" ]; then532 if [ -n "${pidfile}" -a -e "${pidfile}" ]; then 520 533 echo -e "${WARNING}${1} is not running" \ 521 534 "but ${pidfile} exists.${NORMAL}" … … 554 567 log_success_msg() 555 568 { 556 echo -n -e "${@}" 557 echo -e "${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" 569 echo -n -e "${BMPREFIX}${@}" 570 echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" 571 572 # Strip non-printable characters from log file 573 local logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'` 558 574 559 575 timespec 560 echo -e "${STAMP} ${@} OK" >> ${BOOTLOG} 576 echo -e "${STAMP} ${logmessage} OK" >> ${BOOTLOG} 577 561 578 return 0 562 579 } … … 564 581 log_success_msg2() 565 582 { 566 echo -n -e "${ @}"567 echo -e "${ SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"583 echo -n -e "${BMPREFIX}${@}" 584 echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" 568 585 569 586 echo " OK" >> ${BOOTLOG} 587 570 588 return 0 571 589 } … … 584 602 log_failure_msg() 585 603 { 586 echo -n -e "${@}" 587 echo -e "${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" 604 echo -n -e "${BMPREFIX}${@}" 605 echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" 606 607 # Strip non-printable characters from log file 588 608 589 609 timespec 590 echo -e "${STAMP} ${@} FAIL" >> ${BOOTLOG} 610 local logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'` 611 echo -e "${STAMP} ${logmessage} FAIL" >> ${BOOTLOG} 612 591 613 return 0 592 614 } … … 594 616 log_failure_msg2() 595 617 { 596 echo -n -e "${ @}"597 echo -e "${ SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"618 echo -n -e "${BMPREFIX}${@}" 619 echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" 598 620 599 621 echo "FAIL" >> ${BOOTLOG} 622 600 623 return 0 601 624 } … … 612 635 log_warning_msg() 613 636 { 614 echo -n -e "${@}" 615 echo -e "${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}" 616 637 echo -n -e "${BMPREFIX}${@}" 638 echo -e "${CURS_ZERO}${WARNING_PREFIX}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}" 639 640 # Strip non-printable characters from log file 641 local logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'` 617 642 timespec 618 echo -e "${STAMP} ${@} WARN" >> ${BOOTLOG} 643 echo -e "${STAMP} ${logmessage} WARN" >> ${BOOTLOG} 644 619 645 return 0 620 646 } … … 631 657 log_info_msg() 632 658 { 659 echo -n -e "${BMPREFIX}${@}" 660 661 # Strip non-printable characters from log file 662 local logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'` 663 timespec 664 echo -n -e "${STAMP} ${logmessage}" >> ${BOOTLOG} 665 666 return 0 667 } 668 669 log_info_msg2() 670 { 633 671 echo -n -e "${@}" 634 672 635 timespec 636 echo -n -e "${STAMP} ${@}" >> ${BOOTLOG} 637 return 0 638 } 639 640 log_info_msg2() 641 { 642 echo -n -e "${@}" 643 644 echo -n -e "${@}" >> ${BOOTLOG} 673 # Strip non-printable characters from log file 674 local logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'` 675 echo -n -e "${logmessage}" >> ${BOOTLOG} 676 645 677 return 0 646 678 } -
bootscripts/lfs/sysconfig/rc.site
rb15d6da r9813d5e3 3 3 4 4 # Distro Information 5 DISTRO="Linux From Scratch" # The distro name 6 DISTRO_CONTACT="lfs-dev@linuxfromscratch.org" # Bug report address 7 DISTRO_MINI="LFS" # Short name used in filenames for distro config 5 # These values, if specified here, override the defaults 6 #DISTRO="Linux From Scratch" # The distro name 7 #DISTRO_CONTACT="lfs-dev@linuxfromscratch.org" # Bug report address 8 #DISTRO_MINI="LFS" # Short name used in filenames for distro config 8 9 9 10 # Define custom colors used in messages printed to the screen 11 12 # Please consult `man console_codes` for more information 13 # under the "ECMA-48 Set Graphics Rendition" section 14 # 15 # Warning: when switching from a 8bit to a 9bit font, 16 # the linux console will reinterpret the bold (1;) to 17 # the top 256 glyphs of the 9bit font. This does 18 # not affect framebuffer consoles 19 10 20 # These values, if specified here, override the defaults 11 21 #BRACKET="\\033[1;34m" # Blue … … 16 26 #WARNING="\\033[1;33m" # Yellow 17 27 28 # Use a colored prefix 29 # These values, if specified here, override the defaults 30 #BMPREFIX=" " 31 #SUCCESS_PREFIX="${SUCCESS} * ${NORMAL}" 32 #FAILURE_PREFIX="${FAILURE}*****${NORMAL}" 33 #WARNING_PREFIX="${WARNING} *** ${NORMAL}" 34 18 35 # Interactive startup 19 36 #IPROMPT="yes" # Whether to display the interactive boot promp 20 itime=" 10" # The ammount of time (in seconds) to display the prompt37 itime="3" # The ammount of time (in seconds) to display the prompt 21 38 22 39 # The total length of the distro welcome string, without escape codes
Note:
See TracChangeset
for help on using the changeset viewer.