clfs-1.2
clfs-2.1
clfs-3.0.0-systemd
clfs-3.0.0-sysvinit
systemd
sysvinit
Last change
on this file since 7675a06 was 163a6701, checked in by Jim Gifford <clfs@…>, 19 years ago |
r720@server (orig r718): jim | 2005-11-18 08:06:26 -0800
Added bootscripts to cross-lfs svn
|
-
Property mode
set to
100644
|
File size:
1.7 KB
|
Line | |
---|
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 |
|
---|
19 | case "${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 | ;;
|
---|
46 | esac
|
---|
47 |
|
---|
48 | if [ -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}"
|
---|
63 | fi
|
---|
64 |
|
---|
65 | if [ -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}"
|
---|
72 | fi
|
---|
73 |
|
---|
74 | case "${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 | ;;
|
---|
91 | esac
|
---|
92 |
|
---|
93 | # End $network_devices/services/ipv4-static-route
|
---|
Note:
See
TracBrowser
for help on using the repository browser.