packages/net/parprouted/files/parprouted.init
nico 25a812b377 packages/parprouted: use uci config
git-svn-id: svn://svn.openwrt.org/openwrt/packages@29213 3c298f89-4303-0410-b956-a3cf2f4a3e73
2011-11-17 10:47:19 +00:00

45 lines
807 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=50
section_enabled() {
local enabled
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
append_interface() {
local name="$1"
local interface
config_get interface "$name" 'ifname' "$name"
append args "$interface"
}
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() {
include /lib/network
scan_interfaces
config_load 'parprouted'
config_foreach start_instance 'parprouted'
}
stop() {
service_stop /usr/sbin/parprouted
}