author | Florian Pose <fp@igh-essen.com> |
Mon, 29 May 2006 07:45:28 +0000 | |
changeset 263 | aa6623e5d958 |
parent 250 | 440ae5f6d2c3 |
child 272 | efb1c792a6a4 |
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 |
#------------------------------------------------------------------------------ |
167 | 53 |
|
54 |
# Copy files |
|
55 |
||
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
56 |
INSTALLDIR=/lib/modules/$KERNEL/kernel/drivers/net |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
57 |
MODULES=(master/ec_master.ko devices/ec_8139too.ko) |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
58 |
|
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
59 |
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
|
60 |
echo " Installing modules" |
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 |
for mod in ${MODULES[*]}; do |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
63 |
echo " $mod" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
64 |
cp $mod $INSTALLDIR || exit 1 |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
65 |
done |
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 |
#------------------------------------------------------------------------------ |
167 | 68 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
69 |
# Update dependencies |
167 | 70 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
71 |
echo " Building module dependencies" |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
72 |
depmod |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
73 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
74 |
#------------------------------------------------------------------------------ |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
75 |
|
169
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 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
78 |
CONFIGFILE=/etc/sysconfig/ethercat |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
79 |
|
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
80 |
if [ -s $CONFIGFILE ]; then |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
81 |
echo " Note: Using existing configuration file." |
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
82 |
else |
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
83 |
echo " Creating $CONFIGFILE" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
84 |
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
|
85 |
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
|
86 |
fi |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
87 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
88 |
#------------------------------------------------------------------------------ |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
89 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
90 |
# Install rc script |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
91 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
92 |
echo " Installing startup script" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
93 |
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
|
94 |
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
|
95 |
if [ ! -L /usr/sbin/rcethercat ]; then |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
96 |
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
|
97 |
fi |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
98 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
99 |
#------------------------------------------------------------------------------ |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
100 |
|
186
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
101 |
# Install tools |
644a053fe103
ec_list tool for listing the bus in user space
Florian Pose <fp@igh-essen.com>
parents:
171
diff
changeset
|
102 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
103 |
echo " Installing tools" |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
104 |
cp script/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
|
105 |
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
|
106 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
107 |
#------------------------------------------------------------------------------ |
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
108 |
|
169
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
109 |
# Finish |
b3ecbec2c487
Better installer and startup scripts.
Florian Pose <fp@igh-essen.com>
parents:
168
diff
changeset
|
110 |
|
250
440ae5f6d2c3
Created scripts directory and improved install and init scripts.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
111 |
echo "Done" |
167 | 112 |
exit 0 |
113 |
||
114 |
#------------------------------------------------------------------------------ |