packages/net/parprouted/files/parprouted.init
jow 987d9dddaf parprouted: fix init script (#12474)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@34209 3c298f89-4303-0410-b956-a3cf2f4a3e73
2012-11-16 13:41:07 +00:00

45 lines
789 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2012 OpenWrt.org
START=50
section_enabled() {
local enabled
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
append_interface() {
local name="$1"
local device
network_get_device device "$name"
append args "${device:-$name}"
}
start_instance() {
local section="$1"
local permanent
local interfaces
local args=""
section_enabled "$section" || return 1
config_get_bool permanent "$section" 'permanent' 0
[ $permanent -eq 0 ] || append args "-p"
config_list_foreach "$section" 'interfaces' append_interface
service_start /usr/sbin/parprouted $args
}
start() {
. /lib/functions/network.sh
config_load 'parprouted'
config_foreach start_instance 'parprouted'
}
stop() {
service_stop /usr/sbin/parprouted
}