OSDN Git Service

Update to 3.8
[linuxjf/JF.git] / docs / LFS-BOOK / scripts / apds28.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4   <head>
5     <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
6     <title>
7       D.28. /etc/sysconfig/network-devices/services/ipv4-static-route
8     </title>
9     <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" />
10     <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
11     <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
12     "text/css" media="print" />
13   </head>
14   <body class="lfs" id="lfs-6.8">
15     <div class="navheader">
16       <h4>
17         Linux From Scratch - Version 6.8
18       </h4>
19       <h3>
20         付録 D. ブートスクリプトと sysconfig スクリプト version-20100627
21       </h3>
22       <ul>
23         <li class="prev">
24           <a accesskey="p" href="apds27.html" title=
25           "/etc/sysconfig/network-devices/services/ipv4-static">前のページ</a>
26           <p>
27             /etc/sysconfig/network-devices/services/ipv4-static
28           </p>
29         </li>
30         <li class="next">
31           <a accesskey="n" href="udev-rules.html" title=
32           "Udev 設定ルール">次のページ</a>
33           <p>
34             Udev 設定ルール
35           </p>
36         </li>
37         <li class="up">
38           <a accesskey="u" href="scripts.html" title=
39           "付録 D. ブートスクリプトと sysconfig スクリプト version-20100627">上に戻る</a>
40         </li>
41         <li class="home">
42           <a accesskey="h" href="../index.html" title=
43           "Linux From Scratch - Version 6.8">ホーム</a>
44         </li>
45       </ul>
46     </div>
47     <div class="wrap" lang="ja" xml:lang="ja">
48       <h1 class="sect1">
49         <a id="ipv4route" name="ipv4route"></a>D.28.
50         /etc/sysconfig/network-devices/services/ipv4-static-route
51       </h1>
52       <pre class="screen">
53 #!/bin/sh
54 ########################################################################
55 # Begin $network_devices/services/ipv4-static-route
56 #
57 # Description : IPV4 Static Route Script
58 #
59 # Authors     : Kevin P. Fleming - kpfleming@linuxfromscratch.org
60 #
61 # Version     : 00.00
62 #
63 # Notes       :
64 #
65 ########################################################################
66
67 . /etc/sysconfig/rc 
68 . ${rc_functions} 
69 . ${IFCONFIG}
70
71 case "${TYPE}" in
72     ("" | "network")
73         need_ip=1
74         need_gateway=1
75     ;;
76
77     ("default")
78         need_gateway=1
79         args="${args} default"
80         desc="default"
81     ;;
82
83     ("host")
84         need_ip=1
85     ;;
86
87     ("unreachable")
88         need_ip=1
89         args="${args} unreachable"
90         desc="unreachable "
91     ;;
92
93     (*)
94         boot_mesg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue." ${FAILURE}
95         echo_failure
96         exit 1
97     ;;
98 esac
99
100 if [ -n "${need_ip}" ]; then
101     if [ -z "${IP}" ]; then
102         boot_mesg "IP variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
103         echo_failure
104         exit 1
105     fi
106
107     if [ -z "${PREFIX}" ]; then
108         boot_mesg "PREFIX variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
109         echo_failure
110         exit 1
111     fi
112     
113     args="${args} ${IP}/${PREFIX}"
114     desc="${desc}${IP}/${PREFIX}"
115 fi
116
117 if [ -n "${need_gateway}" ]; then
118     if [ -z "${GATEWAY}" ]; then
119         boot_mesg "GATEWAY variable missing from ${IFCONFIG}, cannot continue." ${FAILURE}
120         echo_failure
121         exit 1
122     fi
123     args="${args} via ${GATEWAY}"
124 fi
125
126 if [ -n "${SOURCE}" ]; then
127         args="${args} src ${SOURCE}"
128 fi
129
130 case "${2}" in
131     up)
132         boot_mesg "Adding '${desc}' route to the ${1} interface..."
133         ip route add ${args} dev ${1}
134         evaluate_retval
135     ;;
136     
137     down)
138         boot_mesg "Removing '${desc}' route from the ${1} interface..."
139         ip route del ${args} dev ${1}
140         evaluate_retval
141     ;;
142     
143     *)
144         echo "Usage: ${0} [interface] {up|down}"
145         exit 1
146     ;;
147 esac
148
149 # End $network_devices/services/ipv4-static-route
150 </pre>
151     </div>
152     <div class="navfooter">
153       <ul>
154         <li class="prev">
155           <a accesskey="p" href="apds27.html" title=
156           "/etc/sysconfig/network-devices/services/ipv4-static">前のページ</a>
157           <p>
158             /etc/sysconfig/network-devices/services/ipv4-static
159           </p>
160         </li>
161         <li class="next">
162           <a accesskey="n" href="udev-rules.html" title=
163           "Udev 設定ルール">次のページ</a>
164           <p>
165             Udev 設定ルール
166           </p>
167         </li>
168         <li class="up">
169           <a accesskey="u" href="scripts.html" title=
170           "付録 D. ブートスクリプトと sysconfig スクリプト version-20100627">上に戻る</a>
171         </li>
172         <li class="home">
173           <a accesskey="h" href="../index.html" title=
174           "Linux From Scratch - Version 6.8">ホーム</a>
175         </li>
176       </ul>
177     </div>
178   </body>
179 </html>