#!/bin/sh # Author: Benoit PAPILLAULT # Creation: 12/05/2004 # # Author : Edouard Gomez # Last Modifs : May, the 7th 2002 # # ToDo : this needs a special module configuration for debian # which uses files in /etc/modules/ and then run update-modules # Setup the connection # mandatory options : # ask vpi # ask vci # ask username # ask password # advanced options : # automatic reconnection : yes # hotplug support : yes # depending on kernel version and distro (debian) # -> update /etc/modules.conf , /etc/modutils/speedtouch or /etc/modprobe.conf # check for /etc/speedtouch/*.zip # Ensure to have a working PATH prefix=@prefix@ exec_prefix=@exec_prefix@ export PATH=/sbin:/bin:/usr/sbin:/usr/bin:@sbindir@:@bindir@ # Configuration script for the pppd daemon PEER_PPPOA="speedtouch-pppoa" PEER_PPPOE="speedtouch-pppoe" PPP_DIR="/etc/ppp" PEER_DIR="${PPP_DIR}/peers" CHAP_FILE="/etc/ppp/chap-secrets" PAP_FILE="/etc/ppp/pap-secrets" PPPOA3=`which pppoa3` WHOAMI=`whoami` PEER_PPPOA_FILE="${PEER_DIR}/${PEER_PPPOA}" PEER_PPPOE_FILE="${PEER_DIR}/${PEER_PPPOE}" # check for root privileges if [ "$WHOAMI" != "root" ]; then echo "You must launch this script with root privileges. Enter root password." exec su -c "$0 $@" exit -1 fi echo "PPPD Configuration Script for GNU/Linux" echo function usage() { cat < "${PEER_PPPOA_FILE}" < "${PEER_PPPOE_FILE}" < "${CONF}" < $CHAP_FILE echo "# client server secret IP addresses" >> $CHAP_FILE fi # Creates the pap file if needed if [ ! -f $PAP_FILE ] ; then echo Creating $PAP_FILE touch $PAP_FILE chmod 600 $PAP_FILE echo "# Secrets for authentication using PAP" > $PAP_FILE echo "# client server secret IP addresses" >> $PAP_FILE fi # Saves old files echo Saving old $CHAP_FILE to $CHAP_FILE.old cp -f $CHAP_FILE $CHAP_FILE.old chmod 600 $CHAP_FILE.old echo Saving old $PAP_FILE to $PAP_FILE.old cp -f $PAP_FILE $PAP_FILE.old chmod 600 $PAP_FILE.old # Remove old login entry from pap and chap file echo Removing old $LOGIN entry from $CHAP_FILE grep -v $LOGIN $CHAP_FILE.old > $CHAP_FILE echo Removing old $LOGIN entry from $PAP_FILE grep -v $LOGIN $PAP_FILE.old > $PAP_FILE # Add the new entry echo Adding new $LOGIN entry to $CHAP_FILE echo $SECRETLINE >> $CHAP_FILE echo Adding new $LOGIN entry to $PAP_FILE echo $SECRETLINE >> $PAP_FILE # # Add ppp entries to /etc/modules.conf # if [ -f /etc/conf.modules ] ; then MODULE_CONF="/etc/conf.modules" fi if [ -f /etc/modules.conf ] ; then MODULE_CONF="/etc/modules.conf" fi # # We handle the Debian way here # if [ -f /etc/debian_version ]; then MODULE_CONF="/etc/modutils/hdlc" echo "Configuring the modules.conf the debian way !" fi echo "Adding ppp entries to your $MODULE_CONF" # This bunch of aliases are already defined in debian systems if [ ! -f /etc/debian_version ]; then echo >> $MODULE_CONF grep -q "char-major-108" $MODULE_CONF if [ $? -ne 0 ] ; then echo "alias char-major-108 ppp_generic" >> $MODULE_CONF fi grep -q "tty-ldisc-3" $MODULE_CONF if [ $? -ne 0 ] ; then echo "alias tty-ldisc-3 ppp_async" >> $MODULE_CONF fi fi # This one needs to be added in every case grep -q "tty-ldisc-13" $MODULE_CONF if [ $? -ne 0 ] ; then echo "alias tty-ldisc-13 n_hdlc" >> $MODULE_CONF fi # This bunch of aliases are also already defined in debian systems if [ ! -f /etc/debian_version ]; then grep -q "tty-ldisc-14" $MODULE_CONF if [ $? -ne 0 ] ; then echo "alias tty-ldisc-14 ppp_synctty" >> $MODULE_CONF fi grep -q "ppp-compress-21" $MODULE_CONF if [ $? -ne 0 ] ; then echo "alias ppp-compress-21 bsd_comp" >> $MODULE_CONF fi grep -q "ppp-compress-24" $MODULE_CONF if [ $? -ne 0 ] ; then echo "alias ppp-compress-24 ppp_deflate" >> $MODULE_CONF fi grep -q "ppp-compress-26" $MODULE_CONF if [ $? -ne 0 ] ; then echo "alias ppp-compress-26 ppp_deflate" >> $MODULE_CONF fi fi # # We update the /etc/modules.conf with the debian tool # if [ -f /etc/debian_version ]; then echo "Updating /etc/modules.conf using update-modules" update-modules fi # Finished... echo echo PPPD configuration done.