openvpn.down 960 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/sh
  2. # Copyright (c) 2006-2007 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. # Contributed by Roy Marples (uberlord@gentoo.org)
  5. # If we have a service specific script, run this now
  6. if [ -x /etc/openvpn/"${RC_SVCNAME}"-down.sh ] ; then
  7. /etc/openvpn/"${RC_SVCNAME}"-down.sh "$@"
  8. fi
  9. # Restore resolv.conf to how it was
  10. if [ "${PEER_DNS}" != "no" ]; then
  11. if [ -x /sbin/resolvconf ] ; then
  12. /sbin/resolvconf -d "${dev}"
  13. elif [ -e /etc/resolv.conf-"${dev}".sv ] ; then
  14. # Important that we cat instead of move incase resolv.conf is
  15. # a symlink and not an actual file
  16. cat /etc/resolv.conf-"${dev}".sv > /etc/resolv.conf
  17. rm -f /etc/resolv.conf-"${dev}".sv
  18. fi
  19. fi
  20. if [ -n "${RC_SVCNAME}" ]; then
  21. # Re-enter the init script to start any dependant services
  22. if /etc/init.d/"${RC_SVCNAME}" --quiet status ; then
  23. export IN_BACKGROUND=true
  24. /etc/init.d/"${RC_SVCNAME}" --quiet stop
  25. fi
  26. fi
  27. exit 0
  28. # vim: ts=4 :