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
12.2
12.2-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/loongarch-12.2
xry111/mips64el
xry111/multilib
xry111/pip3
xry111/rust-wip-20221008
xry111/update-glibc
Line | |
---|
1 | #!/bin/sh
|
---|
2 | ########################################################################
|
---|
3 | # Begin /lib/boot/ipv4-static-route
|
---|
4 | #
|
---|
5 | # Description : IPV4 Static Route Script
|
---|
6 | #
|
---|
7 | # Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org
|
---|
8 | # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
---|
9 | #
|
---|
10 | # Version : LFS 7.0
|
---|
11 | #
|
---|
12 | ########################################################################
|
---|
13 |
|
---|
14 | . /lib/boot/functions
|
---|
15 | . ${IFCONFIG}
|
---|
16 |
|
---|
17 | case "${TYPE}" in
|
---|
18 | ("" | "network")
|
---|
19 | need_ip=1
|
---|
20 | need_gateway=1
|
---|
21 | ;;
|
---|
22 |
|
---|
23 | ("default")
|
---|
24 | need_gateway=1
|
---|
25 | args="${args} default"
|
---|
26 | desc="default"
|
---|
27 | ;;
|
---|
28 |
|
---|
29 | ("host")
|
---|
30 | need_ip=1
|
---|
31 | ;;
|
---|
32 |
|
---|
33 | ("unreachable")
|
---|
34 | need_ip=1
|
---|
35 | args="${args} unreachable"
|
---|
36 | desc="unreachable "
|
---|
37 | ;;
|
---|
38 |
|
---|
39 | (*)
|
---|
40 | boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
|
---|
41 | echo_failure
|
---|
42 | exit 1
|
---|
43 | ;;
|
---|
44 | esac
|
---|
45 |
|
---|
46 | if [ -n "${need_ip}" ]; then
|
---|
47 | if [ -z "${IP}" ]; then
|
---|
48 | boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
|
---|
49 | echo_failure
|
---|
50 | exit 1
|
---|
51 | fi
|
---|
52 |
|
---|
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}"
|
---|
61 | fi
|
---|
62 |
|
---|
63 | if [ -n "${need_gateway}" ]; then
|
---|
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}"
|
---|
70 | fi
|
---|
71 |
|
---|
72 | if [ -n "${SOURCE}" ]; then
|
---|
73 | args="${args} src ${SOURCE}"
|
---|
74 | fi
|
---|
75 |
|
---|
76 | case "${2}" in
|
---|
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 | ;;
|
---|
93 | esac
|
---|
94 |
|
---|
95 | # End /bib/boot/ipv4-static-route
|
---|
Note:
See
TracBrowser
for help on using the repository browser.