#!/bin/sh # #DIALOG=Xdialog DIALOG=dialog # # name of your default isp: defaultisp=maxnet # error() { echo "$1" exit 2 } help() { cat < /dev/null; then # we are already online $DIALOG --title "go offline" --yesno "Click YES to terminate the ppp connection" 0 0 rval="$?" clear if [ "$rval" = "0" ]; then echo "running /etc/ppp/scripts/ppp-off ..." /etc/ppp/scripts/ppp-off fi else # no ppp connection found, go online # get the names of all available ISP by listing /etc/ppp/peers for f in `ls /etc/ppp/peers`; do if [ -f "/etc/ppp/peers/$f" ]; then isplist="$isplist $f ==" fi done [ -z "$isplist" ]&& error "No isp def found in /etc/ppp/peers" # $DIALOG --default-item "$defaultisp" --title "pppdialout" --menu "Please select one of\ the following ISPs for dialout" 0 0 0 $isplist 2> $tempfile rval="$?" # return status, isp name will be in $tempfile clear if [ "$rval" = "0" ]; then isp=`cat $tempfile` echo "running /etc/ppp/scripts/ppp-on $isp..." /etc/ppp/scripts/ppp-on "$isp" else echo "Cancel..." fi rm -f $tempfile fi # end of pppdialout