Include the architecture specific gpio file for now
[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() {
7 return 0
8 }
9
10 stop() {
11 return 0
12 }
13
14 reload() {
15 return 1
16 }
17
18 restart() {
19 trap '' TERM
20 stop
21 start
22 }
23
24 boot() {
25 start
26 }
27
28 shutdown() {
29 return 0
30 }
31
32 disable() {
33 name="$(basename "${initscript}")"
34 rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
35 rm -f "$IPKG_INSTROOT"/etc/rc.d/K??$name
36 }
37
38 enable() {
39 name="$(basename "${initscript}")"
40 disable
41 [ "$START" ] && ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
42 [ "$STOP" ] && ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/K${STOP}${name##K[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.056561 seconds and 5 git commands to generate.