fp@167: #!/bin/sh fp@167: fp@167: #------------------------------------------------------------------------------ fp@167: # fp@167: # EtherCAT install script fp@167: # fp@167: # $Id$ fp@167: # fp@197: # Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@197: # fp@197: # This file is part of the IgH EtherCAT Master. fp@197: # fp@197: # The IgH EtherCAT Master is free software; you can redistribute it fp@197: # and/or modify it under the terms of the GNU General Public License fp@246: # as published by the Free Software Foundation; either version 2 of the fp@246: # License, or (at your option) any later version. fp@197: # fp@197: # The IgH EtherCAT Master is distributed in the hope that it will be fp@197: # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@197: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@197: # GNU General Public License for more details. fp@197: # fp@197: # You should have received a copy of the GNU General Public License fp@197: # along with the IgH EtherCAT Master; if not, write to the Free Software fp@197: # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@197: # fp@246: # The right to use EtherCAT Technology is granted and comes free of fp@246: # charge under condition of compatibility of product made by fp@246: # Licensee. People intending to distribute/sell products based on the fp@246: # code, have to sign an agreement to guarantee that products using fp@246: # software based on IgH EtherCAT master stay compatible with the actual fp@246: # EtherCAT specification (which are released themselves as an open fp@246: # standard) as the (only) precondition to have the right to use EtherCAT fp@246: # Technology, IP and trade marks. fp@246: # fp@167: #------------------------------------------------------------------------------ fp@167: fp@169: CONFIGFILE=/etc/sysconfig/ethercat fp@169: fp@169: #------------------------------------------------------------------------------ fp@169: fp@168: # install function fp@168: fp@168: install() fp@168: { fp@169: echo " $1" fp@168: if ! cp $1 $INSTALLDIR; then exit 1; fi fp@168: } fp@168: fp@168: #------------------------------------------------------------------------------ fp@168: fp@167: # Fetch parameter fp@167: fp@169: if [ $# -ne 2 ]; then fp@171: echo "This script is called by \"make\". Run \"make install\" instead." fp@167: exit 1 fp@167: fi fp@167: fp@169: KERNEL=$1 fp@169: DEVICEINDEX=$2 fp@167: fp@169: INSTALLDIR=/lib/modules/$KERNEL/kernel/drivers/net fp@169: echo "EtherCAT installer - Kernel: $KERNEL" fp@167: fp@167: # Copy files fp@167: fp@169: echo " installing modules..." fp@168: install master/ec_master.ko fp@168: install devices/ec_8139too.ko fp@167: fp@169: # Update dependencies fp@167: fp@169: echo " building module dependencies..." fp@169: depmod fp@169: fp@169: # Create configuration file fp@169: fp@169: if [ -f $CONFIGFILE ]; then fp@169: echo " notice: using existing configuration file." fp@169: else fp@169: echo " creating $CONFIGFILE..." fp@169: echo "DEVICEINDEX=$DEVICEINDEX" > $CONFIGFILE || exit 1 fp@169: fi fp@169: fp@169: # Install rc script fp@169: fp@169: echo " installing startup script..." fp@169: cp ethercat.sh /etc/init.d/ethercat || exit 1 fp@242: chmod +x /etc/init.d/ethercat || exit 1 fp@169: if [ ! -L /usr/sbin/rcethercat ]; then fp@169: ln -s /etc/init.d/ethercat /usr/sbin/rcethercat || exit 1 fp@169: fi fp@169: fp@186: # Install tools fp@186: fp@186: echo " installing tools..." fp@186: cp tools/ec_list.pl /usr/local/bin/ec_list || exit 1 fp@242: chmod +x /usr/local/bin/ec_list || exit 1 fp@186: fp@169: # Finish fp@169: fp@169: echo "EtherCAT installer done." fp@167: exit 0 fp@167: fp@167: #------------------------------------------------------------------------------