1
0

network 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin network
  4. #
  5. # Description : Network Control Script
  6. #
  7. # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
  8. # Nathan Coulson - nathan@linuxfromscratch.org
  9. # Kevin P. Fleming - kpfleming@linuxfromscratch.org
  10. # DJ Lucas - dj@linuxfromscratch.org
  11. # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
  12. #
  13. # Version : LFS 7.0
  14. #
  15. ########################################################################
  16. ### BEGIN INIT INFO
  17. # Provides: $network
  18. # Required-Start: $local_fs swap localnet
  19. # Should-Start: $syslog
  20. # Required-Stop: $local_fs swap localnet
  21. # Should-Stop: $syslog
  22. # Default-Start: 3 4 5
  23. # Default-Stop: 0 1 2 6
  24. # Short-Description: Starts and configures network interfaces.
  25. # Description: Starts and configures network interfaces.
  26. # X-LFS-Provided-By: LFS
  27. ### END INIT INFO
  28. case "${1}" in
  29. start)
  30. # Start all network interfaces
  31. for file in /etc/sysconfig/ifconfig.*
  32. do
  33. interface=${file##*/ifconfig.}
  34. # Skip if $file is * (because nothing was found)
  35. if [ "${interface}" = "*" ]
  36. then
  37. continue
  38. fi
  39. /sbin/ifup ${interface}
  40. done
  41. ;;
  42. stop)
  43. # Unmount any network mounted file systems
  44. umount --all --force --types nfs,cifs,nfs4
  45. # Reverse list
  46. net_files=""
  47. for file in /etc/sysconfig/ifconfig.*
  48. do
  49. net_files="${file} ${net_files}"
  50. done
  51. # Stop all network interfaces
  52. for file in ${net_files}
  53. do
  54. interface=${file##*/ifconfig.}
  55. # Skip if $file is * (because nothing was found)
  56. if [ "${interface}" = "*" ]
  57. then
  58. continue
  59. fi
  60. /sbin/ifdown ${interface}
  61. done
  62. ;;
  63. restart)
  64. ${0} stop
  65. sleep 1
  66. ${0} start
  67. ;;
  68. *)
  69. echo "Usage: ${0} {start|stop|restart}"
  70. exit 1
  71. ;;
  72. esac
  73. exit 0
  74. # End network