OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB

  1. #!/bin/bash
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../rocknet/ifswitch.sh
  6. # Copyright (C) 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. set -e
  16. active=$( cat /var/run/rocknet/active-interfaces 2>/dev/null || true )
  17. if [ $# -eq 0 ]; then
  18. echo "Usage $0 [ interface profile ] | [ profile ]"
  19. exit
  20. fi
  21. i=0
  22. for x in ${active//,/ }; do
  23. [ $(( i++ )) -eq 0 ] && echo "Deactivating current interfaces ..."
  24. if=${x/(*)/}
  25. profile=${x/*(/}; profile=${profile%)}
  26. ifdown $if $profile
  27. done
  28. echo "Activating specified profile/interfaces ..."
  29. if [ $# -eq 1 ]; then
  30. rocknet $1 auto up
  31. else
  32. ifup $1 $2
  33. fi