source: bootscripts/clfs/sysconfig/network-devices/services/ipv4-static-route@ a4b892f

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since a4b892f was d66bf46, checked in by Jim Gifford <clfs@…>, 18 years ago

Update bootscripts to follow our standards

  • Property mode set to 100644
File size: 1.7 KB
RevLine 
[163a6701]1#!/bin/sh
2########################################################################
3# Begin $network_devices/services/ipv4-static-route
4#
5# Description : IPV4 Static Route Script
6#
7# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org
8#
9# Version : 00.00
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
17. ${IFCONFIG}
18
19case "${TYPE}" in
20 ("" | "network")
21 need_ip=1
22 need_gateway=1
23 ;;
24
25 ("default")
26 need_gateway=1
27 args="${args} default"
28 desc="default"
29 ;;
30
31 ("host")
32 need_ip=1
33 ;;
34
35 ("unreachable")
36 need_ip=1
37 args="${args} unreachable"
38 desc="unreachable "
39 ;;
40
41 (*)
42 boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
43 echo_failure
44 exit 1
45 ;;
46esac
47
48if [ -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
54
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}"
63fi
64
65if [ -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}"
72fi
73
74case "${2}" in
75 up)
76 boot_mesg "Adding '${desc}' route to the ${1} interface..."
77 ip route add ${args} dev ${1}
78 evaluate_retval
79 ;;
80
81 down)
82 boot_mesg "Removing '${desc}' route from the ${1} interface..."
83 ip route del ${args} dev ${1}
84 evaluate_retval
85 ;;
86
87 *)
88 echo "Usage: ${0} [interface] {up|down}"
89 exit 1
90 ;;
91esac
92
93# End $network_devices/services/ipv4-static-route
Note: See TracBrowser for help on using the repository browser.