diff options
author | Alin Năstac <mrness@gentoo.org> | 2005-02-25 21:18:35 +0000 |
---|---|---|
committer | Alin Năstac <mrness@gentoo.org> | 2005-02-25 21:18:35 +0000 |
commit | a6a1b8a0d93ac731ceecbdf67b0256b49c5331fa (patch) | |
tree | 82cbb8d26f09792fbed64e3d499e47cb1fda443d /net-dialup/eagle-usb | |
parent | Revision bump for security fix. Bug #83297 (diff) | |
download | historical-a6a1b8a0d93ac731ceecbdf67b0256b49c5331fa.tar.gz historical-a6a1b8a0d93ac731ceecbdf67b0256b49c5331fa.tar.bz2 historical-a6a1b8a0d93ac731ceecbdf67b0256b49c5331fa.zip |
initial import (#82480)
Package-Manager: portage-2.0.51-r15
Diffstat (limited to 'net-dialup/eagle-usb')
-rw-r--r-- | net-dialup/eagle-usb/ChangeLog | 11 | ||||
-rw-r--r-- | net-dialup/eagle-usb/Manifest | 17 | ||||
-rw-r--r-- | net-dialup/eagle-usb/eagle-usb-2.1.1.ebuild | 69 | ||||
-rw-r--r-- | net-dialup/eagle-usb/files/confd | 34 | ||||
-rw-r--r-- | net-dialup/eagle-usb/files/digest-eagle-usb-2.1.1 | 1 | ||||
-rw-r--r-- | net-dialup/eagle-usb/files/dsl.peer | 15 | ||||
-rw-r--r-- | net-dialup/eagle-usb/files/initd | 320 | ||||
-rw-r--r-- | net-dialup/eagle-usb/metadata.xml | 6 |
8 files changed, 473 insertions, 0 deletions
diff --git a/net-dialup/eagle-usb/ChangeLog b/net-dialup/eagle-usb/ChangeLog new file mode 100644 index 000000000000..3b150127ed11 --- /dev/null +++ b/net-dialup/eagle-usb/ChangeLog @@ -0,0 +1,11 @@ +# ChangeLog for net-dialup/eagle-usb +# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-dialup/eagle-usb/ChangeLog,v 1.1 2005/02/25 21:18:35 mrness Exp $ + +*eagle-usb-2.1.1 (25 Feb 2005) + + 25 Feb 2005; Alin Nastac <mrness@gentoo.org> +metadata.xml, +files/confd, + +files/dsl.peer, +files/initd, +eagle-usb-2.1.1.ebuild: + Initial import from bug #82480, thanks to genstef and Daniel Plaza + <daniel@dilmun.ls.fi.upm.es>. + diff --git a/net-dialup/eagle-usb/Manifest b/net-dialup/eagle-usb/Manifest new file mode 100644 index 000000000000..09969079b5e7 --- /dev/null +++ b/net-dialup/eagle-usb/Manifest @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +MD5 90560537661de864f2a457de6f54f483 eagle-usb-2.1.1.ebuild 2366 +MD5 449f8e665be85c867050d364548dc3a1 ChangeLog 481 +MD5 784ec6993aa07588926fec5a7fbf2c70 metadata.xml 246 +MD5 9bcb1e4277b2ca63a52b873a3c8b632d files/confd 805 +MD5 e6bb5c4e3d40da64218b22962001d51e files/initd 9194 +MD5 4062d2a6eb8bbb26c70db6813102e56c files/digest-eagle-usb-2.1.1 68 +MD5 a26da8905bd09e0c8d5628c0afd96a8b files/dsl.peer 185 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.2.6 (GNU/Linux) + +iD8DBQFCH5Y0jiC39V7gKu0RAj7dAJ9rfjl4cPZVugVOul68Rwql2InO+QCfZxGT +9reFsK6KggZlbyuxmM5euTo= +=jTFh +-----END PGP SIGNATURE----- diff --git a/net-dialup/eagle-usb/eagle-usb-2.1.1.ebuild b/net-dialup/eagle-usb/eagle-usb-2.1.1.ebuild new file mode 100644 index 000000000000..e94034c52a59 --- /dev/null +++ b/net-dialup/eagle-usb/eagle-usb-2.1.1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-dialup/eagle-usb/eagle-usb-2.1.1.ebuild,v 1.1 2005/02/25 21:18:35 mrness Exp $ + +inherit linux-mod + +DESCRIPTION="GPL Driver for Eagle Chipset powered ADSL modem" +SRC_URI="http://download.gna.org/eagleusb/eagle-usb-2.1.0/${P}.tar.bz2" +HOMEPAGE="http://www.eagle-usb.org/" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86" +IUSE="" + +RDEPEND="net-dialup/ppp" + +MODULE_NAMES="${PN}(net:${S}/driver)" +CONFIG_CHECK="!IPV6 USB" +BUILD_TARGETS=" " +BUILD_PARAMS="KERNELSRC=${KV_DIR}" + +src_compile() { + ./autogen.sh || die "autogen.sh failed" + CONFIG_FILES=Makefile.common econf --with-kernel-src=${KV_DIR} || die "econf failed" + for i in pppoa utils/scripts utils/eagleconnect; do + emake -C ${i} || die "emake ${i} failed" + done + + linux-mod_src_compile +} + +src_install() { + linux-mod_src_install + + for i in driver/firmware driver/user pppoa utils/scripts utils/eagleconnect; do + make DESTDIR=${D} -C ${i} install || die "make ${i} install failed" + done + + doman doc/man/* + dodoc README ChangeLog + + exeinto /etc/init.d ; newexe ${FILESDIR}/initd ${PN} + insinto /etc/conf.d ; newins ${FILESDIR}/confd ${PN} + insopts -m 600 ; insinto /etc/ppp/peers ; doins ${FILESDIR}/dsl.peer +} + +pkg_postinst() { + linux-mod_pkg_postinst + + ewarn "Please set METHOD in /etc/conf.d/${PN} to the needed value:" + ewarn "dhcpip:" + einfo " Make sure you have dhcpcd emerged." + ewarn "staticip:" + einfo " Set your static IP in /etc/conf.d/eagle-adsl" + ewarn "dhcpip && staticip: You can use the following to set up the eagle conf-files:" + echo 'sed -i -e "s/Encapsulation *= *[0-9]\+/Encapsulation=00000004/" /etc/eagle-usb/eagle-usb.conf' + echo 'sed -i -e "s/VCI *= *[0-9]\+/VCI=00000024/" /etc/eagle-usb/eagle-usb.conf' + ewarn "pppoa:" + einfo " Make sure you have kernel support for HDCL and PPP" + einfo " Edit /etc/ppp/peers/dsl.peer to insert your username as" + einfo " well as /etc/ppp/chap-secrets and /etc/ppp/pap-secrets" + einfo + einfo " dsl.peer contains the \"usepeerdns\" option so, you" + einfo " should consider making a symlink named /etc/resolv.conf" + einfo " and pointing to /etc/ppp/resolv.conf:" + echo "rm /etc/resolv.conf" + echo "ln -s /etc/ppp/resolv.conf /etc/resolv.conf" +} diff --git a/net-dialup/eagle-usb/files/confd b/net-dialup/eagle-usb/files/confd new file mode 100644 index 000000000000..58be50544b62 --- /dev/null +++ b/net-dialup/eagle-usb/files/confd @@ -0,0 +1,34 @@ +# Config file for the eagle-adsl ebuild + +# Set the options path +OPTIONS="/etc/eagle-usb/dsp/eagle-usb.conf" + +# Set DSP code path +DSP="/etc/eagle-usb/dsp" + +# Set default synchro timeout in seconds +SYNCHRO_TIMEOUT=120 + +# Set the peer filename +# This should be in /etc/ppp/peers/ +PEER="dsl.peer" + +# Method: dhcpip, staticip or pppoa +METHOD=dhcpip + +# Static IP stuff : IP, Gateway, Netmask +#STATIC_IP="192.168.1.1" +#STATIC_GW="192.168.1.254" +#STATIC_NM="255.255.255.0" + +LINKNAME=eagle + +# setting DEBUG to YES or yes will cause some extra output to the log and to stderr +# recommended for diagnosing problems. You might also want to use PPPDOPTIONS below... +DEBUG=no + +# PPPDOPTS for any extra options for pppd. e.g.: +# PPPDOPTS='debug ' + +# DHCPCDOPTS for any extra options for dhcpcd. e.g.: +# DHCPCDOPTS="-R" diff --git a/net-dialup/eagle-usb/files/digest-eagle-usb-2.1.1 b/net-dialup/eagle-usb/files/digest-eagle-usb-2.1.1 new file mode 100644 index 000000000000..34a1fc3edd66 --- /dev/null +++ b/net-dialup/eagle-usb/files/digest-eagle-usb-2.1.1 @@ -0,0 +1 @@ +MD5 4e6e2f8e69172cf71c1c2fab73bedb52 eagle-usb-2.1.1.tar.bz2 906750 diff --git a/net-dialup/eagle-usb/files/dsl.peer b/net-dialup/eagle-usb/files/dsl.peer new file mode 100644 index 000000000000..05346b7a3354 --- /dev/null +++ b/net-dialup/eagle-usb/files/dsl.peer @@ -0,0 +1,15 @@ +pty "/usr/sbin/pppoa -I ${EAGLE_IF}" +user "your_login_here" +mru 1496 +mtu 1496 +noipdefault +defaultroute +usepeerdns +noauth +persist +nobsdcomp +nodeflate +nopcomp +novj +novjccomp +noaccomp -am diff --git a/net-dialup/eagle-usb/files/initd b/net-dialup/eagle-usb/files/initd new file mode 100644 index 000000000000..788d09768819 --- /dev/null +++ b/net-dialup/eagle-usb/files/initd @@ -0,0 +1,320 @@ +#!/sbin/runscript +# Charlie's modified version /etc/init.d/eagle-usb +# should allow to have other ppp links up at the same time. +# should have got rid of the race condition which seemed to show when +# doing a restart + +PPP=$(which pppd 2>/dev/null) +EAGLECTRL=$(which eaglectrl 2>/dev/null) +UMOUNT=$(which umount 2>/dev/null) +IFCONFIG=$(which ifconfig 2>/dev/null) +GREP=$(which grep 2>/dev/null) +LSMOD=$(which lsmod 2>/dev/null) +MAX_LOOP=160 +EAGLESTAT=$(which eaglestat 2>/dev/null) +DHCPCD=$(which dhcpcd 2>/dev/null) +ROUTE=$(which route 2>/dev/null) +LOGGER=$(which logger 2>/dev/null) + +LINKPIDFILE="/var/run/ppp-$LINKNAME.pid" +# pipe output to $LOGGERCMD to either get it to go to logger or to /dev/null +LOGGERCMD="cat" +case "$DEBUG" in + YES|yes) + [ -x ${LOGGER} ] && LOGGERCMD="${LOGGER} -t eagle-usb" + ;; +esac + +check_pre_run () { + # Check module is loaded + (${LSMOD} | ${GREP} -q 'eagle.usb'); eend $? "Module eagle-usb is not loaded." || return 1 + + # Check for eaglectrl + [ -x ${EAGLECTRL} ] ; eend $? "Cannot find eaglectrl" || return 1 + + # And showstat + [ -x ${EAGLESTAT} ] ; eend $? "Cannot find eaglestat" || return 1 + + # And METHOD + [ "${METHOD:-set}" != set ] ; eend $? "Please define METHOD in /etc/conf.d/eagle-usb" || return 1 + + # And options + [ "${OPTIONS:-set}" != set ] ; eend $? "Please define OPTIONS in /etc/conf.d/eagle-usb" || return 1 + [ -f ${OPTIONS} ] ; eend $? "Can't find OPTIONS file ${OPTIONS}" || return 1 + + # And DSP + [ "${DSP:-set}" != set ] ; eend $? "Please define DSP in /etc/conf.d/eagle-usb" || return 1 + [ -a ${DSP} ] ; eend $? "Can't find DSP file ${DSP}" || return 1 + + # And synchro timeout + [ "${SYNCHRO_TIMEOUT:-set}" != set ] ; eend $? "Please define SYNCHRO_TIMEOUT in /etc/conf.d/eagle-usb" || return 1 + + # And linkname + [ "${LINKNAME:-set}" != set ] ; eend $? "Please define LINKNAME=\"eagle\" in /etc/conf.d/eagle-usb" || return 1 + + # Check usbdevfs is up and running ?should we eend if mount fails? + ( ${MOUNT} | ${GREP} -q usbdevfs) || ${MOUNT} none /proc/bus/usb -t usbdevfs >/dev/null 2>&1 + + return 0 +} + + +check_ppp () { + + # Check for PPP + [ ! -z ${PPP} ] ; eend $? "failed to find ppp" || return 1 + + # Check for PEER file + [ "${PEER:-set}" != set ] ; eend $? "Please define \$PEER in /etc/conf.d/eagle-usb" || return 1 + [ -f /etc/ppp/peers/${PEER} ] ; eend $? "Failed to find peer ${PEER} configuration" || return 1 + + # Check for IFCONFIG + [ -x ${IFCONFIG} ]; eend $? "Failed to find 'ifconfig'" || return 1 +} + +check_dhcpcd () { + + # check for DHCPCD + [ ! -z ${DHCPCD} ] ; eend $? "failed to find dhcpcd" || return 1 + + # Check for IFCONFIG + [ -x ${IFCONFIG} ]; eend $? "Failed to find 'ifconfig'" || return 1 + + # Check for ROUTE + [ -x ${ROUTE} ]; eend $? "Failed to find 'route'" || return 1 + +} + +launch_pppd () { + local RETURNED=1 + local LOOP=0 + + echo "Starting Link $LINKNAME" | ${LOGGERCMD} > /dev/null + einfo "Launching PPP daemon ..." + + # Get interface name + export EAGLE_IF=`${EAGLECTRL} -i` + + # Set network interface + ${IFCONFIG} ${EAGLE_IF} 192.168.60.30 netmask 255.255.255.0 up + + # have to use a pidfile as well as exec, so we can use pppd for other things + # pppd will also give us a file containing both interface name and pid if we + # use the linkname option + start-stop-daemon --start --pidfile "$LINKPIDFILE" --exec ${PPP} call ${PEER} linkname $LINKNAME ${PPPDOPTS} | "$LOGGERCMD" >/dev/null 2>&1 + + # Wait for connection to be established + while [ ${RETURNED} -ne 0 ] && [ ${LOOP} -le ${MAX_LOOP} ] ; do + let LOOP=LOOP+1 + sleep 1 + #I'm not sure whether to do this every iteration, but it can't hurt... + find_eagle_pppif + TMP=$? + echo "Waiting for link $LINKNAME (${PPP_INTERFACE}) to start: $LOOP of $MAX_LOOP" | ${LOGGERCMD} > /dev/null + if [ $TMP -eq 0 ] ; then + # echo "Waiting for link $LINKNAME (${PPP_INTERFACE}) to start" + # shouldn't confuse ppp1 and ppp10 + ${IFCONFIG} | grep -q "${PPP_INTERFACE}[[:space:]]" + RETURNED=$? + fi + done + + if [ ${LOOP} -gt ${MAX_LOOP} ] && [ ${RETURNED} -ne 0 ] ; then + echo "Link $LINKNAME (${PPP_INTERFACE}) failed to start" | ${LOGGERCMD} > /dev/null + return 1 + else + echo "Link $LINKNAME (${PPP_INTERFACE}) started" | ${LOGGERCMD} > /dev/null + return 0 + fi +} + +stop_ppp () { + + local RETURNED=0 + local LOOP=0 + echo "Stopping Link $LINKNAME (${PPP_INTERFACE})" | ${LOGGERCMD} > /dev/null + find_eagle_pppif ; + + if [ -f $LINKPIDFILE ] + then + start-stop-daemon --stop --pidfile $LINKPIDFILE pppd + + # Wait for connection to go away + find_eagle_pppif ; + while [ ${RETURNED} -ne 1 ] && [ ${LOOP} -le ${MAX_LOOP} ] ; do + let LOOP=LOOP+3 + sleep 1 + echo "Waiting for link $LINKNAME (${PPP_INTERFACE}) to go away" | ${LOGGERCMD} > /dev/null + # could just use return value of find_eagle_pppif? + # but then would have to check whether the interface exists + # and delete the pidfile if it doesn't? but then would have + # a race condition? + ${IFCONFIG} | grep -q "${PPP_INTERFACE}[[:space:]]" + RETURNED=$? + done + + if [ ${LOOP} -gt ${MAX_LOOP} ] && [ ${RETURNED} -ne 1 ] ; then + echo "Link $LINKNAME (${PPP_INTERFACE}) failed to stop" | ${LOGGERCMD} > /dev/null + return 1 + else + echo "Link $LINKNAME (${PPP_INTERFACE}) stopped" | ${LOGGERCMD} > /dev/null + return 0 + fi + else + echo "File $LINKPIDFILE not found" | ${LOGGERCMD} > /dev/null + return 1 + fi +} + + +launch_dhcpcd () { + # Get interface + export EAGLE_IF=`${EAGLECTRL} -i` + + # Launch dhcpcd + start-stop-daemon --start --exec ${DHCPCD} -- ${DHCPCDOPTS} ${EAGLE_IF} >/dev/null 2>&1 + +} + + +stop_dhcpd () { + # Get interface + export EAGLE_IF=`${EAGLECTRL} -i` + + # Stop dhcpcd + start-stop-daemon --stop --quiet --pidfile /var/run/dhcpcd-${EAGLE_IF}.pid + + +} + +launch_static () { + local RETURNED=1 + local LOOP=0 + + einfo "Launching ADSL connexion..." + + # Get interface + export EAGLE_IF=`${EAGLECTRL} -i` + + # Set network interface + ebegin "Bringing interface WAN (usb modem) (${EAGLE_IF}) up: ${STATIC_IP}/${STATIC_NM}" + ${IFCONFIG} ${EAGLE_IF} ${STATIC_IP} netmask ${STATIC_NM} up + eend $? + + # Setting default gateway + ebegin " Setting default gateway:${STATIC_GW} via inteface ${EAGLE_IF}" + route add default gw ${STATIC_GW} + eend $? +} + +stop_static () { + # Get interface + export EAGLE_IF=`${EAGLECTRL} -i` + + # Bringing down interface + ebegin "Bringing down interface WAN (usb modem) ${EAGLE_IF}" + route del default + eend $? +} + + + +modem_is_operational () { + # To be operational, firmware should be loaded. This mean, /proc/driver/eagle-usb + # directory is not empty + if ls /proc/driver/eagle-usb/* 1>/dev/null 2>&1 + then + # Check "Modem is operational" + ${EAGLESTAT} | grep -q "Modem is operational" + else + return 1 + fi +} + +load_and_sync () { + # Load firmware /DSP/ etc only if the modem is not yet operational + if modem_is_operational + then + einfo "Modem already operational" + else + einfo "Loading firmware, DSP and trying to sync ..." + ${EAGLECTRL} -w -o${OPTIONS} -d${DSP} -s${SYNCHRO_TIMEOUT} | \ + ${LOGGERCMD} 1>/dev/null 2>&1 + fi + + return $? +} + +depend () { + need modules logger +} + + +find_eagle_pppif() +{ + # identify which ppp interface is using the eagle. + # returns zero for success, 1 if interface not found. + PPP_INTERFACE="" + # LINKPIDFILE is defined at top of script- "/var/run/ppp-${LINKNAME}.pid" + # ppp kindly gives us both the PID and the interface name in the file + if [ -r "$LINKPIDFILE" ] ; then + LINKPID=`grep -o -E '^[0-9]+' "${LINKPIDFILE}"` + PPP_INTERFACE=` grep -o -E '^ppp[0-9]+' "${LINKPIDFILE}"` + fi + if [ -z "$PPP_INTERFACE" ] ; then + return 1 ; + else + return 0 ; + fi +} + + +start () { + + ebegin "Starting eagle-usb ..." + + # Check everything needed is in place + check_pre_run ; eend $? "Pre-requesites check failed" || return 1 + + # Let's try to upload firmware/dsp and do synchro + load_and_sync ; eend $? "Failed to load or sync" || return 1 + + case "${METHOD}" in + "pppoa") + # launching ppp daemon + launch_pppd ; eend $? "Failed to start pppd daemon." || return 1 + ;; + "dhcpip") + # launching dhcpcd + launch_dhcpcd ; eend $? "Failed to start dhcpcd daemon." || return 1 + ;; + "staticip") + launch_static ; eend $? "Failed to start with static IP." || return 1 + ;; + esac + + # Cool .. we're plugged .. + return 0 +} + +stop () { + export EAGLE_IF=`${EAGLECTRL} -i` + + ebegin "Shutting down eagle-usb..." + + case "${METHOD}" in + "pppoa") + stop_ppp ; eend $? "Failed to stop 'pppd'" + ;; + "dhcpip") + stop_dhcpd ; eend $? "Failed to stop 'dhcpcd'" + ;; + "staticip") + stop_static ; eend $? "Failed to stop static IP." || return 1 + ;; + esac + + ${IFCONFIG} ${EAGLE_IF} down 1>/dev/null 2>&1 + + +} diff --git a/net-dialup/eagle-usb/metadata.xml b/net-dialup/eagle-usb/metadata.xml new file mode 100644 index 000000000000..ab386ea35cdd --- /dev/null +++ b/net-dialup/eagle-usb/metadata.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>net-dialup</herd> +<longdescription>GPL Driver for Eagle Chipset powered ADSL modem</longdescription> +</pkgmetadata> |