fp@167: #!/bin/sh fp@167: fp@167: #------------------------------------------------------------------------------ fp@167: # fp@167: # EtherCAT install script fp@167: # fp@167: # $Id$ fp@167: # 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@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@169: # Finish fp@169: fp@169: echo "EtherCAT installer done." fp@167: exit 0 fp@167: fp@167: #------------------------------------------------------------------------------