Changeset bd899fb for bootscripts
- Timestamp:
- 01/27/2012 08:39:49 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:
- bb75f17
- Parents:
- 661b744
- Location:
- bootscripts/lfs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
bootscripts/lfs/lib/services/init-functions
r661b744 rbd899fb 68 68 WARNING_PREFIX="${WARNING} *** ${NORMAL}" 69 69 70 SUCCESS_SUFFIX="${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" 71 FAILURE_SUFFIX="${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" 72 WARNING_SUFFIX="${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}" 73 70 74 BOOTLOG=/run/var/bootlog 71 75 KILLDELAY=3 … … 568 572 { 569 573 echo -n -e "${BMPREFIX}${@}" 570 echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${ BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"574 echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${SUCCESS_SUFFIX}" 571 575 572 576 # Strip non-printable characters from log file … … 582 586 { 583 587 echo -n -e "${BMPREFIX}${@}" 584 echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${ BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"588 echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${SUCCESS_SUFFIX}" 585 589 586 590 echo " OK" >> ${BOOTLOG} … … 603 607 { 604 608 echo -n -e "${BMPREFIX}${@}" 605 echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${ BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"609 echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${FAILURE_SUFFIX}" 606 610 607 611 # Strip non-printable characters from log file … … 617 621 { 618 622 echo -n -e "${BMPREFIX}${@}" 619 echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${ BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"623 echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${FAILURE_SUFFIX}" 620 624 621 625 echo "FAIL" >> ${BOOTLOG} … … 636 640 { 637 641 echo -n -e "${BMPREFIX}${@}" 638 echo -e "${CURS_ZERO}${WARNING_PREFIX}${SET_COL}${ BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"642 echo -e "${CURS_ZERO}${WARNING_PREFIX}${SET_COL}${WARNING_SUFFIX}" 639 643 640 644 # Strip non-printable characters from log file -
bootscripts/lfs/lib/services/ipv4-static
r661b744 rbd899fb 43 43 case "${2}" in 44 44 up) 45 if [ "$(ip addr show ${1} | grep ${IP})" == "" ]; then 46 log_info_msg2 "\n" # Terminate the previous message 45 if [ "$(ip addr show ${1} 2>/dev/null | grep ${IP})" == "" ]; then 46 47 # Cosmetic output not needed for multiple services 48 if ! $(echo ${SERVICE} | grep -q " "); then 49 log_info_msg2 "\n" # Terminate the previous message 50 fi 51 47 52 log_info_msg "Adding IPv4 address ${IP} to the ${1} interface..." 48 53 ip addr add ${args} dev ${1} … … 65 70 66 71 down) 67 if [ "$(ip addr show ${1} | grep ${IP})" != "" ]; then72 if [ "$(ip addr show ${1} 2>/dev/null | grep ${IP})" != "" ]; then 68 73 log_info_msg "Removing IPv4 address ${IP} from the ${1} interface..." 69 74 ip addr del ${args} dev ${1} … … 73 78 if [ -n "${GATEWAY}" ]; then 74 79 # Only remove the gateway if ther are no remaining ipv4 addresses 75 if [ "$(ip addr show ${1} | grep 'inet ')" != "" ]; then80 if [ "$(ip addr show ${1} 2>/dev/null | grep 'inet ')" != "" ]; then 76 81 log_info_msg "Removing default gateway..." 77 82 ip route del default -
bootscripts/lfs/sbin/ifdown
r661b744 rbd899fb 68 68 fi 69 69 70 # This will run the service script, if SERVICE is set 71 if [ -n "${SERVICE}" -a -x "/lib/services/${SERVICE}" ]; then 72 if ip link show ${IFACE} > /dev/null 2>&1; then 73 IFCONFIG=${file} /lib/services/${SERVICE} ${IFACE} down 74 else 75 log_warning_msg "Interface ${1} doesn't exist." 76 echo_warning 77 fi 70 # Reverse the order 71 SERVICES= 72 for S in ${SERVICE}; do SERVICES="${SERVICES} ${S}"; done 73 74 # This will run the service scripts 75 if ip link show ${IFACE} > /dev/null 2>&1; then 76 for S in ${SERVICES}; do 77 78 if [ -n "${S}" -a -x "/lib/services/${S}" ]; then 79 IFCONFIG=${file} /lib/services/${S} ${IFACE} down 80 else 81 MSG="Unable to process ${file}. Either " 82 MSG="${MSG}the SERVICE variable was not set " 83 MSG="${MSG}or the specified service cannot be executed." 84 log_failure_msg "$MSG" 85 exit 1 86 fi 87 done 78 88 else 79 MSG="Unable to process ${file}. Either " 80 MSG="${MSG}the SERVICE variable was not set" 81 MSG="${MSG}or the specified service cannot be executed." 82 log_failure_msg "$MSG" 83 exit 1 89 log_warning_msg "Interface ${1} doesn't exist." 84 90 fi 85 91 -
bootscripts/lfs/sbin/ifup
r661b744 rbd899fb 56 56 . /lib/lsb/init-functions 57 57 58 log_info_msg "Bringing up the ${1} interface :"58 log_info_msg "Bringing up the ${1} interface... " 59 59 60 60 if [ ! -r "${file}" ]; then … … 77 77 fi 78 78 79 if [ -n "${SERVICE}" -a -x "/lib/services/${SERVICE}" ]; then 80 if [ -z "${CHECK_LINK}" -o \ 81 "${CHECK_LINK}" = "y" -o \ 82 "${CHECK_LINK}" = "yes" -o \ 83 "${CHECK_LINK}" = "1" ]; then 79 for S in ${SERVICES}; do 80 if [ ! -n "${S}" -o ! -x "/lib/services/${S}" ]; then 81 MSG="\nUnable to process ${file}. Either " 82 MSG="${MSG}the SERVICE variable was not set " 83 MSG="${MSG}or the specified service cannot be executed." 84 log_failure_msg "$MSG" 85 exit 1 86 fi 87 done 84 88 85 # Bring up the interface 86 if ip link show ${IFACE} > /dev/null 2>&1; then 87 link_status=`ip link show ${IFACE}` 89 if [ -z "${CHECK_LINK}" -o \ 90 "${CHECK_LINK}" = "y" -o \ 91 "${CHECK_LINK}" = "yes" -o \ 92 "${CHECK_LINK}" = "1" ]; then 88 93 89 if [ -n "${link_status}" ]; then 90 if ! echo "${link_status}" | grep -q UP; then 91 ip link set ${IFACE} up 92 fi 94 # Bring up the interface 95 if ip link show ${IFACE} > /dev/null 2>&1; then 96 link_status=`ip link show ${IFACE}` 97 98 if [ -n "${link_status}" ]; then 99 if ! echo "${link_status}" | grep -q UP; then 100 ip link set ${IFACE} up 93 101 fi 102 fi 94 103 95 96 97 fi104 else 105 log_warning_msg "\nInterface ${IFACE} doesn't exist." 106 exit 0 98 107 fi 99 100 IFCONFIG=${file} /lib/services/${SERVICE} ${IFACE} up101 102 else103 MSG="\nUnable to process ${file}. Either "104 MSG="${MSG}the SERVICE variable was not set "105 MSG="${MSG}or the specified service cannot be executed."106 log_failure_msg "$MSG"107 exit 1108 108 fi 109 109 110 for S in ${SERVICE}; do 111 IFCONFIG=${file} /lib/services/${S} ${IFACE} up 112 done 113 110 114 # End /sbin/ifup
Note:
See TracChangeset
for help on using the changeset viewer.