author | Florian Pose <fp@igh-essen.com> |
Tue, 27 Jun 2006 19:33:04 +0000 | |
changeset 288 | 89d3c61ef3e6 |
parent 285 | d6145fc87a74 |
child 289 | 3c121228ebe9 |
permissions | -rwxr-xr-x |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
#!/bin/sh |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
#------------------------------------------------------------------------------ |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
# |
247
d1f0cff6f57f
Minor changes in init script.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
5 |
# Init script for EtherCAT |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
# |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
# $Id$ |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
# |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
9 |
# Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
10 |
# |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
11 |
# This file is part of the IgH EtherCAT Master. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
12 |
# |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
13 |
# The IgH EtherCAT Master is free software; you can redistribute it |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
14 |
# and/or modify it under the terms of the GNU General Public License |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
15 |
# as published by the Free Software Foundation; either version 2 of the |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
16 |
# License, or (at your option) any later version. |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
17 |
# |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
18 |
# The IgH EtherCAT Master is distributed in the hope that it will be |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
19 |
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
20 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
21 |
# GNU General Public License for more details. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
22 |
# |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
23 |
# You should have received a copy of the GNU General Public License |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
24 |
# along with the IgH EtherCAT Master; if not, write to the Free Software |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
25 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
174
diff
changeset
|
26 |
# |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
27 |
# The right to use EtherCAT Technology is granted and comes free of |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
28 |
# charge under condition of compatibility of product made by |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
29 |
# Licensee. People intending to distribute/sell products based on the |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
30 |
# code, have to sign an agreement to guarantee that products using |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
31 |
# software based on IgH EtherCAT master stay compatible with the actual |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
32 |
# EtherCAT specification (which are released themselves as an open |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
33 |
# standard) as the (only) precondition to have the right to use EtherCAT |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
34 |
# Technology, IP and trade marks. |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
245
diff
changeset
|
35 |
# |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
#------------------------------------------------------------------------------ |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
|
243 | 38 |
### BEGIN INIT INFO |
248
f5e94773472d
Minor changes in init script 2.
Florian Pose <fp@igh-essen.com>
parents:
247
diff
changeset
|
39 |
# Provides: ethercat |
245
100a0c3f5e6e
Added dependencies to RC script.
Florian Pose <fp@igh-essen.com>
parents:
244
diff
changeset
|
40 |
# Required-Start: $local_fs $syslog $network |
100a0c3f5e6e
Added dependencies to RC script.
Florian Pose <fp@igh-essen.com>
parents:
244
diff
changeset
|
41 |
# Should-Start: $time |
100a0c3f5e6e
Added dependencies to RC script.
Florian Pose <fp@igh-essen.com>
parents:
244
diff
changeset
|
42 |
# Required-Stop: $local_fs $syslog $network |
100a0c3f5e6e
Added dependencies to RC script.
Florian Pose <fp@igh-essen.com>
parents:
244
diff
changeset
|
43 |
# Should-Stop: $time |
243 | 44 |
# Default-Start: 3 5 |
45 |
# Default-Stop: 0 1 2 6 |
|
247
d1f0cff6f57f
Minor changes in init script.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
46 |
# Short-Description: IgH EtherCAT master modules |
243 | 47 |
# Description: |
48 |
### END INIT INFO |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
#------------------------------------------------------------------------------ |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
|
243 | 52 |
ETHERCAT_CONFIG=/etc/sysconfig/ethercat |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
|
243 | 54 |
test -r $ETHERCAT_CONFIG || { echo "$ETHERCAT_CONFIG not existing"; |
55 |
if [ "$1" = "stop" ]; then exit 0; |
|
56 |
else exit 6; fi; } |
|
57 |
||
58 |
. $ETHERCAT_CONFIG |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
#------------------------------------------------------------------------------ |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
|
243 | 62 |
. /etc/rc.status |
63 |
rc_reset |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
|
243 | 65 |
case "$1" in |
66 |
start) |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
67 |
echo -n "Starting EtherCAT master " |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
68 |
|
283
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
69 |
if [ -z "$DEVICE_INDEX" ]; then |
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
70 |
echo "ERROR: DEVICE_INDEX not set!" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
71 |
/bin/false |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
72 |
rc_status -v |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
73 |
rc_exit |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
74 |
fi |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
|
283
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
76 |
if [ -z "$EOE_DEVICES" ]; then |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
77 |
EOE_DEVICES=0 |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
78 |
fi |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
79 |
|
243 | 80 |
for mod in 8139too 8139cp; do |
81 |
if lsmod | grep "^$mod " > /dev/null; then |
|
82 |
if ! rmmod $mod; then |
|
83 |
/bin/false |
|
84 |
rc_status -v |
|
85 |
rc_exit |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
86 |
fi |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
87 |
fi |
243 | 88 |
done |
174
99907332ff1e
Restart action in RC script
Florian Pose <fp@igh-essen.com>
parents:
169
diff
changeset
|
89 |
|
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
90 |
if ! modprobe ec_master ec_eoe_devices=$EOE_DEVICES; then |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
91 |
/bin/false |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
92 |
rc_status -v |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
93 |
rc_exit |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
94 |
fi |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
95 |
|
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
96 |
if ! modprobe ec_8139too ec_device_index=$DEVICE_INDEX; then |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
97 |
/bin/false |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
98 |
rc_status -v |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
99 |
rc_exit |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
100 |
fi |
174
99907332ff1e
Restart action in RC script
Florian Pose <fp@igh-essen.com>
parents:
169
diff
changeset
|
101 |
|
283
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
102 |
# Build EoE bridge |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
103 |
if [ -n "$EOE_BRIDGE" ]; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
104 |
|
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
105 |
EOE_INTERFACES=`/sbin/ifconfig -a | grep -o -E "^eoe[0-9]+ "` |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
106 |
|
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
107 |
# add bridge, if it does not already exist |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
108 |
if ! /sbin/brctl show | grep -E -q "^$EOE_BRIDGE"; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
109 |
if ! /sbin/brctl addbr $EOE_BRIDGE; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
110 |
/bin/false |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
111 |
rc_status -v |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
112 |
rc_exit |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
113 |
fi |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
114 |
fi |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
115 |
|
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
116 |
# free all interfaces of their addresses and add them to the bridge |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
117 |
for interface in $EOE_INTERFACES $EOE_EXTRA_INTERFACES; do |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
118 |
if ! /sbin/ifconfig $interface 0.0.0.0 up; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
119 |
/bin/false |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
120 |
rc_status -v |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
121 |
rc_exit |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
122 |
fi |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
123 |
if ! /sbin/brctl show | grep -E -q "^$EOE_BRIDGE.*$interface"; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
124 |
if ! /sbin/brctl addif $EOE_BRIDGE $interface; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
125 |
/bin/false |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
126 |
rc_status -v |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
127 |
rc_exit |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
128 |
fi |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
129 |
fi |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
130 |
done |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
131 |
if [ -n "$EOE_IP_ADDRESS" -a -n "$EOE_IP_NETMASK" ]; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
132 |
if ! /sbin/ifconfig $EOE_BRIDGE $EOE_IP_ADDRESS \ |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
133 |
netmask $EOE_IP_NETMASK; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
134 |
/bin/false |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
135 |
rc_status -v |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
136 |
rc_exit |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
137 |
fi |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
138 |
fi |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
139 |
if ! /sbin/ifconfig $EOE_BRIDGE up; then |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
140 |
/bin/false |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
141 |
rc_status -v |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
142 |
rc_exit |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
143 |
fi |
285
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
144 |
|
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
145 |
# install new default gateway |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
146 |
if [ -n "$EOE_GATEWAY" ]; then |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
147 |
while /sbin/route -n | grep -E -q "^0.0.0.0"; do |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
148 |
if ! /sbin/route del default; then |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
149 |
echo "Failed to remove default route!" 1>&2 |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
150 |
/bin/false |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
151 |
rc_status -v |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
152 |
rc_exit |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
153 |
fi |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
154 |
done |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
155 |
if ! /sbin/route add default gw $EOE_GATEWAY; then |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
156 |
/bin/false |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
157 |
rc_status -v |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
158 |
rc_exit |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
159 |
fi |
d6145fc87a74
EoE bridge default gateway.
Florian Pose <fp@igh-essen.com>
parents:
283
diff
changeset
|
160 |
fi |
283
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
161 |
fi |
a480a0703c58
Configuring EoE bridge at startup.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
162 |
|
243 | 163 |
rc_status -v |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
;; |
174
99907332ff1e
Restart action in RC script
Florian Pose <fp@igh-essen.com>
parents:
169
diff
changeset
|
165 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
stop) |
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
167 |
echo -n "Shutting down EtherCAT master " |
243 | 168 |
|
169 |
for mod in ec_8139too ec_master; do |
|
170 |
if lsmod | grep "^$mod " > /dev/null; then |
|
171 |
if ! rmmod $mod; then |
|
172 |
/bin/false |
|
173 |
rc_status -v |
|
174 |
rc_exit |
|
175 |
fi; |
|
176 |
fi; |
|
177 |
done |
|
178 |
||
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
if ! modprobe 8139too; then |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
echo "Warning: Failed to restore 8139too module." |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
fi |
243 | 182 |
|
183 |
rc_status -v |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
;; |
174
99907332ff1e
Restart action in RC script
Florian Pose <fp@igh-essen.com>
parents:
169
diff
changeset
|
185 |
|
243 | 186 |
restart) |
187 |
$0 stop |
|
188 |
$0 start |
|
189 |
||
190 |
rc_status |
|
191 |
;; |
|
244
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
192 |
|
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
193 |
status) |
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
248
diff
changeset
|
194 |
echo -n "Checking for EtherCAT " |
244
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
195 |
|
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
196 |
lsmod | grep "^ec_master " > /dev/null |
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
197 |
master_running=$? |
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
198 |
lsmod | grep "^ec_8139too " > /dev/null |
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
199 |
device_running=$? |
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
200 |
test $master_running -eq 0 -a $device_running -eq 0 |
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
201 |
|
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
202 |
rc_status -v |
c302a846ab12
Added status function to RC script.
Florian Pose <fp@igh-essen.com>
parents:
243
diff
changeset
|
203 |
;; |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
esac |
243 | 205 |
rc_exit |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
#------------------------------------------------------------------------------ |