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@250: # Fetch parameters fp@169: fp@250: if [ $# -ne 1 ]; 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@167: fp@250: if [ ! -d /lib/modules/$KERNEL ]; then fp@250: echo "Kernel \"$KERNEL\" does not exist in /lib/modules!" fp@250: exit 1 fp@250: fi fp@250: fp@250: echo "EtherCAT installer - Kernel: $KERNEL" fp@250: fp@250: #------------------------------------------------------------------------------ fp@167: fp@272: # Update module dependencies fp@167: fp@250: echo " Building module dependencies" fp@1719: /sbin/depmod fp@169: fp@250: #------------------------------------------------------------------------------ fp@250: fp@169: # Create configuration file fp@169: fp@250: CONFIGFILE=/etc/sysconfig/ethercat fp@250: fp@250: if [ -s $CONFIGFILE ]; then fp@250: echo " Note: Using existing configuration file." fp@169: else fp@250: echo " Creating $CONFIGFILE" fp@250: cp script/sysconfig $CONFIGFILE || exit 1 fp@250: echo " Note: Please edit DEVICE_INDEX in $CONFIGFILE!" fp@169: fi fp@169: fp@250: #------------------------------------------------------------------------------ fp@250: fp@169: # Install rc script fp@169: fp@250: echo " Installing startup script" fp@250: cp script/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@250: #------------------------------------------------------------------------------ fp@250: fp@186: # Install tools fp@186: fp@250: echo " Installing tools" fp@1715: cp script/lsec.pl /usr/local/bin/lsec || exit 1 fp@1719: chmod +x /usr/local/bin/lsec || exit 1 fp@186: fp@250: #------------------------------------------------------------------------------ fp@250: fp@169: # Finish fp@169: fp@250: echo "Done" fp@167: exit 0 fp@167: fp@167: #------------------------------------------------------------------------------