Advertisement
Guest User

Venator85

a guest
Mar 6th, 2009
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. --- /usr/lib/network/network.subr 2008-06-25 13:08:41.000000000 +0200
  2. +++ /usr/lib/network/network.subr 2008-06-28 13:47:30.000000000 +0200
  3. @@ -228,6 +228,20 @@
  4. return 1
  5. }
  6.  
  7. +# by Venator85
  8. +# count_active_profiles
  9. +# Return the number of active profiles
  10. +#
  11. +count_active_profiles() {
  12. + counter=0
  13. + all_profiles=$(list_profiles)
  14. + for profile in $all_profiles;
  15. + do
  16. + check_profile $profile && let counter+=1
  17. + done
  18. + echo $counter
  19. +}
  20. +
  21. ### Status setting functions
  22. ##
  23. # set_profile up/down profile
  24. --- /etc/rc.d/net-profiles 2008-06-25 13:08:42.000000000 +0200
  25. +++ /etc/rc.d/net-profiles 2008-06-28 13:47:03.000000000 +0200
  26. @@ -43,8 +43,16 @@
  27. fi
  28.  
  29. add_daemon net-profiles
  30. +
  31. + source /usr/lib/network/network.subr
  32. + STATE_DIR="/var/run/network/"
  33. + active_profiles=$(count_active_profiles)
  34. + if [[ "$active_profiles" -eq 0 ]]; then
  35. + /etc/rc.d/net-auto start
  36. + fi
  37. ;;
  38. stop)
  39. + /etc/rc.d/net-auto stop
  40. # shutdown any profiles started by netcfg (or from NET_PROFILES in rc.conf)
  41. /usr/bin/netcfg2 -a
  42. rm_daemon net-profiles
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement