Revision: 5947
          http://ipcop.svn.sourceforge.net/ipcop/?rev=5947&view=rev
Author:   owes
Date:     2011-10-15 20:36:33 +0000 (Sat, 15 Oct 2011)
Log Message:
-----------
Add license text and fix coding style.

Modified Paths:
--------------
    ipcop/trunk/src/rc.d/rc.eciadsl
    ipcop/trunk/updates/2.0.1/ROOTFILES.i486-2.0.1

Modified: ipcop/trunk/src/rc.d/rc.eciadsl
===================================================================
--- ipcop/trunk/src/rc.d/rc.eciadsl     2011-10-15 17:48:16 UTC (rev 5946)
+++ ipcop/trunk/src/rc.d/rc.eciadsl     2011-10-15 20:36:33 UTC (rev 5947)
@@ -1,5 +1,22 @@
 #!/bin/bash
 #
+# This file is part of the IPCop Firewall.
+#
+# IPCop is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# IPCop is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with IPCop.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright (c) 2003-2011 The IPCop Team
+#
 # $Id$
 #
 
@@ -8,144 +25,144 @@
 # Debugging. Comment it out to stop logging
 DEBUG="yes"
 msg() {
-       if [ "z$DEBUG" != "z" ] ; then
-               /usr/bin/logger -t red "ECI USB: $*"
-       fi
-       /bin/echo "$*"
+    if [ "z$DEBUG" != "z" ] ; then
+        /usr/bin/logger -t red "ECI USB: $*"
+    fi
+    /bin/echo "$*"
 }
 
 # Function to wait for interface to become ready
 # Borrowed from eciadsl startmodem script
 function wait_for_iface()
 {
-       msg "Waiting for interface: $1"
-       COUNTER=10
-       FLREADY=0
-       TIMES=1
-       while [ $TIMES -le $COUNTER ]; do
-               /sbin/ip link show $1> /dev/null 2>&1
-               if [ 0$? -eq 0 ]; then
-                       FLREADY=1
-                       break
-               fi
-               /bin/sleep 1
-               TIMES=$(expr $TIMES + 1)
-       done
-       if [ 0"$FLREADY" -eq 0 ]; then
-               msg "Interface not found: $1"
-               exit 1
-       fi
+    msg "Waiting for interface: $1"
+    COUNTER=10
+    FLREADY=0
+    TIMES=1
+    while [ $TIMES -le $COUNTER ]; do
+        /sbin/ip link show $1> /dev/null 2>&1
+        if [ 0$? -eq 0 ]; then
+            FLREADY=1
+            break
+        fi
+        /bin/sleep 1
+        TIMES=$(expr $TIMES + 1)
+    done
+    if [ 0"$FLREADY" -eq 0 ]; then
+        msg "Interface not found: $1"
+        exit 1
+    fi
 }
 
 # See how we were called.
 case "$1" in
 start)
-       if [ ! -f "/var/ipcop/eciadsl/synch.bin" ]; then
-               msg "Synch.bin not uploaded"
-               exit 1
-       fi
+    if [ ! -f "/var/ipcop/eciadsl/synch.bin" ]; then
+        msg "Synch.bin not uploaded"
+        exit 1
+    fi
 
-       if [ ! -f "/proc/bus/usb/devices" ]; then
-               msg "No USB enabled"
-               exit 1
-       fi
+    if [ ! -f "/proc/bus/usb/devices" ]; then
+        msg "No USB enabled"
+        exit 1
+    fi
 
-       VID1="$(/bin/grep "$MODEM       " "/etc/eciadsl/modems.db" | 
/usr/bin/tr -s "\t" "|" | /usr/bin/cut -d '|' -f 2)"
-       PID1="$(/bin/grep "$MODEM       " "/etc/eciadsl/modems.db" | 
/usr/bin/tr -s "\t" "|" | /usr/bin/cut -d '|' -f 3)"
-       VID2="$(/bin/grep "$MODEM       " "/etc/eciadsl/modems.db" | 
/usr/bin/tr -s "\t" "|" | /usr/bin/cut -d '|' -f 4)"
-       PID2="$(/bin/grep "$MODEM       " "/etc/eciadsl/modems.db" | 
/usr/bin/tr -s "\t" "|" | /usr/bin/cut -d '|' -f 5)"
-       CHIP="$(/bin/grep "$MODEM       " "/etc/eciadsl/modems.db" | 
/usr/bin/tr -s "\t" "|" | /usr/bin/cut -d '|' -f 6)"
-       ALTS="$(/bin/grep "$MODEM       " "/etc/eciadsl/modems.db" | 
/usr/bin/tr -s "\t" "|" | /usr/bin/cut -d '|' -f 7)"
-       ALTP="$(/bin/grep "$MODEM       " "/etc/eciadsl/modems.db" | 
/usr/bin/tr -s "\t" "|" | /usr/bin/cut -d '|' -f 8)"
+    VID1="$(/bin/grep "$MODEM  " "/etc/eciadsl/modems.db" | /usr/bin/tr -s 
"\t" "|" | /usr/bin/cut -d '|' -f 2)"
+    PID1="$(/bin/grep "$MODEM  " "/etc/eciadsl/modems.db" | /usr/bin/tr -s 
"\t" "|" | /usr/bin/cut -d '|' -f 3)"
+    VID2="$(/bin/grep "$MODEM  " "/etc/eciadsl/modems.db" | /usr/bin/tr -s 
"\t" "|" | /usr/bin/cut -d '|' -f 4)"
+    PID2="$(/bin/grep "$MODEM  " "/etc/eciadsl/modems.db" | /usr/bin/tr -s 
"\t" "|" | /usr/bin/cut -d '|' -f 5)"
+    CHIP="$(/bin/grep "$MODEM  " "/etc/eciadsl/modems.db" | /usr/bin/tr -s 
"\t" "|" | /usr/bin/cut -d '|' -f 6)"
+    ALTS="$(/bin/grep "$MODEM  " "/etc/eciadsl/modems.db" | /usr/bin/tr -s 
"\t" "|" | /usr/bin/cut -d '|' -f 7)"
+    ALTP="$(/bin/grep "$MODEM  " "/etc/eciadsl/modems.db" | /usr/bin/tr -s 
"\t" "|" | /usr/bin/cut -d '|' -f 8)"
 
