[packages] rarpd: use network.sh to find devices
git-svn-id: svn://svn.openwrt.org/openwrt/packages@31968 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
c71bcbeb7a
commit
a26a91ed25
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2006-2011 OpenWrt.org
|
# Copyright (C) 2006-2012 OpenWrt.org
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=rarpd
|
PKG_NAME:=rarpd
|
||||||
PKG_VERSION:=1.1
|
PKG_VERSION:=1.1
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=ftp://ftp.dementia.org/pub/net-tools
|
PKG_SOURCE_URL:=ftp://ftp.dementia.org/pub/net-tools
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2006-2011 OpenWrt.org
|
# Copyright (C) 2006-2012 OpenWrt.org
|
||||||
|
|
||||||
START=50
|
START=50
|
||||||
|
|
||||||
@ -26,16 +26,6 @@ append_string() {
|
|||||||
[ -n "$_val" ] && append "$var" "$val $_val"
|
[ -n "$_val" ] && append "$var" "$val $_val"
|
||||||
}
|
}
|
||||||
|
|
||||||
config_get_ifname() {
|
|
||||||
local var="$1"
|
|
||||||
local section="$2"
|
|
||||||
local option="$3"
|
|
||||||
local val="$4"
|
|
||||||
local _val
|
|
||||||
config_get _val "$section" "$option" "$val"
|
|
||||||
[ -n "$_val" ] && config_get "$var" "$_val" 'ifname' "$_val"
|
|
||||||
}
|
|
||||||
|
|
||||||
section_enabled() {
|
section_enabled() {
|
||||||
local enabled
|
local enabled
|
||||||
config_get_bool enabled "$1" 'enabled' 0
|
config_get_bool enabled "$1" 'enabled' 0
|
||||||
@ -45,42 +35,45 @@ section_enabled() {
|
|||||||
start_instance() {
|
start_instance() {
|
||||||
local section="$1"
|
local section="$1"
|
||||||
local if
|
local if
|
||||||
|
local dev
|
||||||
local args
|
local args
|
||||||
|
|
||||||
section_enabled "$section" || return 1
|
section_enabled "$section" || return 1
|
||||||
|
|
||||||
config_get_ifname if "$section" 'interface' 'lan'
|
config_get if "$section" 'interface' 'lan'
|
||||||
args="-n -i $if"
|
network_get_device dev "$if" && {
|
||||||
append_string args "$section" 'ethers' '-e'
|
args="-n -i $if"
|
||||||
append_bool args "$section" 'verbose' '-v'
|
append_string args "$section" 'ethers' '-e'
|
||||||
|
append_bool args "$section" 'verbose' '-v'
|
||||||
|
|
||||||
SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
|
SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
|
||||||
service_start /usr/sbin/rarpd $args
|
service_start /usr/sbin/rarpd $args
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_instance() {
|
stop_instance() {
|
||||||
local section="$1"
|
local section="$1"
|
||||||
local id
|
local id
|
||||||
local if
|
local if
|
||||||
|
local dev
|
||||||
|
|
||||||
section_enabled "$section" || return 1
|
section_enabled "$section" || return 1
|
||||||
|
|
||||||
config_get_ifname if "$section" 'interface' 'lan'
|
config_get if "$section" 'interface' 'lan'
|
||||||
|
network_get_device dev "$if"
|
||||||
|
|
||||||
SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
|
SERVICE_PID_FILE="/var/run/rarpd-${if}.pid"
|
||||||
service_stop /usr/sbin/rarpd
|
service_stop /usr/sbin/rarpd
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
include /lib/network
|
. /lib/functions/network.sh
|
||||||
scan_interfaces
|
|
||||||
config_load 'rarpd'
|
config_load 'rarpd'
|
||||||
config_foreach start_instance 'rarpd'
|
config_foreach start_instance 'rarpd'
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
include /lib/network
|
. /lib/functions/network.sh
|
||||||
scan_interfaces
|
|
||||||
config_load 'rarpd'
|
config_load 'rarpd'
|
||||||
config_foreach stop_instance 'rarpd'
|
config_foreach stop_instance 'rarpd'
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user