upgrade the ixp4xx ethernet driver to v0.3.1, split the Gateway 7001 support to two...
[openwrt.git] / package / base-files / files / etc / rc.common
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 . $IPKG_INSTROOT/etc/functions.sh
5
6 START=50
7
8 start() {
9 return 0
10 }
11
12 stop() {
13 return 0
14 }
15
16 reload() {
17 return 1
18 }
19
20 restart() {
21 trap '' TERM
22 stop
23 start
24 }
25
26 boot() {
27 start
28 }
29
30 shutdown() {
31 return 0
32 }
33
34 disable() {
35 name="$(basename "${initscript}")"
36 rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
37 }
38
39 enable() {
40 name="$(basename "${initscript}")"
41 disable
42 ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
43 }
44
45 enabled() {
46 name="$(basename "${initscript}")"
47 [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
48 }
49
50 depends() {
51 return 0
52 }
53
54 help() {
55 cat <<EOF
56 Syntax: $initscript [command]
57
58 Available commands:
59 start Start the service
60 stop Stop the service
61 restart Restart the service
62 reload Reload configuration files (or restart if that fails)
63 enable Enable service autostart
64 disable Disable service autostart
65 $EXTRA_HELP
66 EOF
67 }
68
69 initscript="$1"
70 action="$2"
71
72 . "$initscript"
73
74 cmds=
75 for cmd in $EXTRA_COMMANDS; do
76 cmds="${cmds:+$cmds$N}$cmd) $cmd;;"
77 done
78 eval "case \"\$action\" in
79 start) start;;
80 stop) stop;;
81 reload) reload || restart;;
82 restart) restart;;
83 boot) boot;;
84 shutdown) shutdown;;
85 enable) enable;;
86 enabled) enabled;;
87 disable) disable;;
88 $cmds
89 *) help;;
90 esac"
This page took 0.054993 seconds and 5 git commands to generate.