Ignore:
Timestamp:
08/02/2011 02:15:42 AM (13 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.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
Message:

Rewrite bootscripts and Chaper 7

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bootscripts/lfs/sysconfig/network-devices/services/ipv4-static-route

    r75fe599 r0cda898  
    11#!/bin/sh
    22########################################################################
    3 # Begin $network_devices/services/ipv4-static-route
     3# Begin /lib/boot/ipv4-static-route
    44#
    55# Description : IPV4 Static Route Script
    66#
    77# Authors     : Kevin P. Fleming - kpfleming@linuxfromscratch.org
     8# Update      : Bruce Dubbs - bdubbs@linuxfromscratch.org
    89#
    9 # Version     : 00.00
    10 #
    11 # Notes       :
     10# Version     : LFS 7.0
    1211#
    1312########################################################################
    1413
    15 . /etc/sysconfig/rc
    16 . ${rc_functions}
     14. /lib/boot/functions
    1715. ${IFCONFIG}
    1816
    1917case "${TYPE}" in
    20         ("" | "network")
    21                 need_ip=1
    22                 need_gateway=1
    23         ;;
     18   ("" | "network")
     19      need_ip=1
     20      need_gateway=1
     21   ;;
    2422
    25         ("default")
    26                 need_gateway=1
    27                 args="${args} default"
    28                 desc="default"
    29         ;;
     23   ("default")
     24      need_gateway=1
     25      args="${args} default"
     26      desc="default"
     27   ;;
    3028
    31         ("host")
    32                 need_ip=1
    33         ;;
     29   ("host")
     30      need_ip=1
     31   ;;
    3432
    35         ("unreachable")
    36                 need_ip=1
    37                 args="${args} unreachable"
    38                 desc="unreachable "
    39         ;;
     33   ("unreachable")
     34      need_ip=1
     35      args="${args} unreachable"
     36      desc="unreachable "
     37   ;;
    4038
    41         (*)
    42                 boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
    43                 echo_failure
    44                 exit 1
    45         ;;
     39   (*)
     40      boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
     41      echo_failure
     42      exit 1
     43   ;;
    4644esac
    4745
    4846if [ -n "${need_ip}" ]; then
    49         if [ -z "${IP}" ]; then
    50                 boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
    51                 echo_failure
    52                 exit 1
    53         fi
     47   if [ -z "${IP}" ]; then
     48      boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
     49      echo_failure
     50      exit 1
     51   fi
    5452
    55         if [ -z "${PREFIX}" ]; then
    56                 boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
    57                 echo_failure
    58                 exit 1
    59         fi
    60        
    61         args="${args} ${IP}/${PREFIX}"
    62         desc="${desc}${IP}/${PREFIX}"
     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}"
    6361fi
    6462
    6563if [ -n "${need_gateway}" ]; then
    66         if [ -z "${GATEWAY}" ]; then
    67                 boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
    68                 echo_failure
    69                 exit 1
    70         fi
    71         args="${args} via ${GATEWAY}"
     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}"
    7270fi
    7371
     
    7775
    7876case "${2}" in
    79         up)
    80                 boot_mesg "Adding '${desc}' route to the ${1} interface..."
    81                 ip route add ${args} dev ${1}
    82                 evaluate_retval
    83         ;;
    84        
    85         down)
    86                 boot_mesg "Removing '${desc}' route from the ${1} interface..."
    87                 ip route del ${args} dev ${1}
    88                 evaluate_retval
    89         ;;
    90        
    91         *)
    92                 echo "Usage: ${0} [interface] {up|down}"
    93                 exit 1
    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   ;;
    9593esac
    9694
    97 # End $network_devices/services/ipv4-static-route
     95# End /bib/boot/ipv4-static-route
Note: See TracChangeset for help on using the changeset viewer.