procd: convert various packages to procd style init.d scripts
[openwrt/svn-archive/archive.git] / package / network / config / netifd / files / etc / init.d / network
1 #!/bin/sh /etc/rc.common
2
3 START=20
4 STOP=90
5
6 USE_PROCD=1
7
8 start_service() {
9 [ -e /proc/sys/kernel/core_pattern ] && {
10 ulimit -c unlimited
11 echo '/tmp/%e.%p.%s.%t.core' > /proc/sys/kernel/core_pattern
12 }
13 procd_open_instance
14 procd_set_param command /sbin/netifd
15 procd_set_param respawn
16 procd_close_instance
17 }
18
19 reload_service() {
20 ubus call network reload
21 /sbin/wifi down
22 /sbin/wifi up
23 }
24
25 stop_service() {
26 /sbin/wifi down
27 }
28
29 service_running() {
30 setup_switch() { return 0; }
31
32 include /lib/network
33 setup_switch
34
35 sleep 5
36
37 /sbin/wifi down
38 /sbin/wifi up
39 }
40
41 service_triggers()
42 {
43 procd_add_reload_trigger "network"
44 }
45
46 restart() {
47 ifdown -a
48 sleep 1
49 trap '' TERM
50 stop "$@"
51 start "$@"
52 }
53
54 shutdown() {
55 ifdown -a
56 stop
57 }