source: bootscripts/lfs/lib/services/ipv4-static-route@ a44ae577

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 arm bdubbs/gcc13 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
Last change on this file since a44ae577 was a44ae577, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove spaces at end of lines - bootscripts

  • Property mode set to 100755
File size: 2.1 KB
Line 
1#!/bin/sh
2########################################################################
3# Begin /lib/services/ipv4-static-route
4#
5# Description : IPV4 Static Route Script
6#
7# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org
8# DJ Lucas - dj@linuxfromscratch.org
9# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
10#
11# Version : LFS 7.0
12#
13########################################################################
14
15. /lib/lsb/init-functions
16. ${IFCONFIG}
17
18case "${TYPE}" in
19 ("" | "network")
20 need_ip=1
21 need_gateway=1
22 ;;
23
24 ("default")
25 need_gateway=1
26 args="${args} default"
27 desc="default"
28 ;;
29
30 ("host")
31 need_ip=1
32 ;;
33
34 ("unreachable")
35 need_ip=1
36 args="${args} unreachable"
37 desc="unreachable "
38 ;;
39
40 (*)
41 log_failure_msg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue."
42 exit 1
43 ;;
44esac
45
46if [ -n "${GATEWAY}" ]; then
47 MSG="The GATEWAY variable cannot be set in ${IFCONFIG} for static routes.\n"
48 log_failure_msg "$MSG Use STATIC_GATEWAY only, cannot continue"
49 exit 1
50fi
51
52if [ -n "${need_ip}" ]; then
53 if [ -z "${IP}" ]; then
54 log_failure_msg "IP variable missing from ${IFCONFIG}, cannot continue."
55 exit 1
56 fi
57
58 if [ -z "${PREFIX}" ]; then
59 log_failure_msg "PREFIX variable missing from ${IFCONFIG}, cannot continue."
60 exit 1
61 fi
62
63 args="${args} ${IP}/${PREFIX}"
64 desc="${desc}${IP}/${PREFIX}"
65fi
66
67if [ -n "${need_gateway}" ]; then
68 if [ -z "${STATIC_GATEWAY}" ]; then
69 log_failure_msg "STATIC_GATEWAY variable missing from ${IFCONFIG}, cannot continue."
70 exit 1
71 fi
72 args="${args} via ${STATIC_GATEWAY}"
73fi
74
75if [ -n "${SOURCE}" ]; then
76 args="${args} src ${SOURCE}"
77fi
78
79case "${2}" in
80 up)
81 log_info_msg "Adding '${desc}' route to the ${1} interface..."
82 ip route add ${args} dev ${1}
83 evaluate_retval
84 ;;
85
86 down)
87 log_info_msg "Removing '${desc}' route from the ${1} interface..."
88 ip route del ${args} dev ${1}
89 evaluate_retval
90 ;;
91
92 *)
93 echo "Usage: ${0} [interface] {up|down}"
94 exit 1
95 ;;
96esac
97
98# End /lib/services/ipv4-static-route
Note: See TracBrowser for help on using the repository browser.