123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841 |
- #!/bin/bash
- #(c) Copyright 2007 Barry Kauler www.puppylinux.com
- #2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
- #written for Puppy Linux 2.17+
- #BK v3.91: keep log if failed to connect, display in main status log.
- #BK v3.98: improve create mono font in status log. bugfixes.
- #BK v3.98: one bugfix had to be removed, which fixed another bugfix.
- #BK v3.99: corrected handling of params for each isp.
- #BK v3.99: added Stupid Mode and Auto reconnect checkboxes for each isp.
- #BK v4.00: crash bugfix.
- #HairyWill v4.00: handle init string with quotes, prevent gtkdialog crash.
- #v405 updated.
- #v408 old pap-secrets, chap-secrets problem has returned, workaround applied.
- #v408 rerwin: Make modem startup after 'erase' same as for first time with no conf file.
- #v409 rerwin: bugfix, need a delay for fast machines.
- #v412 rerwin: increase sleep from 0.3 to 1.
- #v465 rerwin: v413 add init strings for wireless modems
- #v477 rerwin: v413 add 'Reading...' splash message during sleep.
- #v424 rerwin: send PIN only on first wireless connection; move APNs to accounts; associate APN with dial accounts; retain dial type (DT/DP)
- #v431 rerwin: retain account checkbox changes; ensure optional lines associated with an account; add APN-specific commands; handle Idle Seconds lines
- #v433 rerwin: accomodate bluetooth-connected modems.
- #v433 Collect monthly transmission data.
- #101202 new script /usr/sbin/pupdial_init_hotpluggable, flag /var/local/pupdial/hotpluggable.
- #101203 wvdialconf will ignore many devs that are not /dev/ttyS*, for example /dev/ttyAGS3 (agrmodem).
- #101205 warning to wait 30 seconds after plugin.
- #101206 innapropriate for another active network interface.
- #101206 launch pupdial_wizard_helper after run wvdial.
- #101211 update PupDial if modem changes.
- #101217 new help button, for modem setup.
- #101218 passed param if re-run this script do not do probe of hotpluggable modems.
- #110505 support sudo for non-root user.
- #120202 rodin.s: internationalized.
- #120218 rerwin: Ensure non-null logon info for wvdial.
- #120329 Xdialog bug --yesno supposed to "yes" "No" buttons, but they are "OK" "Cancel".
- #120924 rerwin: correct setting of current modem device after erase.
- #130331 change "Mono 12" to "Mono 10".
- #130505 rerwin: notify network_tray of analog/wireless connection type
- #131214 zigbert: gui (gtkdialog) improvements.
- [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
- export TEXTDOMAIN=pupdial
- export TEXTDOMAINDIR=/usr/share/locale
- export OUTPUT_CHARSET=UTF-8
- eval_gettext () {
- local myMESSAGE=$(gettext "$1")
- eval echo \"$myMESSAGE\"
- }
- msg_help (){
- echo -e "$(gettext "This documentation has 2 chapters:\n1. Run wvdial\n2. Configure wvdial")\n\n\n
- ###################################################\n
- $(gettext 'R U N W V D I A L')\n
- ###################################################\n\n" > /tmp/box_help
- cat /usr/share/doc/wvdial/wvdial.txt >> /tmp/box_help
- echo -e "\n\n\n\n
- ###################################################\n
- $(gettext 'C O N F I G U R E W V D I A L')\n
- ###################################################\n\n" >> /tmp/box_help
- cat /usr/share/doc/wvdial/wvdial.conf.txt >> /tmp/box_help
- #box_help sees < > as markups, and will fail
- sed -i -e 's/>/]/g' -e 's/</[/g' /tmp/box_help
- /usr/lib/gtkdialog/box_help "$(gettext 'PupDial - Internet connection with analog dialup or digital wireless modem (3g)')" "file:///usr/share/doc/HOWTO_modem.htm" &
- }
- export -f msg_help
- #hint: for debugging, to force pupdial to ask all questions, delete /var/local/pupdial/hotpluggable
- Yes_lbl="$(gettext 'Yes')"
- No_lbl="$(gettext 'No')"
- KERNVER="`uname -r`"
- FLAGNEWPROBE='' #101203
- PASSEDPARAM=''
- [ $1 ] && PASSEDPARAM="$1" #101218
- if [ "$PASSEDPARAM" = "" ];then #101218 do not probe if re-running pupdial.
- #101206 innapropriate for another active network interface...
- #note, could run 'modemdisconnect' if want to disconnect dialup interface.
- /usr/sbin/networkdisconnect #but not ppp interface.
- if [ ! -f /var/local/pupdial/hotpluggable ];then #101202
- FLAGNEWPROBE='yes' #101203 flag 1st boot, or 'erase' button got clicked in pupdial (latter exits from pupdial).
- export HOTDIALOG="
- <window title=\"$(gettext 'PupDial modem Internet dialer')\" icon-name=\"gtk-connect\">
- <vbox>
- <text><label>$(gettext 'Welcome! First, a basic question: do you want to connect to the Internet using an internal fixed modem, or a removable (USB, serial, PCMCIA) modem?')</label></text>
- <text><label>`gettext \"The reason for asking this, is an internal modem will have been detected at bootup, but a 'hotpluggable' external modem may not have have been detected if plugged in after bootup. Also, if you have both, say an internal analog dialup modem, plus a USB modem, PupDial may choose the wrong one -- ticking or unticking the checkbox here will avoid that confusion...\"`</label></text>
- <checkbox><label>$(gettext 'Tick checkbox if external modem')</label><variable>CHK_HOT</variable></checkbox>
- <hbox><button ok></button></hbox>
- </vbox>
- </window>"
- RETSTRING="`gtkdialog --center -p HOTDIALOG`"
- CHK_HOT="`echo "$RETSTRING" | grep '^CHK_HOT' | cut -f 2 -d '"'`"
- [ "$CHK_HOT" = "" ] && CHK_HOT='false'
- echo -n "$CHK_HOT" > /var/local/pupdial/hotpluggable
- fi
- CHK_HOT="`cat /var/local/pupdial/hotpluggable`"
- if [ "$CHK_HOT" = "true" ];then
- #rm -f /dev/modem
- pupdial_init_hotpluggable
- fi
- fi
- MYDEVM="MYDEVM"
- [ -h /dev/modem ] && MYDEVM='/dev/'"`readlink /dev/modem`"
- [ "$MYDEVM" = "/dev/" ] && MYDEVM="MYDEVM" #101203
- #101203 wvdialconf will ignore many devs that are not /dev/ttyS*, for example /dev/ttyAGS3 (agrmodem)...
- #note, also have this code in /usr/sbin/modemprobe.
- if [ "$MYDEVM" != "MYDEVM" ];then
- MODEMDEV="`echo -n "$MYDEVM" | sed -e 's%/dev/%%'`" #could be in a subdir, ex: modems/mwave
- MODEMBASE="`basename $MODEMDEV`" #ex: modems/mwave becomes: mwave
- if [ "`echo -n "$MODEMBASE" | cut -c 1-4`" != "ttyS" ];then
- #some that are recognised by wvdialconf: ttyUSB* (v1.51), ttyLT* (v1.50), ttyACM*, ttyI* (v0.12)
- OK=0
- if [ "`echo -n "$MODEMBASE" | cut -c 1-3`" = "tty" ];then
- CHARS3="`echo -n "$MODEMBASE" | cut -c 4-6`"
- case $CHARS3 in
- USB) OK=1 ;;
- LT*) OK=1 ;;
- ACM) OK=1 ;;
- I*) OK=1 ;;
- esac
- fi
- if [ $OK -eq 0 ];then
- SMODEMDEV='ttyS_'"`echo -n "$MODEMBASE" | sed -e 's%^tty%%' | cut -c 1-20`"
- ln -snf $MODEMDEV /dev/$SMODEMDEV
- ln -snf $SMODEMDEV /dev/modem #so that wvdialconf will look here first.
- MYDEVM='/dev/'"$SMODEMDEV" #probably not essential
- fi
- fi
- fi
- #note, MYDEVM is placeholder for '/dev/ttyS0' whereas DEVM is just 'ttyS0'.
- #101203 logic reorganised...
- REPLACE='no'
- [ ! -s /etc/wvdial.conf ] && REPLACE='yes'
- if [ "$REPLACE" = "yes" ];then
- echo "[Dialer Defaults]
- Modem = ${MYDEVM}
- Baud = 57600
- Init1 =
- Init2 = ATZ
- Init3 =
- Carrier Check = no
- Dial Command = ATDT
- [Dialer isp1]
- Phone = MYISPPHONENUM
- Username = MYUSERNAME
- Password = MYPASSWORD
- [Dialer isp1apn]
- Init5 = AT+CGDCONT=1,\"IP\",\"\"
- [Dialer isp2]
- Phone = MY2ISPPHONENUM
- Username = MY2USERNAME
- Password = MY2PASSWORD
- [Dialer isp2apn]
- Init5 = AT+CGDCONT=1,\"IP\",\"\"
- [Dialer pin]
- Init1 = AT+CPIN=" > /etc/wvdial.conf
- fi
- if [ "$MYDEVM" != "MYDEVM" ];then #modem detected; make config agree with /dev/modem.
- SEDSCRIPT1="s%MYDEVM%$MYDEVM%" #101211 fix.
- SEDSCRIPT2="s%/dev/modem%$MYDEVM%"
- sed -i -e "$SEDSCRIPT1" -e "$SEDSCRIPT2" /etc/wvdial.conf
- fi
- #101211 hotpluggable modem may have changed....
- if [ "$FLAGNEWPROBE" != "yes" ];then
- if [ -h /dev/modem ];then
- if [ -f /etc/wvdial.conf ];then
- wvMODEM="`grep '^Modem =' /etc/wvdial.conf | head -n 1 | tr -s ' ' | cut -f 3 -d ' '`"
- newMODEM="/dev/`readlink /dev/modem | sed -e 's%/dev/%%'`"
- if [ -e ${newMODEM} ];then #precaution.
- if [ "$wvMODEM" != "$newMODEM" ];then
- Xdialog --left --wmclass "pupdial" --title "$(gettext 'PupDial: modem changed')" --ok-label "$(gettext 'UPDATE')" --cancel-label "$No_lbl" --yesno "`eval_gettext \"It seems that the modem has changed.\n
- It was '\\\${wvMODEM}', it is now '\\\${newMODEM}'\n
- Do you want to update PupDial?\n
- Recommend click UPDATE button...\"`" 0 0
- [ $? -eq 0 ] && FLAGNEWPROBE='yes'
- fi
- fi
- fi
- fi
- fi
- #i also want this to rerun after 'erase' button pressed in pupdial...
- if [ "$FLAGNEWPROBE" = "yes" ];then
- if [ "$MYDEVM" != "MYDEVM" -a "$MYDEVM" != "modem" ];then
- Xdialog --left --wmclass "pupdial" --title "$(gettext 'PupDial: modem found')" --ok-label "$(gettext 'TEST')" --cancel-label "$No_lbl" --yesno "`eval_gettext \"It seems that you have a modem, at port \\\${MYDEVM}\n
- However, it is recommended that you now click the 'TEST' button\n
- to test that it is working.\n
- \n
- Note 1: The test will also optionally probe for what is called an\n
- 'inialization string'. If you are running PupDial for the first time\n
- or have changed modems, you will definitely need to click the 'TEST'\n
- button and obtain an initialization string.\n
- \n
- Note 2: If you think that \\\${MYDEVM} might be the wrong modem,\n
- click the 'No' button and the main PupDial GUI has a 'CHOOSE' button\n
- that will enable you to test alternative modem interfaces.\n
- \n
- Recommend click 'TEST' to probe the modem...\"`" 0 0
- RETVAL=$?
- DEVM="`echo -n "$MYDEVM" | cut -f 3,4 -d '/'`"
- [ $RETVAL -eq 0 ] && modemtest $DEVM initonly
- fi
- fi
- #v413 Assure user... 120514 bigger font...
- yaf-splash -close never -bg orange -fontsize large -text "$(gettext 'Reading modem configuration file...')" &
- X1PID=$!
- #disconnect button...
- STATECONb="disabled"
- #v409 rerwin, bugfix...
- if [ "`pidof pppd`" != "" ];then #v409
- [ ! -f /etc/ppp/peers/wvdial ] && sleep 1 #v409 allow kill completion and repeat test. v412 0.3 to 1.
- [ "`pidof pppd`" != "" ] && STATECONb="enabled"
- fi #v409
- MSG1="$(gettext 'No modem detected! You cannot dialout!')"
- STATECONa="disabled"
- STATETEST="disabled" #101117
- STATECCM="yes"
- STATEDTM="yes"
- STATEBCM="yes"
- TESTMSG="Modem"
- #precaution...
- cat /etc/wvdial.conf | tr '\t' ' ' | tr -s ' ' > /tmp/wvdial.conf
- sync
- #Rerwin: v4.05 Substitute /dev/modem target for /dev/modem
- if [ "`grep '/dev/modem' /tmp/wvdial.conf`" != "" -a -h /dev/modem ];then #modem = /dev/modem & it exists
- SEDSCRIPT="s%/dev/modem%/dev/`readlink /dev/modem`%g"
- sed -i -e "$SEDSCRIPT" /tmp/wvdial.conf #replace device in-place
- fi
- mv -f /tmp/wvdial.conf /etc/wvdial.conf
- sync #v413 ensure config updated
- ISPM="`cat /etc/wvdial.conf | grep '^Phone = ' | head -n 2`"
- ACC1ISP="`echo "$ISPM" | head -n 1 | cut -f 3-6 -d ' '`"
- ACC2ISP="`echo "$ISPM" | tail -n 1 | cut -f 3-6 -d ' '`"
- USERM="`cat /etc/wvdial.conf | grep '^Username = ' | head -n 2`"
- ACC1USER="`echo "$USERM" | head -n 1 | cut -f 3 -d ' '`"
- ACC2USER="`echo "$USERM" | tail -n 1 | cut -f 3 -d ' '`"
- PASSM="`cat /etc/wvdial.conf | grep '^Password = ' | head -n 2`"
- ACC1PASS="`echo "$PASSM" | head -n 1 | cut -f 3 -d ' '`"
- ACC2PASS="`echo "$PASSM" | tail -n 1 | cut -f 3 -d ' '`"
- INIT5M="`cat /etc/wvdial.conf | grep '^Init5 = AT+CGDCONT=' | head -n 2`"
- [ "`grep '\[Dialer isp2apn\]' /etc/wvdial.conf`" = "" ] && INIT5M="`echo -e "$INIT5M\n"`"
- ACC1PRFL="`echo "$INIT5M" | head -n 1 | cut -f 3 -d '=' | cut -f 1 -d ','`"
- ACC2PRFL="`echo "$INIT5M" | tail -n 1 | cut -f 3 -d '=' | cut -f 1 -d ','`"
- ACC1APN="`echo "$INIT5M" | head -n 1 | cut -f 4 -d '\"' | sed 's/\\$/\\\\$/g;'`"
- ACC2APN="`echo "$INIT5M" | tail -n 1 | cut -f 4 -d '\"' | sed 's/\\$/\\\\$/g;'`"
- [ "$ACC1PRFL" = "" ] && ACC1PRFL="1"; [ "$ACC2PRFL" = "" ] && ACC2PRFL="1"
- #1st 'cut' fixes if the '/dev/' left off the device name...
- #note, initialised wvdial.conf has 'Modem = MYDEVM' where MYDEVM needs to become
- # '/dev/ttyS0' (for example)
- DEVM="`cat /etc/wvdial.conf | grep '^Modem = ' | cut -f 3 -d ' ' | cut -f 3 -d '/'`"
- DEVMALT="`cat /etc/wvdial.conf | grep '^#Modem = ' | tail -n 1 | cut -f 3 -d ' ' | cut -f 3 -d '/'`" #v432
- [ "$DEVM" = "" ] && DEVM='MYDEVM' #v4.00 bugfix, crashed if no DEVM.
- [ ! -f /tmp/pupdial.log ] && touch /tmp/pupdial.log #v408 rerwin, moved up.
- if [ "${DEVM}" != "MYDEVM" ];then
- [ -f /tmp/.pupdial-modem_detected ] \
- && rm -f /tmp/.pupdial-modem_detected \
- && MSG1="$(gettext 'Modem detected! Device interface:') /dev/$DEVM" \
- || MSG1="$(gettext 'Selected modem device interface:') /dev/$DEVM" #v433
- #101117 Protect HSF/HCF connections from lockup - ensure nvm files installed.
- [ "`pidof pppd`" = "" ] \
- && STATETEST="enabled" \
- && [ "`echo "${DEVM}" | grep 'ttySHSF[0-9]'`" = "" -o -d /etc/hsfmodem/nvm ] \
- && [ "`echo "${DEVM}" | grep 'ttySHCF[0-9]'`" = "" -o -d /etc/hcfpcimodem/nvm ] \
- && STATECONa="enabled" #dialout button.
- [ "$DEVMALT" = "" ] \
- && TESTMSG="$DEVM" \
- || TESTMSG="$DEVMALT" #v433
- TESTDEVM="$TESTMSG" #v432
- [ "`grep 'MODEM WAS NOT AUTOMATICALLY DETECTED' /tmp/pupdial.log`" != "" ] && echo -n "" > /tmp/pupdial.log
- if [ "`grep 'Barry Kauler' /tmp/pupdial.log`" = "" ];then
- echo -n "`gettext \"Welcome to PupDial, written by Barry Kauler, with
- contributions from Richard Erwin, for Puppy Linux.
- There is a configuration file, /etc/wvdial.conf, that is read by
- PupDial, and changes made to any of the above boxes will be saved
- to wvdial.conf when you click the 'Exit' or 'Connect' buttons.
- Note, you can also manually edit wvdial.conf with a text editor.
- If you are using PupDial for the first time, it is recommended that
- you click the help buttons, in particular the 'Modem setup' button.\"`" >> /tmp/pupdial.log
- fi
- else
- if [ "`grep 'Barry Kauler' /tmp/pupdial.log`" = "" ];then
- echo "`gettext \"Welcome to PupDial, written by Barry Kauler, with
- contributions from Richard Erwin, for Puppy Linux.
- A MODEM WAS NOT AUTOMATICALLY DETECTED, SO YOU
- NEED TO CLICK THE 'Choose modem' BUTTON. DO THIS NOW!\"`
- " > /tmp/pupdial.log
- fi
- fi
- BAUDM="`cat /etc/wvdial.conf | grep '^Baud = ' | cut -f 3 -d ' '`"
-
- #v4.00 HairyWill fixes for embedded $ " characters...
- INIT1M="`cat /etc/wvdial.conf | grep '^Init1 =' | head -n 1 | cut -f 3-12 -d ' ' | grep -v 'AT+CPIN=' | sed 's/"/\\\\"/g;s/\\$/\\\\$/g;'`" #v413
- INIT2M="`cat /etc/wvdial.conf | grep '^Init2 = ' | cut -f 3-12 -d ' '| sed 's/"/\\\\"/g;s/\\$/\\\\$/g;'`"
- INIT3M="`cat /etc/wvdial.conf | grep '^Init3 = ' | cut -f 3-12 -d ' '| sed 's/"/\\\\"/g;s/\\$/\\\\$/g;'`" #v413
- #v413 If first Init1 not null, move contents to Init2, and Init2 to Init3, to reserve Init1 for wireless PIN.
- [ "$INIT1M" != "" ] && INIT3M="$INIT2M" && INIT2M="$INIT1M" && INIT1M="" #v413
- #v413 Get values for Init1, 4, 6-9.
- WPINM="`cat /etc/wvdial.conf | grep '^Init1 = ' | tail -n 1 | cut -f 3 -d '='`"
- INIT4M="`cat /etc/wvdial.conf | grep '^#*Init4 =' | sed 's/"/\\"/g;;s/\$/\\$/g;s/$$//g;'`"
- [ "$INIT4M" = "" ] && INIT4M="#Init4 = AT+COPS=0,0,\"MYOPS\","
- INIT69M="`cat /etc/wvdial.conf | grep '^#*Init[6-9] =' | sed -e 's/"/\\"/g' -e 's/\$/\\$/g' -e 's/$$//'`"
- [ "$INIT69M" = "" ] && INIT69M="#Init6 = AT+CGEQMIN=1,4,64,384,64,384
- #Init7 = AT+CGEQREQ=1,4,64,384,64,384
- #Init8 = AT+CGDCONT?
- #Init9 = AT+COPS?"
- #v413 end
-
- DIALM="`cat /etc/wvdial.conf | grep '^Dial Command = ' | cut -f 4 -d ' '`"
- [ "`echo "$DIALM" | grep -E 'X3|X1'`" != "" ] && STATEDTM="no"
- [ "`echo "$DIALM" | grep -E 'X2|X1'`" != "" ] && STATEBCM="no"
- CCM="`cat /etc/wvdial.conf | grep '^Carrier Check = ' | cut -f 4 -d ' '`"
- [ "$CCM" = "no" ] && STATECCM="no"
- [ "`echo "$DIALM" | grep 'DP'`" = "" ] && DIALTYPE="DT" || DIALTYPE="DP" #v424
-
- #v3.99 there may be up to two of each of the above...
- ISPCNT=0 #v431
- echo -n "" > /tmp/pupdial_read
- cat /etc/wvdial.conf |
- while read ONELINE
- do
- ONELINE="`echo -n "$ONELINE" | tr '\t' ' ' | tr -s ' '`" #in case user puts in extra tabs and spaces.
- [ "$ONELINE" = "" -o "$ONELINE" = " " ] && continue
- #v431 begin
- case $ONELINE in
- "[Dialer isp1]") ISPCNT=1 ;;
- "[Dialer isp1apn]") ISPCNT=0 ;;
- "[Dialer isp2]") ISPCNT=2 ;;
- "[Dialer isp2apn]") ISPCNT=0 ;;
- esac
- [ $ISPCNT -eq 0 ] && continue
- #v431 end
- ONEPARAM="`echo -n "$ONELINE" | cut -f 1 -d '=' | sed -e 's/ $//'`"
- ONEVALUE="`echo -n "$ONELINE" | cut -f 2 -d '=' | sed -e 's/^ //'`"
- if [ "$ONEVALUE" != "" ];then
- case $ONEPARAM in
- "Dial Prefix") echo "DIAL_PREFIX${ISPCNT}='${ONEVALUE}'" >> /tmp/pupdial_read ;;
- "Login Prompt") echo "LOGIN_PROMPT${ISPCNT}='${ONEVALUE}'" >> /tmp/pupdial_read ;;
- "Password Prompt") echo "PASSWORD_PROMPT${ISPCNT}='${ONEVALUE}'" >> /tmp/pupdial_read ;;
- "Stupid Mode") echo "STUPID_MODE${ISPCNT}='${ONEVALUE}'" >> /tmp/pupdial_read ;;
- "Default Reply") echo "DEFAULT_REPLY${ISPCNT}='${ONEVALUE}'" >> /tmp/pupdial_read ;;
- "Auto Reconnect") echo "AUTO_RECONNECT${ISPCNT}='${ONEVALUE}'" >> /tmp/pupdial_read ;;
- "Idle Seconds") echo "IDLE_SECONDS${ISPCNT}='${ONEVALUE}'" >> /tmp/pupdial_read ;; #v431
- esac
- fi
- done
- eval "`cat /tmp/pupdial_read`"
-
- #v3.99
- ynSTUPID_MODE1=no
- [ "$STUPID_MODE1" = "1" -o "$STUPID_MODE1" = "yes" ] && ynSTUPID_MODE1=yes
- ynSTUPID_MODE2=no
- [ "$STUPID_MODE2" = "1" -o "$STUPID_MODE2" = "yes" ] && ynSTUPID_MODE2=yes
- ynAUTO_RECONNECT1=yes #default is on.
- [ "$AUTO_RECONNECT1" = "1" -o "$AUTO_RECONNECT1" = "yes" ] && ynAUTO_RECONNECT1=yes
- [ "$AUTO_RECONNECT1" = "0" -o "$AUTO_RECONNECT1" = "no" ] && ynAUTO_RECONNECT1=no
- ynAUTO_RECONNECT2=yes #default is on.
- [ "$AUTO_RECONNECT2" = "1" -o "$AUTO_RECONNECT2" = "yes" ] && ynAUTO_RECONNECT2=yes
- [ "$AUTO_RECONNECT2" = "0" -o "$AUTO_RECONNECT2" = "no" ] && ynAUTO_RECONNECT2=no
- MODEMINFO='
- <hbox space-expand="true" space-fill="true">
- <vbox space-expand="false" space-fill="false">
- <button>
- <label>'${TESTMSG}'</label>
- <visible>'${STATETEST}'</visible>
- <action>/usr/sbin/modemtest '${TESTDEVM}'</action>
- <action type="exit">reload</action>
- </button>
- <button>
- <label>'$(gettext 'Choose modem')'</label>
- <action>/usr/sbin/modemprobe</action>
- <action>cat /tmp/logwvdialprobe > /tmp/pupdial.log 2> /dev/null</action>
- <action type="exit">reload</action>
- </button>
- <checkbox>
- <label>'$(gettext 'Carrier check')'</label>
- <variable>CHECKCC</variable>
- <default>'${STATECCM}'</default>
- </checkbox>
- <checkbox>
- <label>'$(gettext 'Dialtone check')'</label>
- <variable>CHECKDT</variable>
- <default>'${STATEDTM}'</default>
- </checkbox>
- <checkbox>
- <label>'$(gettext 'Busy check')'</label>
- <variable>CHECKBC</variable>
- <default>'${STATEBCM}'</default>
- </checkbox>
- </vbox>
- <vseparator width-request="30" space-expand="false" space-fill="false"></vseparator>
- <vbox>
- <hbox tooltip-text="'$(gettext 'String for modem initialisation')'">
- <text><label>'$(gettext 'Initialisation string 2')'</label></text>
- <entry>
- <input>echo "'${INIT2M}'"</input>
- <variable>ENTRYINIT2M</variable>
- </entry>
- </hbox>
- <hbox tooltip-text="'$(gettext 'String for modem initialisation')'">
- <text><label>'$(gettext 'Initialisation string 3')'</label></text>
- <entry>
- <input>echo "'${INIT3M}'"</input>
- <variable>ENTRYINIT3M</variable>
- </entry>
- </hbox>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <hbox space-expand="true" space-fill="true">
- <text space-expand="false" space-fill="false"><label>'$(gettext 'Max speed')'</label></text>
- <entry width-request="100" space-expand="false" space-fill="false">
- <default>"'${BAUDM}'"</default>
- <variable>ENTRYBAUDM</variable>
- </entry>
- </hbox>
- <hbox space-expand="true" space-fill="true">
- <text space-expand="false" space-fill="false"><label>'$(gettext 'SIM PIN (if required)')'</label></text>
- <entry width-request="100" space-expand="false" space-fill="false">
- <visible>password</visible>
- <input>echo "'${WPINM}'"</input>
- <variable>ENTRYWPINM</variable>
- </entry>
- </hbox>
- </vbox>
- </hbox>'
- export PupDial='
- <window title="PupDial - '$(gettext 'Modem Internet dialer')'" icon-name="gtk-connect">
- <vbox space-expand="true" space-fill="true">
- '"`/usr/lib/gtkdialog/xml_info fixed internet_connect.svg 60 "$(gettext 'Connect to internet with a analog dialup or digital wireless (3g) modem')" "<b>$MSG1</b>"`"'
- <frame '$(gettext 'Modem setup')'>
- '${MODEMINFO}'
- </frame>
- <hbox>
- <notebook labels="'$(gettext 'Account 1|Account2')'" space-expand="true" space-fill="true">
- <hbox border-width="10" space-expand="true" space-fill="true">
- <button image-position="2" tooltip-text="'$(gettext 'Connect to the Internet')'" space-expand="false" space-fill="false">
- <label>" '$(gettext 'Connect')' "</label>
- '"`/usr/lib/gtkdialog/xml_button-icon internet_connect.svg big`"'
- <visible>'${STATECONa}'</visible>
- <action type="exit">CONNECT1</action>
- </button>
- <vbox space-expand="true" space-fill="true">
- <hbox homogeneous="true" space-expand="true" space-fill="true">
- <hbox space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <text tooltip-text="'$(gettext 'Enter the Phone or Access Number here')'" space-expand="false" space-fill="false"><label>'$(gettext 'Phone number')'</label></text>
- </hbox>
- <entry width-request="130" tooltip-text="'$(gettext 'Enter the Phone or Access Number here')'" space-expand="true" space-fill="true">
- <default>"'${ACC1ISP}'"</default>
- <variable>ENTRYACC1ISP</variable>
- </entry>
- <hbox space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <text space-expand="false" space-fill="false"><label>'$(gettext 'Username')'</label></text>
- </hbox>
- <entry width-request="130" space-expand="true" space-fill="true">
- <default>"'${ACC1USER}'"</default>
- <variable>ENTRYACC1USER</variable>
- </entry>
- </hbox>
- <hbox homogeneous="true" space-expand="true" space-fill="true">
- <hbox space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <text tooltip-text="'$(gettext 'Only for 3G or cell/mobile phone connections')'" space-expand="false" space-fill="false"><label>'$(gettext 'Wireless: APN:')'</label></text>
- </hbox>
- <entry width-request="130" tooltip-text="'$(gettext 'Only for 3G or cell/mobile phone connections')'" space-expand="true" space-fill="true">
- <default>"'${ACC1APN}'"</default>
- <variable>ENTRYACC1APN</variable>
- </entry>
- <hbox space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <text tooltip-text="'$(gettext 'Enter your password here')'" space-expand="false" space-fill="false"><label>'$(gettext 'Password')'</label></text>
- </hbox>
- <entry width-request="130" tooltip-text="'$(gettext 'Enter your password here')'" space-expand="true" space-fill="true">
- <visible>password</visible>
- <default>"'${ACC1PASS}'"</default>
- <variable>ENTRYACC1PASS</variable>
- </entry>
- </hbox>
- <hbox homogeneous="true">
- <hbox tooltip-text="'$(gettext 'Recommended to check this box if using a 3G modem')'" space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <checkbox space-expand="false" space-fill="false">
- <label>'$(gettext 'Stupid mode')'</label>
- <variable>ynSTUPID_MODE1</variable>
- <default>'${ynSTUPID_MODE1}'</default>
- </checkbox>
- </hbox>
- <hbox tooltip-text="'$(gettext 'Make sure this box is checked to attempt auto reconnection')'" space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <checkbox space-expand="false" space-fill="false">
- <label>'$(gettext 'Auto Reconnect')'</label>
- <variable>ynAUTO_RECONNECT1</variable>
- <default>'${ynAUTO_RECONNECT1}'</default>
- </checkbox>
- </hbox>
- </hbox>
- </vbox>
- </hbox>
- <hbox border-width="10" space-expand="true" space-fill="true">
- <button image-position="2" tooltip-text="'$(gettext 'Connect to the Internet')'" space-expand="false" space-fill="false">
- <label>" '$(gettext 'Connect')' "</label>
- '"`/usr/lib/gtkdialog/xml_button-icon internet_connect.svg big`"'
- <visible>'${STATECONa}'</visible>
- <action type="exit">CONNECT2</action>
- </button>
- <vbox space-expand="true" space-fill="true">
- <hbox homogeneous="true" space-expand="true" space-fill="true">
- <hbox space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <text tooltip-text="'$(gettext 'Enter the Phone or Access Number here')'" space-expand="false" space-fill="false"><label>'$(gettext 'Phone number')'</label></text>
- </hbox>
- <entry width-request="130" tooltip-text="'$(gettext 'Enter the Phone or Access Number here')'" space-expand="true" space-fill="true">
- <default>"'${ACC2ISP}'"</default>
- <variable>ENTRYACC2ISP</variable>
- </entry>
- <hbox space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <text space-expand="false" space-fill="false"><label>'$(gettext 'Username')'</label></text>
- </hbox>
- <entry width-request="130" space-expand="true" space-fill="true">
- <default>"'${ACC2USER}'"</default>
- <variable>ENTRYACC2USER</variable>
- </entry>
- </hbox>
- <hbox homogeneous="true" space-expand="true" space-fill="true">
- <hbox space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <text tooltip-text="'$(gettext 'Only for 3G or cell/mobile phone connections')'" space-expand="false" space-fill="false"><label>'$(gettext 'Wireless: APN:')'</label></text>
- </hbox>
- <entry width-request="130" tooltip-text="'$(gettext 'Only for 3G or cell/mobile phone connections')'" space-expand="true" space-fill="true">
- <default>"'${ACC2APN}'"</default>
- <variable>ENTRYACC2APN</variable>
- </entry>
- <hbox space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <text tooltip-text="'$(gettext 'Enter your password here')'" space-expand="false" space-fill="false"><label>'$(gettext 'Password')'</label></text>
- </hbox>
- <entry width-request="130" tooltip-text="'$(gettext 'Enter your password here')'" space-expand="true" space-fill="true">
- <visible>password</visible>
- <default>"'${ACC2PASS}'"</default>
- <variable>ENTRYACC2PASS</variable>
- </entry>
- </hbox>
- <hbox homogeneous="true">
- <hbox tooltip-text="'$(gettext 'Recommended to check this box if using a 3G modem')'" space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <checkbox space-expand="false" space-fill="false">
- <label>'$(gettext 'Stupid mode')'</label>
- <variable>ynSTUPID_MODE2</variable>
- <default>'${ynSTUPID_MODE2}'</default>
- </checkbox>
- </hbox>
- <hbox tooltip-text="'$(gettext 'Make sure this box is checked to attempt auto reconnection')'" space-expand="true" space-fill="true">
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <checkbox space-expand="false" space-fill="false">
- <label>'$(gettext 'Auto Reconnect')'</label>
- <variable>ynAUTO_RECONNECT2</variable>
- <default>'${ynAUTO_RECONNECT2}'</default>
- </checkbox>
- </hbox>
- </hbox>
- </vbox>
- </hbox>
- </notebook>
- </hbox>
- <vbox space-expand="true" space-fill="true">
- <edit editable="false" space-expand="true" space-fill="true">
- <variable>INFO</variable>
- <input file>/tmp/pupdial.log</input>
- <height>90</height>
- </edit>
- </vbox>
-
- <hbox space-expand="false" space-fill="false">
- <button space-expand="false" space-fill="false">
- <label>'$(gettext 'Help')'</label>
- '"`/usr/lib/gtkdialog/xml_button-icon help`"'
- <action>msg_help</action>
- </button>
- <text space-expand="true" space-fill="true"><label>""</label></text>
- <button>
- <label>'$(gettext 'Disconnect from the internet')'</label>
- '"`/usr/lib/gtkdialog/xml_button-icon internet_connect_no.svg`"'
- <visible>'${STATECONb}'</visible>
- <action>/usr/sbin/modemdisconnect</action>
- <action>rm -f /tmp/pupdial.log</action>
- <action type="exit">EXIT</action>
- </button>
- <button>
- <label>'$(gettext 'Quit')'</label>
- '"`/usr/lib/gtkdialog/xml_button-icon quit`"'
- <action type="exit">EXIT</action>
- </button>
- '"`/usr/lib/gtkdialog/xml_scalegrip`"'
- </hbox>
- </vbox>
- </window>'
- #mono text for log box...
- #130331 change "Mono 12" to "Mono 10"...
- echo 'style "specialmono"
- {
- font_name="Mono 10"
- }
- class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono
- export GTK2_RC_FILES=/tmp/gtkrc_mono:$HOME/.gtkrc-2.0
- kill $X1PID #v413
- . /usr/lib/gtkdialog/xml_info gtk #build bg_pixmap for gtk-theme
- RETSTRING="`gtkdialog -p PupDial`"
- #v4.00 to handle embedded quote, extract ENTRYINIT2M and ENTRYINIT3M separately...
- ENTRYINIT2M="`echo "$RETSTRING" | grep '^ENTRYINIT2M=' | cut -f 2-9 -d '"' | sed -e 's/"$//'`" #'geany
- ENTRYINIT3M="`echo "$RETSTRING" | grep '^ENTRYINIT3M=' | cut -f 2-9 -d '"' | sed -e 's/"$//'`" #'geany
- ENTRYWPINM="`echo "$RETSTRING" | grep '^ENTRYWPINM=' | cut -f 2-9 -d '"' | sed -e 's/"$//' | tr -d ' '`" #no spaces
- RETSTRING="`echo "$RETSTRING" | grep -v '^ENTRYINIT3M=' | grep -v '^ENTRYINIT2M=' | grep -v '^ENTRYWPINM='`"
- #v405 getting some weird stuff on stdout from gtkdialog3, fix...
- #all lines must have format variable="value"... v406 add '_'...
- xRETSTRING="`echo "$RETSTRING" | grep -E '^[a-zA-Z0-9_]+=\".*\"$'`" # | grep -v '^INFO='
- eval "$xRETSTRING"
- [ ! -f /etc/wvdial.conf ] && exit
- if [ "$EXIT" = "abort" -o "$EXIT" = "" ];then
- rm -f /tmp/pupdial.log #v3.91
- exit
- fi
- [ "$EXIT" = "reload" ] && exec pupdial 2 #101218 pass param.
- rm -f /tmp/pupdial.log #v3.91
- #v3.99
- STUPID_MODE1=""
- STUPID_MODE2=""
- [ "$ynSTUPID_MODE1" = "true" ] && STUPID_MODE1="yes"
- [ "$ynSTUPID_MODE2" = "true" ] && STUPID_MODE2="yes"
- [ "$ynAUTO_RECONNECT1" = "true" ] && AUTO_RECONNECT1=yes
- [ "$ynAUTO_RECONNECT1" = "false" ] && AUTO_RECONNECT1=no
- [ "$ynAUTO_RECONNECT2" = "true" ] && AUTO_RECONNECT2=yes
- [ "$ynAUTO_RECONNECT2" = "false" ] && AUTO_RECONNECT2=no
- USEREXTRA1="" #v3.99 bug fix...
- [ "$DIAL_PREFIX1" != "" ] && USEREXTRA1="${USEREXTRA1}Dial Prefix = ${DIAL_PREFIX1}
- "
- [ "$LOGIN_PROMPT1" != "" ] && USEREXTRA1="${USEREXTRA1}Login Prompt = ${LOGIN_PROMPT1}
- "
- [ "$PASSWORD_PROMPT1" != "" ] && USEREXTRA1="${USEREXTRA1}Password Prompt = ${PASSWORD_PROMPT1}
- "
- [ "$STUPID_MODE1" != "" ] && USEREXTRA1="${USEREXTRA1}Stupid Mode = ${STUPID_MODE1}
- "
- [ "$DEFAULT_REPLY1" != "" ] && USEREXTRA1="${USEREXTRA1}Default Reply = ${DEFAULT_REPLY1}
- "
- [ "$AUTO_RECONNECT1" != "" ] && USEREXTRA1="${USEREXTRA1}Auto Reconnect = ${AUTO_RECONNECT1}
- "
- [ "$IDLE_SECONDS1" != "" ] && USEREXTRA1="${USEREXTRA1}Idle Seconds = ${IDLE_SECONDS1}
- "
- USEREXTRA2="" #v3.99 bugfix...
- [ "$DIAL_PREFIX2" != "" ] && USEREXTRA2="${USEREXTRA2}Dial Prefix = ${DIAL_PREFIX2}
- "
- [ "$LOGIN_PROMPT2" != "" ] && USEREXTRA2="${USEREXTRA2}Login Prompt = ${LOGIN_PROMPT2}
- "
- [ "$PASSWORD_PROMPT2" != "" ] && USEREXTRA2="${USEREXTRA2}Password Prompt = ${PASSWORD_PROMPT2}
- "
- [ "$STUPID_MODE2" != "" ] && USEREXTRA2="${USEREXTRA2}Stupid Mode = ${STUPID_MODE2}
- "
- [ "$DEFAULT_REPLY2" != "" ] && USEREXTRA2="${USEREXTRA2}Default Reply = ${DEFAULT_REPLY2}
- "
- [ "$AUTO_RECONNECT2" != "" ] && USEREXTRA2="${USEREXTRA2}Auto Reconnect = ${AUTO_RECONNECT2}
- "
- [ "$IDLE_SECONDS2" != "" ] && USEREXTRA2="${USEREXTRA2}Idle Seconds = ${IDLE_SECONDS2}
- "
- [ "$CHECKCC" = "true" ] && CHECKCC="yes"
- [ "$CHECKCC" = "false" ] && CHECKCC="no"
- #v424 Retain original dial type, in case edited to DP.
- DIALSTR="AT"
- [ "$CHECKDT" = "true" -a "$CHECKBC" = "true" ] && DIALSTR="AT"
- [ "$CHECKDT" = "false" -a "$CHECKBC" = "true" ] && DIALSTR="ATX3"
- [ "$CHECKDT" = "false" -a "$CHECKBC" = "false" ] && DIALSTR="ATX1"
- [ "$CHECKDT" = "true" -a "$CHECKBC" = "false" ] && DIALSTR="ATX2"
- DIALSTR="${DIALSTR}${DIALTYPE}"
- [ "$DEVMALT" = "" ] && DEVMALTLINE="" || DEVMALTLINE="#Modem = /dev/${DEVMALT}
- "
- #120218 rerwin: Ensure non-null logon info for wvdial...
- [ ! ${ENTRYACC1USER} ] && ENTRYACC1USER="MYUSERNAME"
- [ ! ${ENTRYACC1PASS} ] && ENTRYACC1PASS="MYPASSWORD"
- [ ! ${ENTRYACC2USER} ] && ENTRYACC2USER="MY2USERNAME"
- [ ! ${ENTRYACC2PASS} ] && ENTRYACC2PASS="MY2PASSWORD"
- MODEMDEVM="/dev/${DEVM}" #120924
- [ "${DEVM}" = "MYDEVM" ] && MODEMDEVM="MYDEVM" #120924
- echo '[Dialer Defaults]' > /etc/wvdial.conf
- echo -n "Modem = ${MODEMDEVM}
- ${DEVMALTLINE}Baud = ${ENTRYBAUDM}
- Init1 =
- Init2 = ${ENTRYINIT2M}
- Init3 = ${ENTRYINIT3M}
- Carrier Check = ${CHECKCC}
- Dial Command = ${DIALSTR}
- [Dialer isp1]
- Phone = ${ENTRYACC1ISP}
- Username = ${ENTRYACC1USER}
- Password = ${ENTRYACC1PASS}
- ${USEREXTRA1}
- [Dialer isp1apn]
- Init5 = AT+CGDCONT=${ACC1PRFL},\"IP\",\"${ENTRYACC1APN}\"
- [Dialer isp2]
- Phone = ${ENTRYACC2ISP}
- Username = ${ENTRYACC2USER}
- Password = ${ENTRYACC2PASS}
- ${USEREXTRA2}
- [Dialer isp2apn]
- Init5 = AT+CGDCONT=${ACC2PRFL},\"IP\",\"${ENTRYACC2APN}\"
- [Dialer pin]
- Init1 = AT+CPIN=${ENTRYWPINM}
- [Dialer wireless]
- #$(gettext "To force only 2G or 3G, uncomment the Init4 line and append 0 (2G) or 2 (3G), and substitute your operator's name for MYOPS.")
- ${INIT4M}
- #$(gettext 'Init6-Init9 lines are available for user purposes; the commented examples can be used as described:')
- #$(gettext 'To force the 3G quality of service level, uncomment the Init6/Init7 line pair and set value two places each, for 384k/144k/64k, omitting the \"k\" (e.g., =1,4,64,384,64,384).')
- #$(gettext 'To list all the APNs stored in the modem, uncomment the Init8 line; check the Connection status log for lines beginning with +CGDCONT:.')
- #$(gettext 'To list the operator identifier stored in the modem, uncomment the Init9 line; check the Connection status log for a line beginning with +COPS:').
- ${INIT69M}" >> /etc/wvdial.conf
- [ "$EXIT" = "EXIT" ] && exit
- if [ "$EXIT" = "CONNECT1" -o "$EXIT" = "CONNECT2" ];then
- [ "$EXIT" = "CONNECT1" ] && WVISP="isp1" || WVISP="isp2"
- ln -snf $WVISP /var/local/pupdial/isp #v433 for stats
- #v3.98 put this in, now remove... v408 back in...
- #v3.98 something wrong with wvdial, it is supposed to automatically write
- #to /etc/ppp/chap-secrets and pap-secrets but isn't...
- if [ "$WVISP" = "isp1" ];then
- echo -e "${ENTRYACC1USER}\t*\t${ENTRYACC1PASS}" > /etc/ppp/chap-secrets
- echo -e "${ENTRYACC1USER}\t*\t${ENTRYACC1PASS}" > /etc/ppp/pap-secrets
- else
- echo -e "${ENTRYACC2USER}\t*\t${ENTRYACC2PASS}" > /etc/ppp/chap-secrets
- echo -e "${ENTRYACC2USER}\t*\t${ENTRYACC2PASS}" > /etc/ppp/pap-secrets
- fi
- #v413 set wireless wvdial arguments, based on device, driver, PIN and APN fields; these do not include wireless modems that appear identical to wired analog modems.
- WVWRLS=""; WVPIN=""; WVAPN=""
- if [ "`echo "$DEVM" | grep -E 'ttyACM[0-9]|ttyUSB[0-9]|ttyHS[0-9]|ttynoz[0-9]|ttyIPWp[0-9]|rfcomm[0-9]'`" != "" ];then #v433 100929
- WVWRLS="wireless" #Include optional user-edited init strings
- if [ "$WVISP" = "isp1" ];then
- [ "$ENTRYACC1APN" != "" ] && WVAPN="${WVISP}apn" && APNSTRING="$ENTRYACC1APN" #v431
- else
- [ "$ENTRYACC2APN" != "" ] && WVAPN="${WVISP}apn" && APNSTRING="$ENTRYACC2APN" #v431
- fi
- if [ "$ENTRYWPINM" != "" ] && [ ! -e /tmp/.pupdial_pin_sent ];then
- WVPIN="pin"
- touch /tmp/.pupdial_pin_sent
- fi
- fi
- [ "$WVISP" = "isp1" ] \
- && ISPSTRING="$ENTRYACC1ISP" \
- || ISPSTRING="$ENTRYACC2ISP" #130505
- rm -f /tmp/pupdial.log
- #/etc/ppp/peers/wvdial and wvdial-pipe are part of wvdial pkg, but these files
- #conflict with Gkdial. Therefore, in the Unleashed wvdial pkg these files are
- #kept in /etc/ppp/ and moved into peers/ as needed...
- cp -f /etc/ppp/wvdial /etc/ppp/peers/
- #v433 Substitute bluetooth wvdial options...
- if which rfcomm >/dev/null && which hcitool >/dev/null \
- && [ "`echo "$DEVM" | grep '^rfcomm[0-9]'`" != "" ];then
- [ -f /etc/wvdial_options/BT-wvdial ] \
- && cp -f /etc/wvdial_options/BT-wvdial /etc/ppp/peers/wvdial
- BDADDR="`rfcomm show $DEVM | grep 'connected' | cut -f 2 -d > | cut -f 2 -d ' '`"
- if [ "$BDADDR" != "" ];then
- BDNAME="`hcitool name $BDADDR | tr -s ' ' | tr ' ' _ | tr / _ | tr '$' _`"
- if [ "$BDNAME" != "" ];then
- [ -f /etc/wvdial_options/BT-$BDNAME ] \
- && cp -f /etc/wvdial_options/BT-$BDNAME /etc/ppp/peers/wvdial \
- || cp -f /etc/ppp/peers/wvdial /etc/wvdial_options/BT-$BDNAME
- fi
- fi
- echo -e "pupdial BT: DEVM: $DEVM BDADDR: $BDADDR /peers/wvdial:\n`cat /etc/ppp/peers/wvdial`" >> /tmp/udevtrace-modem.log #DEBUG
- fi #433 end
- [ "${WVAPN}" != "" ] \
- && [ -f /etc/wvdial_options/APN-${APNSTRING} ] \
- && echo "`cat /etc/wvdial_options/APN-${APNSTRING}`" >> /etc/ppp/peers/wvdial #431
- [ -f /etc/ppp/wvdial-pipe ] \
- && cp -f /etc/ppp/wvdial-pipe /etc/ppp/peers/ #v3.98
- echo "$ISPSTRING" | sed 's/.*,//g' | grep -q '^[0-9\.\-]*$' \
- && touch /tmp/.network_tray-use_analog_dialup_icons #130505
- wvdial ${WVISP} ${WVPIN} ${WVAPN} ${WVWRLS} &> /tmp/pupdial.log & #v413
- [ ! -f /tmp/pupdial.log ] && sleep 1
- [ ! -f /tmp/pupdial.log ] && sleep 1
- /usr/sbin/pupdial_wizard_helper & #101206
- Xdialog --center --wmclass "pupdial" --backtitle "$(gettext 'NOTICE: If the log shows a failure to connect, please click left button')" --title "$(gettext 'PupDial: WvDial connection log')" --ok-label "$(gettext 'DISCONNECT or stop trying')" --cancel-label "$(gettext 'CLOSE window but stay online')" --fixed-font --tailbox /tmp/pupdial.log 20 80
- if [ $? -eq 0 ];then
- /usr/sbin/modemdisconnect #v433
- echo '' >> /tmp/pupdial.log
- echo '------------------------------------------------------' >> /tmp/pupdial.log
- echo '' >> /tmp/pupdial.log
- exec pupdial 2 #v3.91 go back to main window. 101218 pass param.
- fi
- fi
- ###END###
|