author | Florian Pose <fp@igh-essen.com> |
Tue, 24 Oct 2006 08:41:39 +0000 | |
changeset 438 | 64edce89fe9b |
parent 350 | 9ce33c200ea2 |
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 |
||
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
38 |
# Fetch parameters |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
39 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
40 |
if [ $# -ne 1 ]; then |
171
faa7d433239c
Added README file and altered outputs of install.sh
Florian Pose <fp@igh-essen.com>
parents:
169
diff
changeset
|
41 |
echo "This script is called by \"make\". Run \"make install\" instead." |
167 | 42 |
exit 1 |
43 |
fi |
|
44 |
||
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
45 |
KERNEL=$1 |
167 | 46 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
47 |
if [ ! -d /lib/modules/$KERNEL ]; then |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
48 |
echo "Kernel \"$KERNEL\" does not exist in /lib/modules!" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
49 |
exit 1 |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
50 |
fi |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
51 |
|
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
52 |
echo "EtherCAT installer - Kernel: $KERNEL" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
53 |
|
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
54 |
#------------------------------------------------------------------------------ |
167 | 55 |
|
272
efb1c792a6a4
Applied patches by Maximilian Schwerin.
Florian Pose <fp@igh-essen.com>
parents:
250
diff
changeset
|
56 |
# Update module dependencies |
167 | 57 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
58 |
echo " Building module dependencies" |
346 | 59 |
/sbin/depmod |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
60 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
61 |
#------------------------------------------------------------------------------ |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
62 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
63 |
# Create configuration file |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
64 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
65 |
CONFIGFILE=/etc/sysconfig/ethercat |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
66 |
|
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
67 |
if [ -s $CONFIGFILE ]; then |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
68 |
echo " Note: Using existing configuration file." |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
69 |
else |
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
70 |
echo " Creating $CONFIGFILE" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
71 |
cp script/sysconfig $CONFIGFILE || exit 1 |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
72 |
echo " Note: Please edit DEVICE_INDEX in $CONFIGFILE!" |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
73 |
fi |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
74 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
75 |
#------------------------------------------------------------------------------ |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
76 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
77 |
# Install rc script |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
78 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
79 |
echo " Installing startup script" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
80 |
cp script/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
|
81 |
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
|
82 |
if [ ! -L /usr/sbin/rcethercat ]; then |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
83 |
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
|
84 |
fi |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
85 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
86 |
#------------------------------------------------------------------------------ |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
87 |
|
186
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
88 |
# Install tools |
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
89 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
90 |
echo " Installing tools" |
316
23f501274ddf
renamed ec_list script to lsec.
Florian Pose <fp@igh-essen.com>
parents:
272
diff
changeset
|
91 |
cp script/lsec.pl /usr/local/bin/lsec || exit 1 |
350
9ce33c200ea2
Fixed bug in install script.
Florian Pose <fp@igh-essen.com>
parents:
346
diff
changeset
|
92 |
chmod +x /usr/local/bin/lsec || exit 1 |
186
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
93 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
94 |
#------------------------------------------------------------------------------ |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
95 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
96 |
# Finish |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
97 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
98 |
echo "Done" |
167 | 99 |
exit 0 |
100 |
||
101 |
#------------------------------------------------------------------------------ |