install.sh
branchstable-1.0
changeset 1619 0d4119024f55
parent 1618 5cff10efb927
child 1620 9d7453c16ade
equal deleted inserted replaced
1618:5cff10efb927 1619:0d4119024f55
     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; version 2 of the License.
       
    16 #
       
    17 #  The IgH EtherCAT Master is distributed in the hope that it will be
       
    18 #  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    19 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    20 #  GNU General Public License for more details.
       
    21 #
       
    22 #  You should have received a copy of the GNU General Public License
       
    23 #  along with the IgH EtherCAT Master; if not, write to the Free Software
       
    24 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    25 #
       
    26 #------------------------------------------------------------------------------
       
    27 
       
    28 CONFIGFILE=/etc/sysconfig/ethercat
       
    29 
       
    30 #------------------------------------------------------------------------------
       
    31 
       
    32 # install function
       
    33 
       
    34 install()
       
    35 {
       
    36     echo "    $1"
       
    37     if ! cp $1 $INSTALLDIR; then exit 1; fi
       
    38 }
       
    39 
       
    40 #------------------------------------------------------------------------------
       
    41 
       
    42 # Fetch parameter
       
    43 
       
    44 if [ $# -ne 2 ]; then
       
    45     echo "This script is called by \"make\". Run \"make install\" instead."
       
    46     exit 1
       
    47 fi
       
    48 
       
    49 KERNEL=$1
       
    50 DEVICEINDEX=$2
       
    51 
       
    52 INSTALLDIR=/lib/modules/$KERNEL/kernel/drivers/net
       
    53 echo "EtherCAT installer - Kernel: $KERNEL"
       
    54 
       
    55 # Copy files
       
    56 
       
    57 echo "  installing modules..."
       
    58 install master/ec_master.ko
       
    59 install devices/ec_8139too.ko
       
    60 
       
    61 # Update dependencies
       
    62 
       
    63 echo "  building module dependencies..."
       
    64 depmod
       
    65 
       
    66 # Create configuration file
       
    67 
       
    68 if [ -f $CONFIGFILE ]; then
       
    69     echo "  notice: using existing configuration file."
       
    70 else
       
    71     echo "  creating $CONFIGFILE..."
       
    72     echo "DEVICEINDEX=$DEVICEINDEX" > $CONFIGFILE || exit 1
       
    73 fi
       
    74 
       
    75 # Install rc script
       
    76 
       
    77 echo "  installing startup script..."
       
    78 cp ethercat.sh /etc/init.d/ethercat || exit 1
       
    79 if [ ! -L /usr/sbin/rcethercat ]; then
       
    80     ln -s /etc/init.d/ethercat /usr/sbin/rcethercat || exit 1
       
    81 fi
       
    82 
       
    83 # Install tools
       
    84 
       
    85 echo "  installing tools..."
       
    86 cp tools/ec_list.pl /usr/local/bin/ec_list || exit 1
       
    87 
       
    88 # Finish
       
    89 
       
    90 echo "EtherCAT installer done."
       
    91 exit 0
       
    92 
       
    93 #------------------------------------------------------------------------------