Changeset 31967


Ignore:
Timestamp:
2012-05-29T03:06:51+02:00 (5 years ago)
Author:
jow
Message:

[packages] vrrpd: use network.sh to find devices

Location:
packages/net/vrrpd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • packages/net/vrrpd/Makefile

    r29214 r31967  
    11# 
    2 # Copyright (C) 2006-2011 OpenWrt.org 
     2# Copyright (C) 2006-2012 OpenWrt.org 
    33# 
    44# This is free software, licensed under the GNU General Public License v2. 
     
    1010PKG_NAME:=vrrpd 
    1111PKG_VERSION:=1.0 
    12 PKG_RELEASE:=2 
     12PKG_RELEASE:=3 
    1313 
    1414PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
  • packages/net/vrrpd/files/vrrpd.init

    r29214 r31967  
    11#!/bin/sh /etc/rc.common 
    2 # Copyright (C) 2006-2011 OpenWrt.org 
     2# Copyright (C) 2006-2012 OpenWrt.org 
    33 
    44START=50 
     
    3030} 
    3131 
    32 config_get_ifname() { 
    33         local var="$1" 
    34         local section="$2" 
    35         local option="$3" 
    36         local val="$4" 
    37         local _val 
    38         config_get _val "$section" "$option" "$val" 
    39         config_get "$var" "$_val" 'ifname' "$_val" 
    40 } 
    41  
    4232section_enabled() { 
    4333        local enabled 
     
    5040        local id 
    5141        local if 
     42        local dev 
    5243        local args 
    5344 
     
    5546 
    5647        config_get id "$section" 'virtual_id' '1' 
    57         config_get_ifname if "$section" 'interface' 'lan' 
     48        config_get if "$section" 'interface' 'lan' 
     49        network_get_device dev "$if" && { 
     50                args="-v $id -i $dev" 
     51                append_string args "$section" 'delay' '-d' 
     52                append_string args "$section" 'priority' '-p' 
     53                append_bool args "$section" 'no_virtual_mac' '-n' 
     54                config_list_foreach "$section" 'virtual_ip' append_list_item args 
    5855 
    59         args="-v $id -i $if" 
    60         append_string args "$section" 'delay' '-d' 
    61         append_string args "$section" 'priority' '-p' 
    62         append_bool args "$section" 'no_virtual_mac' '-n' 
    63         config_list_foreach "$section" 'virtual_ip' append_list_item args 
    64  
    65         SERVICE_PID_FILE="/var/run/vrrpd_${if}_${id}.pid" 
    66         service_start /usr/sbin/vrrpd $args 
     56                SERVICE_PID_FILE="/var/run/vrrpd_${dev}_${id}.pid" 
     57                service_start /usr/sbin/vrrpd $args 
     58        } 
    6759} 
    6860 
     
    7163        local id 
    7264        local if 
     65        local dev 
    7366 
    7467        section_enabled "$section" || return 1 
    7568 
    7669        config_get id "$section" 'virtual_id' '1' 
    77         config_get_ifname if "$section" 'interface' 'lan' 
     70        config_get if "$section" 'interface' 'lan' 
     71        network_get_device dev "$if" 
    7872 
    79         SERVICE_PID_FILE="/var/run/vrrpd_${if}_${id}.pid" 
     73        SERVICE_PID_FILE="/var/run/vrrpd_${dev}_${id}.pid" 
    8074        service_stop /usr/sbin/vrrpd 
    8175} 
    8276 
    8377start() { 
    84         include /lib/network 
    85         scan_interfaces 
     78        . /lib/functions/network.sh 
    8679        config_load 'vrrpd' 
    8780        config_foreach start_instance 'vrrpd' 
     
    8982 
    9083stop() { 
    91         include /lib/network 
    92         scan_interfaces 
     84        . /lib/functions/network.sh 
    9385        config_load 'vrrpd' 
    9486        config_foreach stop_instance 'vrrpd' 
Note: See TracChangeset for help on using the changeset viewer.