author | Florian Pose <fp@igh-essen.com> |
Tue, 13 Feb 2007 13:45:36 +0000 | |
branch | stable-1.2 |
changeset 1740 | fa0af75bfbe9 |
child 573 | cdee4ea90ce9 |
child 1744 | 7bc131b92039 |
permissions | -rwxr-xr-x |
1740
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
#!/bin/sh |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
#------------------------------------------------------------------------------ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
# Init script for EtherCAT |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
# $Id$ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
# Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
# This file is part of the IgH EtherCAT Master. |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
# The IgH EtherCAT Master is free software; you can redistribute it |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
# and/or modify it under the terms of the GNU General Public License |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
# as published by the Free Software Foundation; either version 2 of the |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
# License, or (at your option) any later version. |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
# The IgH EtherCAT Master is distributed in the hope that it will be |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
# GNU General Public License for more details. |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
# You should have received a copy of the GNU General Public License |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
# along with the IgH EtherCAT Master; if not, write to the Free Software |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
# The right to use EtherCAT Technology is granted and comes free of |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
# charge under condition of compatibility of product made by |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
# Licensee. People intending to distribute/sell products based on the |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
# code, have to sign an agreement to guarantee that products using |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
# software based on IgH EtherCAT master stay compatible with the actual |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
# EtherCAT specification (which are released themselves as an open |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
# standard) as the (only) precondition to have the right to use EtherCAT |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
# Technology, IP and trade marks. |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
#------------------------------------------------------------------------------ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
### BEGIN INIT INFO |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
# Provides: ethercat |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
# Required-Start: $local_fs $syslog $network |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
# Should-Start: $time ntp |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
# Required-Stop: $local_fs $syslog $network |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
# Should-Stop: $time ntp |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
# Default-Start: 3 5 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
# Default-Stop: 0 1 2 6 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
# Short-Description: IgH EtherCAT master modules |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
# Description: |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
### END INIT INFO |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
#------------------------------------------------------------------------------ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
device="ecxml" |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
IFCONFIG=ifconfig |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
BRCTL=brctl |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
ROUTE=route |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
#------------------------------------------------------------------------------ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
ETHERCAT_CONFIG=/etc/sysconfig/ethercat |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
if [ ! -r $ETHERCAT_CONFIG ]; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
echo "$ETHERCAT_CONFIG not existing"; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
if [ "$1" = "stop" ]; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
exit 0 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
else |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
exit 6 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
. $ETHERCAT_CONFIG |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
#------------------------------------------------------------------------------ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
# Function for setting up the EoE bridge |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
# |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
build_eoe_bridge() |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
{ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
if [ -z "$EOE_BRIDGE" ]; then return; fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
EOEIF=`$IFCONFIG -a | grep -o -E "^eoe[0-9]+ "` |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
# add bridge, if it does not already exist |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
if ! $BRCTL show | grep -E -q "^$EOE_BRIDGE"; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
if ! $BRCTL addbr $EOE_BRIDGE; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
# check if specified interfaces are bridged |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
for interf in $EOEIF $EOE_EXTRA_INTERFACES; do |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
# interface is already part of the bridge (FIXME->show $EOE_BRIDGE) |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
if $BRCTL show | grep -E -q $interf |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
then continue |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
# clear IP address and open interface |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
if ! $IFCONFIG $interf 0.0.0.0 up; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
# add interface to the bridge |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
if ! $BRCTL addif $EOE_BRIDGE $interf; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
done |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
# configure IP on bridge |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
if [ -n "$EOE_IP_ADDRESS" -a -n "$EOE_IP_NETMASK" ]; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
if ! $IFCONFIG $EOE_BRIDGE $EOE_IP_ADDRESS \ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
netmask $EOE_IP_NETMASK; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
# open bridge |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
if ! $IFCONFIG $EOE_BRIDGE up; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
# install new default gateway |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
if [ -n "$EOE_GATEWAY" ]; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
while $ROUTE -n | grep -E -q "^0.0.0.0"; do |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
if ! $ROUTE del default; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
echo "Failed to remove route!" 1>&2 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
done |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
140 |
if ! $ROUTE add default gw $EOE_GATEWAY; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
143 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
144 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
145 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
146 |
} |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
147 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
148 |
#------------------------------------------------------------------------------ |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
149 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
150 |
. /etc/rc.status |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
151 |
rc_reset |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
152 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
153 |
case "$1" in |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
154 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
155 |
start) |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
156 |
echo -n "Starting EtherCAT master " |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
157 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
158 |
if [ -z "$DEVICE_INDEX" ]; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
159 |
echo "ERROR: DEVICE_INDEX not set!" |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
160 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
161 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
162 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
163 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
164 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
165 |
if [ -z "$EOE_INTERFACES" ]; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
166 |
# support legacy sysconfig files |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
167 |
if [ -n "$EOE_DEVICES" ]; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
168 |
EOE_INTERFACES=$EOE_DEVICES |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
169 |
else |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
170 |
EOE_INTERFACES=0 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
# unload conflicting modules at first |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
for mod in 8139too; do |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
if lsmod | grep "^$mod " > /dev/null; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
177 |
if ! rmmod $mod; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
178 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
179 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
done |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
185 |
# load master module |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
186 |
if ! modprobe ec_master ec_eoeif_count=$EOE_INTERFACES; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
modprobe 8139too |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
# remove stale device node |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
194 |
rm -f /dev/${device}0 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
195 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
196 |
# get dynamic major number |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
major=$(awk "\$2==\"EtherCAT\" {print \$1}" /proc/devices) |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
# create character device |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
200 |
mknod /dev/${device}0 c $major 0 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
201 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
202 |
# load device module |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
203 |
if ! modprobe ec_8139too ec_device_index=$DEVICE_INDEX; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
rmmod ec_master |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
modprobe 8139too |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
208 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
209 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
210 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
211 |
# build EoE bridge |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
212 |
build_eoe_bridge |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
213 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
214 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
215 |
;; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
216 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
217 |
stop) |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
218 |
echo -n "Shutting down EtherCAT master " |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
219 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
220 |
# unload modules |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
221 |
for mod in ec_8139too ec_master; do |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
222 |
if lsmod | grep "^$mod " > /dev/null; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
223 |
if ! rmmod $mod; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
224 |
/bin/false |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
225 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
fi; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
228 |
fi; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
229 |
done |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
230 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
231 |
# remove device node |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
232 |
rm -f /dev/${device}0 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
234 |
sleep 1 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
235 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
236 |
# reload previous modules |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
237 |
if ! modprobe 8139too; then |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
238 |
echo "Warning: Failed to restore 8139too module." |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
239 |
fi |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
240 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
241 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
242 |
;; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
244 |
restart) |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
245 |
$0 stop || exit 1 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
246 |
sleep 1 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
247 |
$0 start |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
248 |
rc_status |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
249 |
;; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
250 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
251 |
status) |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
252 |
echo -n "Checking for EtherCAT " |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
253 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
254 |
lsmod | grep "^ec_master " > /dev/null |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
255 |
master_running=$? |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
256 |
lsmod | grep "^ec_8139too " > /dev/null |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
257 |
device_running=$? |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
258 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
259 |
# master module and device module loaded? |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
260 |
test $master_running -eq 0 -a $device_running -eq 0 |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
261 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
262 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
263 |
;; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
264 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
265 |
bridge) |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
266 |
echo -n "Building EoE bridge " |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
267 |
build_eoe_bridge |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
268 |
rc_status -v |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
;; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
270 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
*) |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
272 |
echo "USAGE: $0 {start|stop|restart|status|bridge}" |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
;; |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
esac |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
276 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
rc_exit |
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
|
fa0af75bfbe9
MERGE -r759:762 trunk -> branches/stable-1.2 (release 1.2, part two).
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
279 |
#------------------------------------------------------------------------------ |