script/install.sh
changeset 563 d113b63c55c4
parent 562 dda32c8294ad
child 564 fa9e1c99b6b0
equal deleted inserted replaced
562:dda32c8294ad 563:d113b63c55c4
     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 # Fetch parameters
       
    39 
       
    40 if [ $# -ne 1 ]; then
       
    41     echo "This script is called by \"make\". Run \"make install\" instead."
       
    42     exit 1
       
    43 fi
       
    44 
       
    45 KERNEL=$1
       
    46 
       
    47 if [ ! -d /lib/modules/$KERNEL ]; then
       
    48     echo "Kernel \"$KERNEL\" does not exist in /lib/modules!"
       
    49     exit 1
       
    50 fi
       
    51 
       
    52 echo "EtherCAT installer - Kernel: $KERNEL"
       
    53 
       
    54 #------------------------------------------------------------------------------
       
    55 
       
    56 # Update module dependencies
       
    57 
       
    58 echo "  Building module dependencies"
       
    59 /sbin/depmod
       
    60 
       
    61 #------------------------------------------------------------------------------
       
    62 
       
    63 # Create configuration file
       
    64 
       
    65 CONFIGFILE=/etc/sysconfig/ethercat
       
    66 
       
    67 if [ -s $CONFIGFILE ]; then
       
    68     echo "  Note: Using existing configuration file."
       
    69 else
       
    70     echo "  Creating $CONFIGFILE"
       
    71     cp script/sysconfig $CONFIGFILE || exit 1
       
    72     echo "  Note: Please edit DEVICE_INDEX in $CONFIGFILE!"
       
    73 fi
       
    74 
       
    75 #------------------------------------------------------------------------------
       
    76 
       
    77 # Install rc script
       
    78 
       
    79 echo "  Installing startup script"
       
    80 cp script/ethercat.sh /etc/init.d/ethercat || exit 1
       
    81 chmod +x /etc/init.d/ethercat || exit 1
       
    82 if [ ! -L /usr/sbin/rcethercat ]; then
       
    83     ln -s /etc/init.d/ethercat /usr/sbin/rcethercat || exit 1
       
    84 fi
       
    85 
       
    86 #------------------------------------------------------------------------------
       
    87 
       
    88 # Install tools
       
    89 
       
    90 echo "  Installing tools"
       
    91 cp script/lsec.pl /usr/local/bin/lsec || exit 1
       
    92 chmod +x /usr/local/bin/lsec || exit 1
       
    93 
       
    94 #------------------------------------------------------------------------------
       
    95 
       
    96 # Finish
       
    97 
       
    98 echo "Done"
       
    99 exit 0
       
   100 
       
   101 #------------------------------------------------------------------------------