#!/bin/sh

FILE=/etc/portslave/pslave.conf

grep -q "^[^#].*ipno" $FILE
if [ "$?" = "0" ]; then
  echo "This version changes the format of $FILE"
  echo "conf.ipno is changed to all.loc_host"
  echo "and (s.*|all).ipno is changed to .*\.rem_host"
  echo ""
  echo "Shall I change this for you [Y/n]?"
  read X
  X=`echo "$X" | cut -c1-1`
  if [ "$X" = "N" -o "$X" = "n" ]; then
    echo "Not changing the config file."
    echo "Portslave will not work correctly until you change this or downgrade"
    echo "to version 2001-07-13 or earlier."
  else
    sed -e s/conf.ipno/all.loc_host/g < $FILE | sed -e s/ipno/rem_host/g > $FILE.dpkg-tmp
    echo "Upgraded the config file as you desire."
    mv $FILE.dpkg-tmp $FILE
  fi
fi
grep -q "^[^#].*pppd" $FILE
if [ "$?" = "0" ]; then
  grep -q "^#.*PPPD_IS_RIGHT" $FILE
  if [ "$?" != "0" ]; then
    echo "You are specifying the pppd program in your config file."
    echo "The portslave program is compiled with a location that should be"
    echo "right for you, please make sure that what you are doing is correct."
    echo ""
    echo "Put #PPPD_IS_RIGHT in $FILE to avoid seeing this again."
    echo "Press [ENTER] to continue."
    read X
  fi
fi
grep -q "^[^#].*CONNECT@" $FILE
if [ "$?" = "0" ]; then
  echo "The syntax for recognising connect parameters has changed."
  echo "Now you put 'SETVAR C=CONNECT' at the start of the initchat and then"
  echo "put 'CONNECT' instead of 'CONNECT@' in the main section."
  echo "You must fix this or downgrade to version 2001.12.16 or earlier."
  echo ""
  echo "Press [ENTER] to continue."
  read X
fi
#DEBHELPER#