-       if [ "$CHIP" = '' ]; then
-               msg "error in modems.db reading for $MODEM no CHIP found"
-               exit 1
-       fi
+    if [ "$CHIP" = '' ]; then
+        msg "error in modems.db reading for $MODEM no CHIP found"
+        exit 1
+    fi
 
-       # Firmware
-       if [ "$CHIP" = 'GS7070' ]; then
-               if ( /bin/grep -q "^P:  Vendor=$VID1 ProdID=$PID1" 
/proc/bus/usb/devices ); then
-                       /bin/rm -f /var/ipcop/red/eciadsl-synch-done
-                       /bin/sleep 2
-                       msg "Loading Firmware for $MODEM"
-                       /usr/sbin/eciadsl-firmware 0x$VID1 0x$PID1 0x$VID2 
0x$PID2 /etc/eciadsl/firmware00.bin
-                       RET=$?
-                       if [ "$RET" -ne "0" ]; then
-                               msg "$MODEM failed to load firmware, reason: 
$RET"
-                               exit 1
-                       fi
-                       /bin/sleep 2
-               fi
-       fi
+    # Firmware
+    if [ "$CHIP" = 'GS7070' ]; then
+        if ( /bin/grep -q "^P:  Vendor=$VID1 ProdID=$PID1" 
/proc/bus/usb/devices ); then
+            /bin/rm -f /var/ipcop/red/eciadsl-synch-done
+            /bin/sleep 2
+            msg "Loading Firmware for $MODEM"
+            /usr/sbin/eciadsl-firmware 0x$VID1 0x$PID1 0x$VID2 0x$PID2 
/etc/eciadsl/firmware00.bin
+            RET=$?
+            if [ "$RET" -ne "0" ]; then
+                msg "$MODEM failed to load firmware, reason: $RET"
+                exit 1
+            fi
+            /bin/sleep 2
+        fi
+    fi
 
-       if ( ! /bin/grep -q "^P:  Vendor=$VID2 ProdID=$PID2" 
/proc/bus/usb/devices ); then
-               msg "$MODEM modem not found ready"
-               exit 1
-       fi
+    if ( ! /bin/grep -q "^P:  Vendor=$VID2 ProdID=$PID2" /proc/bus/usb/devices 
); then
+        msg "$MODEM modem not found ready"
+        exit 1
+    fi
 
-       # Modem synch
-       if [ ! -e "/var/ipcop/red/eciadsl-synch-done" ]; then
-               /usr/sbin/eciadsl-synch -alt $ALTS -mc $CHIP 0x$VID2 0x$PID2 
/var/ipcop/eciadsl/synch.bin
-               RET=$?
-               if [ "$RET" -ne "0" ]; then
-                       msg "$MODEM failed to get synchronization, reason:$RET"
-                       exit 1
-               else
-                       /usr/bin/touch /var/ipcop/red/eciadsl-synch-done
-               fi
-       fi
+    # Modem synch
+    if [ ! -e "/var/ipcop/red/eciadsl-synch-done" ]; then
+        /usr/sbin/eciadsl-synch -alt $ALTS -mc $CHIP 0x$VID2 0x$PID2 
/var/ipcop/eciadsl/synch.bin
+        RET=$?
+        if [ "$RET" -ne "0" ]; then
+            msg "$MODEM failed to get synchronization, reason:$RET"
+            exit 1
+        else
+            /usr/bin/touch /var/ipcop/red/eciadsl-synch-done
+        fi
+    fi
 
