#!/bin/sh
#Barry Kauler, LGPL 2007
#v406 rerwin: bugfix.

#v405 if a different modem selected, quit...
[ -h /dev/modem ] && [ "`readlink /dev/modem`" != "536ep" ] && exit

[ ! $1 ] && exit
[ "$1" != "start" ] && exit

if [ "`lsmod | grep '^Intel536'`" != "" ];then
 ln -snf 536ep /dev/modem
 ln -snf 536ep /dev/ttyS_536ep #v406 so wvdialconf can see it
fi

if [ -f /etc/countryinfo ];then
 . /etc/countryinfo
 if [ "$T35_COUNTRY_CODE" != "" ];then
  SPATTERN="s/^MODEM_COUNTRY_STRING.*/MODEM_COUNTRY_STRING='AT+GCI=${T35_COUNTRY_CODE}'/"
  cat /etc/countryinfo | sed -e "$SPATTERN" > /tmp/countryinfo
 else
  SPATTERN="s/^MODEM_COUNTRY_STRING.*/MODEM_COUNTRY_STRING=''/"
  cat /etc/countryinfo | sed -e "$SPATTERN" > /tmp/countryinfo
 fi
 sync
 mv -f /tmp/countryinfo /etc/countryinfo
fi
#.../usr/sbin/gen_modem_init_string reads this variable (called from second
#entry to /etc/rc.d/rc.modem, in rc.local0).



###END###
