home *** CD-ROM | disk | FTP | other *** search
/ chilidog.highland.cc.ks.us / chilidog.highland.cc.ks.us.zip / chilidog.highland.cc.ks.us / backup / bradford.20110502.etc.tar.gz / bradford.20110502.etc.tar / etc / NetworkManager / dispatcher.d / netcontrol_global_hooks next >
Text File  |  2006-06-02  |  2KB  |  56 lines

  1. #! /bin/bash
  2. #
  3. # Copyright (c) 2002-2006 SuSE Linux AG Nuernberg, Germany.
  4. # All rights reserved.
  5. #
  6. # This program is free software; you can redistribute it and/or modify it under
  7. # the terms of the GNU General Public License as published by the Free Software
  8. # Foundation; either version 2 of the License, or (at your option) any later
  9. # version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT
  12. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  14. # details.
  15. #
  16. # You should have received a copy of the GNU General Public License along with
  17. # this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  18. # Place, Suite 330, Boston, MA 02111-1307 USA
  19. #
  20. # Author: Christian Zoz <zoz@suse.de>
  21. #
  22. # $Id: $
  23. #
  24. # Description:
  25. # This script calls hooked scripts in /etc/sysconfig/network/if{up,down}.d
  26. # See manpage ifup.8 for details.
  27. # Note that hooked scripts are called always _after_ the interface is up/down.
  28. # Calling them earlier would require a change in NetworkManager itself.
  29.  
  30. cd /etc/sysconfig/network/ || exit
  31. test -r ./config && . ./config
  32. test -r scripts/functions && . scripts/functions
  33.  
  34. INTERFACE=$1
  35. ACTION=$2
  36.  
  37. test "$ACTION" == down -a "$GLOBAL_PRE_DOWN_EXEC" != yes && exit
  38. test "$ACTION" == up   -a "$GLOBAL_POST_UP_EXEC"  != yes && exit
  39.  
  40. CONFIG=_unknown_
  41.  
  42. get_config_name() {
  43.     test "$CONFIG" != _unknown_ && return
  44.     eval `/sbin/getcfg -d . -f ifcfg- -- $INTERFACE 2>/dev/null`
  45.     CONFIG=$HWD_CONFIG_0
  46. }
  47.  
  48. shopt -s nullglob
  49. for a in if-${ACTION}.d/*; do
  50.     test -x "$a" || continue
  51.     get_config_name
  52.     info_mesg "calling '`pwd`/$a '${CONFIG}' ${INTERFACE} -o nm'"
  53.     $a "${CONFIG}" ${INTERFACE} -o nm
  54. done
  55.  
  56.