-       if [ "$PROTOCOL" = "RFC1483" ]; then
-               case "$ENCAP" in
-                   0) ECIMODE="LLC_SNAP_RFC1483_BRIDGED_ETH_NO_FCS"
-                       ;;
-                   1) ECIMODE="VCM_RFC_1483_BRIDGED_ETH"
-                       ;;
-                   2) ECIMODE="LLC_RFC1483_ROUTED_IP"
-                       ;;
-                   3) ECIMODE="VCM_RFC1483_ROUTED_IP"
-                       ;;
-                   *) msg "Unknown encapsulation: $ENCAP"
-                       exit 1
-                       ;;
-               esac
+    if [ "$PROTOCOL" = "RFC1483" ]; then
+        case "$ENCAP" in
+            0) ECIMODE="LLC_SNAP_RFC1483_BRIDGED_ETH_NO_FCS"
+            ;;
+            1) ECIMODE="VCM_RFC_1483_BRIDGED_ETH"
+            ;;
+            2) ECIMODE="LLC_RFC1483_ROUTED_IP"
+            ;;
+            3) ECIMODE="VCM_RFC1483_ROUTED_IP"
+            ;;
+            *) msg "Unknown encapsulation: $ENCAP"
+            exit 1
+            ;;
+        esac
 
-               # Start pppoeci
-               if [ "$ENCAP" = "0" -o "$ENCAP" = "1" ]; then
-                       ECIIF="tap0"
-               else
-                       ECIIF="tun0"
-               fi
-               /sbin/modprobe tun
-               /usr/sbin/eciadsl-pppoeci -alt $ALTP -vpi $VPI -vci $VCI 
-vendor 0x$VID2 -product 0x$PID2 -mode $ECIMODE
-               wait_for_iface $ECIIF
-               /sbin/ip link set $ECIIF up
-               exit $?
-       fi
-       exit 0
-       ;;
+        # Start pppoeci
+        if [ "$ENCAP" = "0" -o "$ENCAP" = "1" ]; then
+            ECIIF="tap0"
+        else
+            ECIIF="tun0"
+        fi
+        /sbin/modprobe tun
+        /usr/sbin/eciadsl-pppoeci -alt $ALTP -vpi $VPI -vci $VCI -vendor 
0x$VID2 -product 0x$PID2 -mode $ECIMODE
+        wait_for_iface $ECIIF
+        /sbin/ip link set $ECIIF up
+        exit $?
+    fi
+    exit 0
+    ;;
 stop)
-       msg "stop"
-       # Avoid possibility of multiple 'rc.eciadsl start' as only one prog can 
claim interface at a time
-       # and time for the full eci-load2 loop may be too long for the user to 
wait until to try once again
-       RCECIADSLSTART=`/bin/ps ax | /bin/grep '[r]c.eciadsl start' | 
/usr/bin/cut -f1 -d ' '`
-       [ "$RCECIADSLSTART" != '' ] && /bin/kill "$RCECIADSLSTART"
+    msg "stop"
+    # Avoid possibility of multiple 'rc.eciadsl start' as only one prog can 
claim interface at a time
+    # and time for the full eci-load2 loop may be too long for the user to 
wait until to try once again
+    RCECIADSLSTART=`/bin/ps ax | /bin/grep '[r]c.eciadsl start' | /usr/bin/cut 
-f1 -d ' '`
+    [ "$RCECIADSLSTART" != '' ] && /bin/kill "$RCECIADSLSTART"
 
-       # -KILL is necessary because pppoeci ignores sigint
-       /usr/bin/killall -KILL eciadsl-pppoeci eciadsl-firmware eciadsl-synch 
2> /dev/null
-       /bin/sleep 1
-       /sbin/modprobe -r tun
-       ;;
+    # -KILL is necessary because pppoeci ignores sigint
+    /usr/bin/killall -KILL eciadsl-pppoeci eciadsl-firmware eciadsl-synch 2> 
/dev/null
+    /bin/sleep 1
+    /sbin/modprobe -r tun
+    ;;
 cleanup)
-       msg "driver cleanup and USB Bus reset"
-       /usr/local/bin/resetusb
-       /bin/rm -f /var/ipcop/red/eciadsl-synch-done
-       ;;
+    msg "driver cleanup and USB Bus reset"
+    /usr/local/bin/resetusb
+    /bin/rm -f /var/ipcop/red/eciadsl-synch-done
+    ;;
 *)
-       /bin/echo "Usage: $0 {start|stop|cleanup}"
-       exit 1
-       ;;
+    /bin/echo "Usage: $0 {start|stop|cleanup}"
+    exit 1
+    ;;
 esac
 
 exit 0

Modified: ipcop/trunk/updates/2.0.1/ROOTFILES.i486-2.0.1
===================================================================
--- ipcop/trunk/updates/2.0.1/ROOTFILES.i486-2.0.1      2011-10-15 17:48:16 UTC 
(rev 5946)
+++ ipcop/trunk/updates/2.0.1/ROOTFILES.i486-2.0.1      2011-10-15 20:36:33 UTC 
(rev 5947)
@@ -1,5 +1,6 @@
 ## please place IPCop files first, then packages sorted by alphabetical order
 /etc/rc.d/rc.eagleusbadsl
+/etc/rc.d/rc.eciadsl
 /etc/rc.d/rc.pulsardsl
 /etc/rc.d/rc.red
 /home/httpd/cgi-bin/email.cgi

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn

Reply via email to