diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-09-13 15:44:20 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-09-13 15:44:20 +0000 |
commit | d8a93d30ec0f7b9de2d59dab07ac29c6f7f8f663 (patch) | |
tree | f61d8b7d858e07792674c281853167482e6806c5 /etc/rc.d/atm3 | |
parent | 019fd9cb5fe17ed3ce93a28306ec3009d2a512f7 (diff) | |
download | FreeBSD-src-d8a93d30ec0f7b9de2d59dab07ac29c6f7f8f663.zip FreeBSD-src-d8a93d30ec0f7b9de2d59dab07ac29c6f7f8f663.tar.gz |
Apply a consistent style to most of the etc scripts. Particularly, use
case instead of test where appropriate, since case allows case is a sh
builtin and (as a side-effect) allows case-insensitivity.
Changes discussed on freebsd-hackers.
Submitted by: Doug Barton <Doug@gorean.org>
Diffstat (limited to 'etc/rc.d/atm3')
-rw-r--r-- | etc/rc.d/atm3 | 283 |
1 files changed, 152 insertions, 131 deletions
diff --git a/etc/rc.d/atm3 b/etc/rc.d/atm3 index 57ff149..7e72aeb 100644 --- a/etc/rc.d/atm3 +++ b/etc/rc.d/atm3 @@ -10,87 +10,99 @@ # N.B. /usr is not mounted. # atm_pass1() { - # Locate all probed ATM adapters - atmdev=`atm sh stat int | while read dev junk; do - case ${dev} in - hea[0-9]|hea[0-9][0-9]) - echo "${dev} " - ;; - hfa[0-9]|hfa[0-9][0-9]) - echo "${dev} " - ;; - *) - continue - ;; - esac - done` - - if [ -z "${atmdev}" ]; then - echo "No ATM adapters found." - return 0 - fi - - # Load microcode into FORE adapters (if needed) - if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then - fore_dnld -d /etc - fi - - # Configure physical interfaces - ilmid=0 - for phy in ${atmdev}; do - echo -n "Configuring ATM device ${phy}:" - - # Define network interfaces - eval netif_args=\$atm_netif_${phy} - if [ -n "${netif_args}" ]; then - atm set netif ${phy} ${netif_args} || continue - else - echo "missing network interface definition" - continue - fi + # Locate all probed ATM adapters + atmdev=`atm sh stat int | while read dev junk; do + case ${dev} in + hea[0-9] | hea[0-9][0-9]) + echo "${dev} " + ;; + hfa[0-9] | hfa[0-9][0-9]) + echo "${dev} " + ;; + *) + continue + ;; + esac + done` - # Override physical MAC address - eval macaddr_args=\$atm_macaddr_${phy} - if [ -n "${macaddr_args}" -a "${macaddr_args}" != "NO" ]; then - atm set mac ${phy} ${macaddr_args} || continue + if [ -z "${atmdev}" ]; then + echo "No ATM adapters found." + return 0 fi - # Configure signalling manager - eval sigmgr_args=\$atm_sigmgr_${phy} - if [ -n "${sigmgr_args}" ]; then - atm attach ${phy} ${sigmgr_args} || continue - else - echo "missing signalling manager definition" - continue + # Load microcode into FORE adapters (if needed) + if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then + fore_dnld -d /etc fi - # Configure UNI NSAP prefix - eval prefix_args=\$atm_prefix_${phy} - if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then - if [ -z "${prefix_args}" ]; then - echo "missing NSAP prefix for UNI interface" + # Configure physical interfaces + ilmid=0 + for phy in ${atmdev}; do + echo -n "Configuring ATM device ${phy}:" + + # Define network interfaces + eval netif_args=\$atm_netif_${phy} + if [ -n "${netif_args}" ]; then + atm set netif ${phy} ${netif_args} || continue + else + echo "missing network interface definition" continue fi - if [ "${prefix_args}" = "ILMI" ]; then - ilmid=1 + + # Override physical MAC address + eval macaddr_args=\$atm_macaddr_${phy} + if [ -n "${macaddr_args}" ]; then + case ${macaddr_args} in + [Nn][Oo] | '') + ;; + *) + atm set mac ${phy} ${macaddr_args} || continue + ;; + esac + fi + + # Configure signalling manager + eval sigmgr_args=\$atm_sigmgr_${phy} + if [ -n "${sigmgr_args}" ]; then + atm attach ${phy} ${sigmgr_args} || continue else - atm set prefix ${phy} ${prefix_args} || continue + echo "missing signalling manager definition" + continue fi - fi - atm_phy="${atm_phy} ${phy}" - echo "." - done + # Configure UNI NSAP prefix + eval prefix_args=\$atm_prefix_${phy} + if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then + if [ -z "${prefix_args}" ]; then + echo "missing NSAP prefix for UNI interface" + continue + fi + + case ${prefix_args} in + ILMI) + ilmid=1 + ;; + *) + atm set prefix ${phy} ${prefix_args} || continue + ;; + esac + fi - echo -n "Starting initial ATM daemons:" - # Start ILMI daemon (if needed) - if [ ${ilmid} -eq 1 ]; then - echo -n " ilmid" - ilmid - fi + atm_phy="${atm_phy} ${phy}" + echo "." + done - echo "." - atm_pass1_done=YES + echo -n "Starting initial ATM daemons:" + # Start ILMI daemon (if needed) + case ${ilmid} in + 1) + echo -n " ilmid" + ilmid + ;; + esac + + echo "." + atm_pass1_done=YES } # @@ -98,75 +110,84 @@ atm_pass1() { # N.B. /usr is not mounted. # atm_pass2() { - echo -n "Configuring ATM network interfaces:" - - atm_scspd=0 - atm_atmarpd="" - - # Configure network interfaces - for phy in ${atm_phy}; do - eval netif_args=\$atm_netif_${phy} - set -- ${netif_args} - netname=$1 - netcnt=$2 - netindx=0 - while [ ${netindx} -lt ${netcnt} ]; do - - net="${netname}${netindx}" - netindx=`expr ${netindx} + 1` - echo -n " ${net}" - - # Configure atmarp server - eval atmarp_args=\$atm_arpserver_${net} - if [ -n "${atmarp_args}" ]; then - atm set arpserver ${net} ${atmarp_args} || continue - fi - eval scsparp_args=\$atm_scsparp_${net} - if [ "${scsparp_args}" = "YES" ]; then - if [ "${atmarp_args}" != "local" ]; then - echo "local arpserver required for SCSP" - continue + echo -n "Configuring ATM network interfaces:" + + atm_scspd=0 + atm_atmarpd="" + + # Configure network interfaces + for phy in ${atm_phy}; do + eval netif_args=\$atm_netif_${phy} + set -- ${netif_args} + netname=$1 + netcnt=$2 + netindx=0 + while [ ${netindx} -lt ${netcnt} ]; do + net="${netname}${netindx}" + netindx=`expr ${netindx} + 1` + echo -n " ${net}" + + # Configure atmarp server + eval atmarp_args=\$atm_arpserver_${net} + if [ -n "${atmarp_args}" ]; then + atm set arpserver ${net} ${atmarp_args} || + continue fi - atm_atmarpd="${atm_atmarpd} ${net}" - atm_scspd=1 - fi + eval scsparp_args=\$atm_scsparp_${net} + + case ${scsparp_args} in + [Yy][Ee][Ss]) + case ${atmarp_args} in + local) + ;; + *) + echo "local arpserver required for SCSP" + continue + ;; + esac + + atm_atmarpd="${atm_atmarpd} ${net}" + atm_scspd=1 + esac + done done - done - echo "." - - # Define any PVCs. - if [ -n "${atm_pvcs}" ]; then - for i in ${atm_pvcs}; do - eval pvc_args=\$atm_pvc_${i} - atm add pvc ${pvc_args} - done - fi + echo "." - # Define any permanent ARP entries. - if [ -n "${atm_arps}" ]; then - for i in ${atm_arps}; do - eval arp_args=\$atm_arp_${i} - atm add arp ${arp_args} - done - fi - atm_pass2_done=YES + # Define any PVCs. + if [ -n "${atm_pvcs}" ]; then + for i in ${atm_pvcs}; do + eval pvc_args=\$atm_pvc_${i} + atm add pvc ${pvc_args} + done + fi + + # Define any permanent ARP entries. + if [ -n "${atm_arps}" ]; then + for i in ${atm_arps}; do + eval arp_args=\$atm_arp_${i} + atm add arp ${arp_args} + done + fi + atm_pass2_done=YES } # # Start any necessary daemons. # atm_pass3() { - # Start SCSP daemon (if needed) - if [ "${atm_scspd}" -eq 1 ]; then - echo -n " scspd" - scspd - fi - - # Start ATMARP daemon (if needed) - if [ -n "${atm_atmarpd}" ]; then - echo -n " atmarpd" - atmarpd ${atm_atmarpd} - fi - - atm_pass3_done=YES + # Start SCSP daemon (if needed) + case ${atm_scspd} in + 1) + echo -n " scspd" + scspd + ;; + esac + + # Start ATMARP daemon (if needed) + if [ -n "${atm_atmarpd}" ]; then + echo -n " atmarpd" + atmarpd ${atm_atmarpd} + fi + + atm_pass3_done=YES } |