mirror of the now-defunct rocklinux.org
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.

70 lines
2.2 KiB

  1. #!/bin/sh
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/package/base/sysfiles/network.init
  11. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. #
  25. # Desc: setting up network devices
  26. # Runlevel: 15 rcX rc3 rc4 rc5
  27. #
  28. main_begin
  29. block_begin(start, `Setting up network devices.')
  30. block_split(`Renaming network interfaces')
  31. if [ -e /etc/iftab ] ; then
  32. check(`ifrename')
  33. else
  34. true
  35. fi
  36. oldprof="$(cat /etc/network/profile 2>/dev/null)"
  37. oldprof=${oldprof:-default}
  38. if [ -n "$2" ]; then
  39. echo $2 > /etc/network/profile
  40. profile="$(cat /etc/network/profile 2>/dev/null)"
  41. profile=${profile:-default}
  42. echo "Active network profile is now $profile (was: $oldprof)."
  43. elif [ -x /etc/network/getprofile ]; then
  44. echo "Running network profile autodetection ..."
  45. /etc/network/getprofile
  46. profile="$(cat /etc/network/profile 2>/dev/null)"
  47. profile=${profile:-default}
  48. echo "Active network profile is now $profile (was: $oldprof)."
  49. else
  50. profile="$oldprof"
  51. fi
  52. check(`/etc/network/rocknet $profile auto up')
  53. block_end
  54. block_begin(stop, `Shutting down network devices.')
  55. profile="$(cat /etc/network/profile 2>/dev/null)"
  56. profile=${profile:-default}
  57. check(`/etc/network/rocknet $profile auto down')
  58. block_end
  59. block_begin(restart, `Reconfiguring network devices.')
  60. check(`$0 stop')
  61. check(`$0 start $2')
  62. block_end
  63. main_end