2006-10-05 04:05:48 +08:00
|
|
|
#!/bin/sh
|
2006-10-16 05:03:30 +08:00
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
|
|
|
|
. $IPKG_INSTROOT/etc/functions.sh
|
|
|
|
|
|
|
|
START=50
|
2006-10-05 04:05:48 +08:00
|
|
|
|
|
|
|
start() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
reload() {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
restart() {
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
boot() {
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
shutdown() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
disable() {
|
2006-10-16 05:03:30 +08:00
|
|
|
name="$(basename "${initscript}")"
|
2006-10-16 05:22:51 +08:00
|
|
|
rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
|
2006-10-05 04:05:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
enable() {
|
2006-10-16 05:03:30 +08:00
|
|
|
name="$(basename "${initscript}")"
|
2006-10-05 04:05:48 +08:00
|
|
|
disable
|
2006-10-16 05:03:30 +08:00
|
|
|
ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
|
2006-10-05 04:05:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
depends() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
help() {
|
|
|
|
cat <<EOF
|
2006-10-05 04:09:14 +08:00
|
|
|
Syntax: $initscript [command]
|
2006-10-05 04:05:48 +08:00
|
|
|
|
|
|
|
Available commands:
|
|
|
|
start Start the service
|
|
|
|
stop Stop the service
|
|
|
|
restart Restart the service
|
|
|
|
reload Reload configuration files (or restart if that fails)
|
2006-10-16 05:03:30 +08:00
|
|
|
enable Enable service autostart
|
|
|
|
disable Disable service autostart
|
2006-10-05 04:05:48 +08:00
|
|
|
$EXTRA_HELP
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
initscript="$1"
|
|
|
|
action="$2"
|
|
|
|
|
|
|
|
. "$initscript"
|
|
|
|
|
|
|
|
cmds=
|
|
|
|
for cmd in $EXTRA_COMMANDS; do
|
|
|
|
cmds="$cmd) $cmd;;"
|
|
|
|
done
|
|
|
|
eval "case \"\$action\" in
|
|
|
|
start) start;;
|
|
|
|
stop) stop;;
|
|
|
|
reload) reload || restart;;
|
|
|
|
restart) restart;;
|
|
|
|
boot) boot;;
|
|
|
|
shutdown) shutdown;;
|
2006-10-16 05:03:30 +08:00
|
|
|
enable) enable;;
|
|
|
|
disable) disable;;
|
2006-10-05 04:05:48 +08:00
|
|
|
$cmds
|
|
|
|
*) help;;
|
|
|
|
esac"
|