2 # Copyright (C) 2006-2012 OpenWrt.org
4 . $IPKG_INSTROOT/lib/functions.sh
5 . $IPKG_INSTROOT/lib/functions/service.sh
38 name="$(basename "${initscript}")"
39 rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
40 rm -f "$IPKG_INSTROOT"/etc/rc.d/K??$name
44 name="$(basename "${initscript}")"
46 [ -n "$START" -o -n "$STOP" ] || {
47 echo "/etc/init.d/$name does not have a START or STOP value"
50 [ "$START" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
51 [ "$STOP" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/K${STOP}${name##K[0-9][0-9]}"
55 name="$(basename "${initscript}")"
56 [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
65 Syntax: $initscript [command]
68 start Start the service
70 restart Restart the service
71 reload Reload configuration files (or restart if that fails)
72 enable Enable service autostart
73 disable Disable service autostart
95 [ -n "$USE_PROCD" ] && {
96 . $IPKG_INSTROOT/lib/functions/procd.sh
97 basescript=$(readlink "$initscript")
99 procd_open_service "$(basename ${basescript:-$initscript})" "$initscript"
105 rc_procd start_service "$@"
109 procd_kill "$(basename ${basescript:-$initscript})" "$1"
117 ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}"
118 list_contains ALL_COMMANDS "$action" || action=help
119 [ "$action" = "reload" ] && action='eval reload "$@" || restart "$@" && :'