|
Revision 2653, 328 bytes
(checked in by tg, 5 years ago)
|
• base-files/files/etc/init.d/rcK, base-files/files/etc/init.d/rcS:
do correct shebang processing, like the BSD kernel and mksh: get
first line of script to run if it begins with "#!", strip that and
any leading space/tab off, then get shell name (terminates with
space/tab/end of string) and shell argument quoting according to
unix common proceedings; use /bin/sh as interpreter if none could
be found
• mk/package.mk: ensure all init scripts are 0755 by default
• busybox: flesh out inetd init script, so that all init scripts in
FreeWRT either can be found with -path \*/init.d/\* or -name \*.init
• other packages: add #!/bin/sh shebang line to init scripts¹, bump dashver
¹) change this to /bin/ash if you use ash-specific features that mksh
can also do; never use ash-specific features that mksh cannot do (are
there any?), change to /bin/mksh if you use mksh-specific features
and add a run-time dependency on mksh in that case
|
| Line | |
|---|
| 1 |
#!/bin/sh |
|---|
| 2 |
|
|---|
| 3 |
. /etc/rc.conf |
|---|
| 4 |
case $1 in |
|---|
| 5 |
autostart) |
|---|
| 6 |
test x"${network:-NO}" = x"NO" && exit 0 |
|---|
| 7 |
exec sh $0 start |
|---|
| 8 |
;; |
|---|
| 9 |
start) |
|---|
| 10 |
[ -f /etc/network/interfaces ] || exit 1 |
|---|
| 11 |
ifup -a |
|---|
| 12 |
;; |
|---|
| 13 |
autostop|stop) |
|---|
| 14 |
ifdown -a |
|---|
| 15 |
;; |
|---|
| 16 |
restart) |
|---|
| 17 |
sh $0 stop |
|---|
| 18 |
exec sh $0 start |
|---|
| 19 |
;; |
|---|
| 20 |
*) |
|---|
| 21 |
echo "Usage: $0 {start | stop | restart}" |
|---|
| 22 |
exit 1 |
|---|
| 23 |
;; |
|---|
| 24 |
esac |
|---|
| 25 |
exit $? |
|---|