[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fwd: T-DSL mit KNOPPIX



#include <hallo.h>
Oliver Zendel wrote on Tue Sep 04, 2001 um 05:39:03PM:
> On Tue, Sep 04, 2001 at 05:19:41PM +0200, Eduard Bloch wrote:
> > Ich nehme an, für Knoppix wäre ein Konfig-Dialog-GUI nötig, stimmt es?
> > Bei Bedarf -> Mail und ich bastele sowas.
> 
> na dann fang mal an :)

Siehe Anhang. Das ist die Version 0.3. Was ich gestern Klaus geschickt
habe sollte man nicht verwenden. Und bitte kein gdialog verwenden, das
schrottet im Endeffekt Dateien.

Gruss/Regards,
Eduard.
-- 
Vielleicht sollten alle ihre Web-Seiten ausdrucken
und von innen gegen die Fensterscheiben kleben?
Dann würde man wieder mehr spazieren gehen...
                    -- "Pale Male" in heise online
#!/bin/bash
# (c) Eduard Bloch <blade@debian.org>
# LICENSE: GPL
# Purpose: initial PPPoE configuration on Debian
# Depends: pppd, pppoe, dialog, pppconfig (because of the 0dns-up script)
# Version: 0.3, 05-09-2001

#DIALOG=${DIALOG=dialog}
DIALOG=dialog
sectempfile=`tempfile -d /etc/ppp 2>/dev/null` || exit 1
trap "rm -f $sectempfile" 0 1 2 5 15

if ls -d /proc/sys/net/ipv4/conf/eth*; then
  list=`cd /proc/sys/net/ipv4/conf ; ls eth* -d`;
  number=`echo $list | wc -w| tr -d " "`
  $DIALOG --title "ALL DEVICES FOUND?" --clear --yesno "I found $number ethernet devices:\n $list \n\nAre all your ethernet interfaces listed above?\n(If No, modconf will be started so you can load the card drivers manually)." 15 45
  case $? in
    1)
    # configure and restart
      modconf
      $0
      exit $?
      ;;
  esac
  # now, execute an AC lookup on each interface
  for iface in $list; do
    touch /tmp/pppoe.scan
    (pppoe -A -I $iface > /tmp/$iface.pppoe ; rm /tmp/pppoe.scan) &
    ( time=0 ; while test -f /tmp/pppoe.scan ; do time=`expr $time + 6`; echo $time; sleep 1; done ) | $DIALOG --title "SCANNING DEVICE" --gauge "Looking for PPPoE Access Concentrator on $iface..." 10 40 0
  done
  cd /tmp
  iface=`grep -l AC eth*.pppoe| cut -f1 -d"." | head -n1`
  if test -z "$iface" ; then
    $DIALOG --title "NOT CONNECTED" --clear --msgbox "Sorry, I scanned $number interfaces, but the Access Concentrator of your provider did not respond. Please check your network and modem cables."
    exit 1;
  fi
  $DIALOG --title "DSL CONNECTION FOUND" --clear --yesno "I found an Access Concentrator on $iface. Should I setup PPPOE for this connection?" 10 40
  case $? in
  0)
  true
  ;;
  *)
  exit 1
  ;;
  esac
  # STATUS: interface is $iface, we can continue
  sed -e "s/eth[:0-9:]* /$iface /" /etc/ppp/peers/dsl-provider > $sectempfile
  mv $sectempfile /etc/ppp/peers/dsl-provider
  user=`grep ^user /etc/ppp/peers/dsl-provider|cut -f2 -d" " | tr -d '"'`
  $DIALOG --nocancel --title "ENTER USERNAME" --clear --inputbox "Please enter the username which you usually need for the PPP login to your provider in the input box below." 16 51 $user 2> $sectempfile
  user=`cat $sectempfile`
  case $? in
  0)
    sed -e 's/^user .*//' /etc/ppp/peers/dsl-provider > $sectempfile
    mv $sectempfile /etc/ppp/peers/dsl-provider
    echo  "user \"$user\"" >> /etc/ppp/peers/dsl-provider
    ;;
  *)
    exit 1
    ;;
  esac

  $DIALOG --nocancel --title "ENTER PASSWORT" --clear --inputbox "Please enter the password which you usually need for the PPP login to your provider in the input box below. NOTE: you can see the password in plain text while typing." 16 51 2> $sectempfile
  pass=`cat $sectempfile`
  case $? in
  0)
    sed -e "s/^\"*$user\"* .*//" /etc/ppp/pap-secrets > $sectempfile
    mv $sectempfile /etc/ppp/pap-secrets
    echo "\"$user\" * \"$pass\"" >> /etc/ppp/pap-secrets
    ;;
  *)
    exit 1
    ;;
  esac

  # ask about DNS
  $DIALOG --title "USE PEER DNS" --clear --yesno "You need some DNS addresses to resolve the normal host names. Normally your provider sends you addresses of useable servers when the connection is established. Would you like to add these addresses automaticaly to the list on nameservers in your local /etc/resolv.conf file? (recommended)" 15 45
  case $? in
  0)
    sed -e 's/usepeerdns//' /etc/ppp/peers/dsl-provider > $sectempfile
    mv $sectempfile /etc/ppp/peers/dsl-provider
    echo "usepeerdns" >> /etc/ppp/peers/dsl-provider
  ;;
  esac
  
  rm $sectempfile
  $DIALOG --title "DONE" --clear --yesno "Your PPPD is configured now. Now, you can make an DSL connection with \"pon dsl-provider\" and terminate it with \"poff\". Would you like to start the connection now?" 15 61
  case $? in
  0)
    pon dsl-provider
    watch /sbin/ifconfig ppp0
    ;;
  *)
    exit 0
    ;;
  esac

else
  $DIALOG --title "NO INTERFACE FOUND" --clear --yesno "Sorry, no working ethernet card could be found. If you do have an interface card which was not autodetected so far, you probably wish to load the driver manually using the modconf utility. Run modconf now?" 15 61
  case $? in
  0)
    modconf
    $0
    exit $?
    ;;
  *)
    exit 1
    ;;
  esac
fi

Attachment: pgpaBNUuWEvVg.pgp
Description: PGP signature


Reply to: