network 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. # Begin /etc/init.d/network
  3. ### BEGIN INIT INFO
  4. # Provides: $network
  5. # Required-Start: $local_fs swap localnet
  6. # Should-Start: $syslog
  7. # Required-Stop: $local_fs swap localnet
  8. # Should-Stop: $syslog
  9. # Default-Start: 3 4 5
  10. # Default-Stop: 0 1 2 6
  11. # Short-Description: Starts and configures network interfaces.
  12. # Description: Starts and configures network interfaces.
  13. # X-LFS-Provided-By: LFS
  14. ### END INIT INFO
  15. . /lib/lsb/init-functions
  16. case "${1}" in
  17. start)
  18. # Start all network interfaces
  19. for file in ${NETWORK_DEVICES}/ifconfig.*
  20. do
  21. interface=${file##*/ifconfig.}
  22. # skip if $file is * (because nothing was found)
  23. if [ "${interface}" = "*" ]
  24. then
  25. continue
  26. fi
  27. IN_BOOT=1 /sbin/ifup ${interface}
  28. done
  29. ;;
  30. stop)
  31. # Reverse list
  32. FILES=""
  33. for file in /run/network/ifconfig.*
  34. do
  35. FILES="${file} ${FILES}"
  36. done
  37. # Stop all network interfaces
  38. for file in ${FILES}
  39. do
  40. interface=${file##*/ifconfig.}
  41. # skip if $file is * (because nothing was found)
  42. if [ "${interface}" = "*" ]
  43. then
  44. continue
  45. fi
  46. IN_BOOT=1 /sbin/ifdown ${interface}
  47. done
  48. ;;
  49. restart)
  50. ${0} stop
  51. sleep 1
  52. ${0} start
  53. ;;
  54. *)
  55. echo "Usage: ${0} {start|stop|restart}"
  56. exit 1
  57. ;;
  58. esac
  59. # End /etc/init.d/network