author | Florian Pose <fp@igh-essen.com> |
Thu, 18 May 2006 12:45:32 +0000 | |
changeset 247 | d1f0cff6f57f |
parent 246 | 0bf7c769de06 |
permissions | -rwxr-xr-x |
167 | 1 |
#!/bin/sh |
2 |
||
3 |
#------------------------------------------------------------------------------ |
|
4 |
# |
|
5 |
# EtherCAT install script |
|
6 |
# |
|
7 |
# $Id$ |
|
8 |
# |
|
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
186
diff
changeset
|
9 |
# Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
186
diff
changeset
|
10 |
# |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
186
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:
186
diff
changeset
|
12 |
# |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
186
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:
186
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:
242
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:
242
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:
186
diff
changeset
|
17 |
# |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
186
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:
186
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:
186
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:
186
diff
changeset
|
21 |
# GNU General Public License for more details. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
186
diff
changeset
|
22 |
# |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
186
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:
186
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:
186
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:
186
diff
changeset
|
26 |
# |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
242
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:
242
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:
242
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:
242
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:
242
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:
242
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:
242
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:
242
diff
changeset
|
34 |
# Technology, IP and trade marks. |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
242
diff
changeset
|
35 |
# |
167 | 36 |
#------------------------------------------------------------------------------ |
37 |
||
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
38 |
CONFIGFILE=/etc/sysconfig/ethercat |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
39 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
40 |
#------------------------------------------------------------------------------ |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
41 |
|
168 | 42 |
# install function |
43 |
||
44 |
install() |
|
45 |
{ |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
46 |
echo " $1" |
168 | 47 |
if ! cp $1 $INSTALLDIR; then exit 1; fi |
48 |
} |
|
49 |
||
50 |
#------------------------------------------------------------------------------ |
|
51 |
||
167 | 52 |
# Fetch parameter |
53 |
||
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
54 |
if [ $# -ne 2 ]; then |
171
faa7d433239c
Added README file and altered outputs of install.sh
Florian Pose <fp@igh-essen.com>
parents:
169
diff
changeset
|
55 |
echo "This script is called by \"make\". Run \"make install\" instead." |
167 | 56 |
exit 1 |
57 |
fi |
|
58 |
||
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
59 |
KERNEL=$1 |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
60 |
DEVICEINDEX=$2 |
167 | 61 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
62 |
INSTALLDIR=/lib/modules/$KERNEL/kernel/drivers/net |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
63 |
echo "EtherCAT installer - Kernel: $KERNEL" |
167 | 64 |
|
65 |
# Copy files |
|
66 |
||
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
67 |
echo " installing modules..." |
168 | 68 |
install master/ec_master.ko |
69 |
install devices/ec_8139too.ko |
|
167 | 70 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
71 |
# Update dependencies |
167 | 72 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
73 |
echo " building module dependencies..." |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
74 |
depmod |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
75 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
76 |
# Create configuration file |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
77 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
78 |
if [ -f $CONFIGFILE ]; then |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
79 |
echo " notice: using existing configuration file." |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
80 |
else |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
81 |
echo " creating $CONFIGFILE..." |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
82 |
echo "DEVICEINDEX=$DEVICEINDEX" > $CONFIGFILE || exit 1 |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
83 |
fi |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
84 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
85 |
# Install rc script |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
86 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
87 |
echo " installing startup script..." |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
88 |
cp ethercat.sh /etc/init.d/ethercat || exit 1 |
242
1161d9e7a959
Set permissions in install script.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
89 |
chmod +x /etc/init.d/ethercat || exit 1 |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
90 |
if [ ! -L /usr/sbin/rcethercat ]; then |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
91 |
ln -s /etc/init.d/ethercat /usr/sbin/rcethercat || exit 1 |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
92 |
fi |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
93 |
|
186
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
94 |
# Install tools |
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
95 |
|
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
96 |
echo " installing tools..." |
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
97 |
cp tools/ec_list.pl /usr/local/bin/ec_list || exit 1 |
242
1161d9e7a959
Set permissions in install script.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
98 |
chmod +x /usr/local/bin/ec_list || exit 1 |
186
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
99 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
100 |
# Finish |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
101 |
|
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
102 |
echo "EtherCAT installer done." |
167 | 103 |
exit 0 |
104 |
||
105 |
#------------------------------------------------------------------------------ |