1 #!/bin/sh |
|
2 |
|
3 #------------------------------------------------------------------------------ |
|
4 # |
|
5 # EtherCAT install script |
|
6 # |
|
7 # $Id$ |
|
8 # |
|
9 # Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
|
10 # |
|
11 # This file is part of the IgH EtherCAT Master. |
|
12 # |
|
13 # The IgH EtherCAT Master is free software; you can redistribute it |
|
14 # and/or modify it under the terms of the GNU General Public License |
|
15 # as published by the Free Software Foundation; either version 2 of the |
|
16 # License, or (at your option) any later version. |
|
17 # |
|
18 # The IgH EtherCAT Master is distributed in the hope that it will be |
|
19 # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 # GNU General Public License for more details. |
|
22 # |
|
23 # You should have received a copy of the GNU General Public License |
|
24 # along with the IgH EtherCAT Master; if not, write to the Free Software |
|
25 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
26 # |
|
27 # The right to use EtherCAT Technology is granted and comes free of |
|
28 # charge under condition of compatibility of product made by |
|
29 # Licensee. People intending to distribute/sell products based on the |
|
30 # code, have to sign an agreement to guarantee that products using |
|
31 # software based on IgH EtherCAT master stay compatible with the actual |
|
32 # EtherCAT specification (which are released themselves as an open |
|
33 # standard) as the (only) precondition to have the right to use EtherCAT |
|
34 # Technology, IP and trade marks. |
|
35 # |
|
36 #------------------------------------------------------------------------------ |
|
37 |
|
38 CONFIGFILE=/etc/sysconfig/ethercat |
|
39 |
|
40 #------------------------------------------------------------------------------ |
|
41 |
|
42 # install function |
|
43 |
|
44 install() |
|
45 { |
|
46 echo " $1" |
|
47 if ! cp $1 $INSTALLDIR; then exit 1; fi |
|
48 } |
|
49 |
|
50 #------------------------------------------------------------------------------ |
|
51 |
|
52 # Fetch parameter |
|
53 |
|
54 if [ $# -ne 2 ]; then |
|
55 echo "This script is called by \"make\". Run \"make install\" instead." |
|
56 exit 1 |
|
57 fi |
|
58 |
|
59 KERNEL=$1 |
|
60 DEVICEINDEX=$2 |
|
61 |
|
62 INSTALLDIR=/lib/modules/$KERNEL/kernel/drivers/net |
|
63 echo "EtherCAT installer - Kernel: $KERNEL" |
|
64 |
|
65 # Copy files |
|
66 |
|
67 echo " installing modules..." |
|
68 install master/ec_master.ko |
|
69 install devices/ec_8139too.ko |
|
70 |
|
71 # Update dependencies |
|
72 |
|
73 echo " building module dependencies..." |
|
74 depmod |
|
75 |
|
76 # Create configuration file |
|
77 |
|
78 if [ -f $CONFIGFILE ]; then |
|
79 echo " notice: using existing configuration file." |
|
80 else |
|
81 echo " creating $CONFIGFILE..." |
|
82 echo "DEVICEINDEX=$DEVICEINDEX" > $CONFIGFILE || exit 1 |
|
83 fi |
|
84 |
|
85 # Install rc script |
|
86 |
|
87 echo " installing startup script..." |
|
88 cp ethercat.sh /etc/init.d/ethercat || exit 1 |
|
89 chmod +x /etc/init.d/ethercat || exit 1 |
|
90 if [ ! -L /usr/sbin/rcethercat ]; then |
|
91 ln -s /etc/init.d/ethercat /usr/sbin/rcethercat || exit 1 |
|
92 fi |
|
93 |
|
94 # Install tools |
|
95 |
|
96 echo " installing tools..." |
|
97 cp tools/ec_list.pl /usr/local/bin/ec_list || exit 1 |
|
98 chmod +x /usr/local/bin/ec_list || exit 1 |
|
99 |
|
100 # Finish |
|
101 |
|
102 echo "EtherCAT installer done." |
|
103 exit 0 |
|
104 |
|
105 #------------------------------------------------------------------------------ |
|