systemd/debian/extra/dsl-modem.agent
Michael Biebl b56f8637a1 Merge remaining files from udev 175-7
The patches from udev were either merged upstream, applied directly,
added as files to debian/extra/ or dropped:

- debian/patches/commit-4b50a3d
  Applied upstream in 4b50a3d004
- debian/patches/fix_gtkdoc_oot
  Fixed upstream
- debian/patches/libudevpc_no_librt
  Fixed upstream in e712ffcce6
- debian/patches/vio_type
  Dropped for now.
- debian/patches/debian_rules
  Added as debian/extra/rules/*
- debian/patches/extra_agents
  Added as debian/extra/*.agent and debian/extra/hotplug.functions
- debian/patches/extra_initramfs
  Added as debian/extra/initramfs.*
- debian/patches/extra_installer
  Added as debian/extra/udev.*
- debian/patches/extra_modprobeconf
  Added as debian/extra/fbdev-blacklist.conf and
  debian/extra/make-fbdev-blacklist
- debian/patches/extra_misc
  Added as debian/extra/links.conf and debian/extra/create_static_nodes
- debian/patches/dont-build-some-helpers
  Dropped, since we will use the upstream firmware agent now
- debian/patches/libgudev_in_usr
  Applied as 418b0a2d41
- debian/patches/rules_compat_qemu
  Dropped, only needed for kernel versions <= 2.6.32
- debian/patches/use_run_tmpfs
  Dropped, since wheezy /run is mandatory
- debian/patches/dev_root_rule
  Dropped, discouraged upstream
- debian/patches/udevd_in_sbin
  Dropped, we will use the $libexec path now in the .service file and
  provide compat symlinks
- udev_conf_comments
  Applied as c82d84e916
2013-07-18 18:57:39 +02:00

103 lines
2.2 KiB
Bash

#!/bin/sh -e
#
# Copyright 2008 Marco d'Itri <md@Linux.IT>
#
# This script automatically starts networking when a DSL modem is connected
# and its ATM interface is ready.
#
#
# For PPPoE you can set PROTOCOL=2684bridged and then add something like
# this to /etc/network/interfaces:
#
# allow-hotplug nas0
# iface nas0 inet manual
# pre-up ip link set up $IFACE
# up pppd persist call dsl-provider
#
#
# Support for CLIP (Classical IP over ATM, RFC 1577) may be incomplete.
#
# defaults
[ "$IP_INTERFACE" ] || IP_INTERFACE='nas0'
[ "$VP" ] || VP='8'
[ "$VC" ] || VC='35'
if [ -e /etc/default/dsl-modem.agent ]; then
. /etc/default/dsl-modem.agent
fi
# just exit unless a protocol is configured
[ "$PROTOCOL" ] || exit 0
##############################################################################
wait_and_run_pppd() {
# this guarantees that everything pppd needs to work is ready
wait_for_file /dev/log
exec pppd persist call ${PPP_PEER:-dsl-provider}
}
wait_and_run_br2684ctl() {
wait_for_file /dev/log
exec br2684ctl $BR2684_ARGS -b -c ${IP_INTERFACE#nas} \
-a ${ATM_INTERFACE}.${VP}.${VC}
}
wait_and_run_atmarp() {
wait_for_file /var/run/atmarpd.table
# create the IP interface
atmarp -c ${IP_INTERFACE:-atm0}
# setup the VC
# atmarp -s 192.0.2.254 ${ATM_INTERFACE}.${VP}.${VC}
exec ifup ${IP_INTERFACE:-atm0} # XXX
}
##############################################################################
ATM_DRIVER=${NAME%%[0-9]*}
ATM_INTERFACE=${NAME##$ATM_DRIVER}
# is this a DSL modem?
case "$ATM_DRIVER" in
cxacru|speedtch|ueagle-atm|xusbatm|UNICORN) ;;
*) exit 0 ;;
esac
cd /lib/udev/
. ./hotplug.functions
##############################################################################
case "$ACTION" in
add)
case "$PROTOCOL" in
pppoa) wait_and_run_pppd & ;;
2684bridged) wait_and_run_br2684ctl & ;;
clip) wait_and_run_atmarp & ;;
esac
;;
remove)
case "$PROTOCOL" in
pppoa)
# pppd will terminate automatically
;;
2684bridged)
PIDFILE="/var/run/br2684ctl-$IP_INTERFACE.pid"
if [ -e $PIDFILE ]; then
kill $(cat $PIDFILE)
rm -f $PIDFILE
fi
;;
clip)
ifdown ${IP_INTERFACE:-atm0} # XXX
# atmarp -d 192.0.2.254
;;
esac
;;
esac
exit 0