ip-up 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # this is a script which is executed after connecting the ppp interface.
  3. # look at man pppd for details
  4. # the followings parameters are available:
  5. # $1 = interface-name
  6. # $2 = tty-device
  7. # $3 = speed
  8. # $4 = local-IP-address
  9. # $5 = remote-IP-address
  10. # $6 = ipparam
  11. if [ "$USEPEERDNS" ]; then
  12. # add the server supplied DNS entries to /etc/resolv.conf
  13. # (taken from debian's 0000usepeerdns)
  14. # follow any symlink to find the real file
  15. REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf)
  16. if [ "$REALRESOLVCONF" != "/etc/ppp/resolv.conf" ]; then
  17. # merge the new nameservers with the other options from the old configuration
  18. {
  19. grep '^nameserver[[:space:]]' $REALRESOLVCONF
  20. cat /etc/ppp/resolv.conf
  21. } > $REALRESOLVCONF.tmp
  22. # backup the old configuration and install the new one
  23. cp -a $REALRESOLVCONF $REALRESOLVCONF.pppd-backup
  24. mv $REALRESOLVCONF.tmp $REALRESOLVCONF
  25. # correct permissions
  26. chmod 0644 /etc/resolv.conf
  27. chown root:root /etc/resolv.conf
  28. fi
  29. fi
  30. [ -f /etc/ppp/ip-up.local ] && . /etc/ppp/ip-up.local "$@"