#!/bin/sh #------------------------------------------------------------------------------ # /etc/rc.d/rc340.circuits - setup circuits # was file /etc/rc.d/circuits # # Creation: 17.11.2000 fm # Last Update: $Id$ #------------------------------------------------------------------------------ begin_script CIRCUITS "preparing circuits ..." # add_imond_entry expects dev name phone bandwidth hup_timeout route times chargeint type add_imond_entry () { case $route in 0.0.0.0/0) droute='yes' ;; *) droute='no' ;; esac set $times all=`echo $*` for j in $all do set `echo $j | sed 's/:/ /g'` days=$1 hours=$2 charge=$3 is_lcr=$4 lcr='no' case $is_lcr in Y | y) if [ "$droute" = 'yes' ] then lcr='yes' # imond handles route fi ;; N | n) lcr=no ;; D | d) lcr=disabled ;; esac if [ -z "$days" -o -z "$hours" -o -z "$dev" -o -z "$bandwidth" -o -z "$hup_timeout" -o -z "$lcr" -o -z "$route" -o -z "$phone" -o -z "$name" -o -z "$charge" -o -z "$chargeint" ] then log_error "empty variable in add_imond_entry" fi if [ "$IMOND_USE_ORIG" != yes -a "$dev" = pppoe ]; then dev=ppp0 fi echo $days $hours $dev $bandwidth \ $hup_timeout $lcr $droute $phone $name \ $charge $chargeint $type done >>/etc/imond.conf } if [ ! -f /etc/ppp/pap-secrets ] # already existing? then # yes, don't overwrite echo "writing /etc/ppp/pap-secrets ..." { echo "#----------------------------------------------------------------------------" echo "# /etc/ppp/pap-secrets - secrets for authentication using PAP" echo "# automatically created by rc340.circuits" echo "#" echo "# client server secret IP addresses" echo "#----------------------------------------------------------------------------" } >/etc/ppp/pap-secrets chmod 600 /etc/ppp/pap-secrets fi if [ ! -f /etc/ppp/chap-secrets ] # already existing? then # yes, don't overwrite ln -s /etc/ppp/pap-secrets /etc/ppp/chap-secrets fi >/etc/imond.conf # write imond configuration mkdir -p /etc/ppp/peers end_script