Changeset bd899fb for bootscripts


Ignore:
Timestamp:
01/27/2012 08:39:49 PM (12 years ago)
Author:
Bruce Dubbs <bdubbs@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 7.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
Message:

Update scripts to support BLFS bridge devices.
Cosmetic cleanups

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

Location:
bootscripts/lfs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bootscripts/lfs/lib/services/init-functions

    r661b744 rbd899fb  
    6868WARNING_PREFIX="${WARNING} *** ${NORMAL}"
    6969
     70SUCCESS_SUFFIX="${BRACKET}[${SUCCESS}  OK  ${BRACKET}]${NORMAL}"
     71FAILURE_SUFFIX="${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
     72WARNING_SUFFIX="${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"
     73
    7074BOOTLOG=/run/var/bootlog
    7175KILLDELAY=3
     
    568572{
    569573    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}"
    571575
    572576    # Strip non-printable characters from log file
     
    582586{
    583587    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}"
    585589
    586590    echo " OK" >> ${BOOTLOG}
     
    603607{
    604608    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}"
    606610
    607611    # Strip non-printable characters from log file
     
    617621{
    618622    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}"
    620624
    621625    echo "FAIL" >> ${BOOTLOG}
     
    636640{
    637641    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}"
    639643
    640644    # Strip non-printable characters from log file
  • bootscripts/lfs/lib/services/ipv4-static

    r661b744 rbd899fb  
    4343case "${2}" in
    4444   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         
    4752         log_info_msg "Adding IPv4 address ${IP} to the ${1} interface..."
    4853         ip addr add ${args} dev ${1}
     
    6570
    6671   down)
    67       if [ "$(ip addr show ${1} | grep ${IP})" != "" ]; then
     72      if [ "$(ip addr show ${1} 2>/dev/null | grep ${IP})" != "" ]; then
    6873         log_info_msg "Removing IPv4 address ${IP} from the ${1} interface..."
    6974         ip addr del ${args} dev ${1}
     
    7378      if [ -n "${GATEWAY}" ]; then
    7479         # Only remove the gateway if ther are no remaining ipv4 addresses
    75          if [ "$(ip addr show ${1} | grep 'inet ')" != "" ]; then
     80         if [ "$(ip addr show ${1} 2>/dev/null | grep 'inet ')" != "" ]; then
    7681            log_info_msg "Removing default gateway..."
    7782            ip route del default
  • bootscripts/lfs/sbin/ifdown

    r661b744 rbd899fb  
    6868fi
    6969
    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
     71SERVICES=
     72for S in ${SERVICE}; do SERVICES="${SERVICES} ${S}"; done
     73
     74# This will run the service scripts
     75if 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
    7888else
    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."
    8490fi
    8591
  • bootscripts/lfs/sbin/ifup

    r661b744 rbd899fb  
    5656. /lib/lsb/init-functions
    5757
    58 log_info_msg "Bringing up the ${1} interface: "
     58log_info_msg "Bringing up the ${1} interface... "
    5959
    6060if [ ! -r "${file}" ]; then
     
    7777fi
    7878
    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
     79for 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
     87done
    8488
    85       #  Bring up the interface
    86       if ip link show ${IFACE} > /dev/null 2>&1; then
    87          link_status=`ip link show ${IFACE}`
     89if [ -z "${CHECK_LINK}"         -o \
     90        "${CHECK_LINK}" = "y"   -o \
     91        "${CHECK_LINK}" = "yes" -o \
     92        "${CHECK_LINK}" = "1" ]; then
    8893
    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
    93101         fi
     102      fi
    94103
    95       else
    96          log_warning_msg "\nInterface ${IFACE} doesn't exist."
    97       fi
     104   else
     105      log_warning_msg "\nInterface ${IFACE} doesn't exist."
     106      exit 0
    98107   fi
    99 
    100    IFCONFIG=${file} /lib/services/${SERVICE} ${IFACE} up
    101 
    102 else
    103    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 1
    108108fi
    109109
     110for S in ${SERVICE}; do
     111  IFCONFIG=${file} /lib/services/${S} ${IFACE} up
     112done
     113
    110114# End /sbin/ifup
Note: See TracChangeset for help on using the changeset viewer.