6 # |
6 # |
7 # $Id$ |
7 # $Id$ |
8 # |
8 # |
9 #------------------------------------------------------------------------------ |
9 #------------------------------------------------------------------------------ |
10 |
10 |
|
11 CONFIGFILE=/etc/sysconfig/ethercat |
|
12 |
|
13 #------------------------------------------------------------------------------ |
|
14 |
11 # install function |
15 # install function |
12 |
16 |
13 install() |
17 install() |
14 { |
18 { |
15 echo " installing $1" |
19 echo " $1" |
16 if ! cp $1 $INSTALLDIR; then exit 1; fi |
20 if ! cp $1 $INSTALLDIR; then exit 1; fi |
17 } |
21 } |
18 |
22 |
19 #------------------------------------------------------------------------------ |
23 #------------------------------------------------------------------------------ |
20 |
24 |
21 # Fetch parameter |
25 # Fetch parameter |
22 |
26 |
23 if [ $# -eq 0 ]; then |
27 if [ $# -ne 2 ]; then |
24 echo "Usage: $0 <INSTALLDIR>" |
28 echo "Usage: $0 <KERNEL> <DEVICEINDEX>" |
25 exit 1 |
29 exit 1 |
26 fi |
30 fi |
27 |
31 |
28 INSTALLDIR=$1 |
32 KERNEL=$1 |
29 echo "EtherCAT installer. Target: $INSTALLDIR" |
33 DEVICEINDEX=$2 |
30 |
34 |
31 # Create installation directory |
35 INSTALLDIR=/lib/modules/$KERNEL/kernel/drivers/net |
32 |
36 echo "EtherCAT installer - Kernel: $KERNEL" |
33 if [ ! -d $INSTALLDIR ]; then |
|
34 echo " creating target directory." |
|
35 if ! mkdir $INSTALLDIR; then exit 1; fi |
|
36 fi |
|
37 |
37 |
38 # Copy files |
38 # Copy files |
39 |
39 |
|
40 echo " installing modules..." |
40 install master/ec_master.ko |
41 install master/ec_master.ko |
41 install devices/ec_8139too.ko |
42 install devices/ec_8139too.ko |
42 |
43 |
43 # Finished |
44 # Update dependencies |
44 |
45 |
|
46 echo " building module dependencies..." |
|
47 depmod |
|
48 |
|
49 # Create configuration file |
|
50 |
|
51 if [ -f $CONFIGFILE ]; then |
|
52 echo " notice: using existing configuration file." |
|
53 else |
|
54 echo " creating $CONFIGFILE..." |
|
55 echo "DEVICEINDEX=$DEVICEINDEX" > $CONFIGFILE || exit 1 |
|
56 fi |
|
57 |
|
58 # Install rc script |
|
59 |
|
60 echo " installing startup script..." |
|
61 cp ethercat.sh /etc/init.d/ethercat || exit 1 |
|
62 if [ ! -L /usr/sbin/rcethercat ]; then |
|
63 ln -s /etc/init.d/ethercat /usr/sbin/rcethercat || exit 1 |
|
64 fi |
|
65 |
|
66 # Finish |
|
67 |
|
68 echo "EtherCAT installer done." |
45 exit 0 |
69 exit 0 |
46 |
70 |
47 #------------------------------------------------------------------------------ |
71 #------------------------------------------------------------------------------ |