netplug-2 715 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. # Copyright 1999-2011 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. #
  5. # Gentoo-specific netplug script
  6. #
  7. # This file gets called by netplug when it wants to bring an interface
  8. # up or down.
  9. #
  10. IFACE="$1"
  11. ACTION="$2"
  12. EXEC="/etc/init.d/net.${IFACE}"
  13. case "${ACTION}" in
  14. in)
  15. ARGS="--quiet start"
  16. ;;
  17. out)
  18. ARGS="--quiet stop"
  19. ;;
  20. probe)
  21. # Do nothing as we should already be up
  22. exit 0
  23. ;;
  24. *)
  25. echo "$0: wrong arguments" >&2
  26. echo "Call with <interface> <in|out|probe>" >&2
  27. exit 1
  28. ;;
  29. esac
  30. export IN_BACKGROUND=true
  31. if [ -x "${EXEC}" ]
  32. then
  33. ${EXEC} ${ARGS}
  34. exit 0
  35. else
  36. logger -t netplug "Error: Couldn't configure ${IFACE}, no ${EXEC} !"
  37. exit 1
  38. fi