Changeset 29213


Ignore:
Timestamp:
2011-11-17T11:47:19+01:00 (6 years ago)
Author:
nico
Message:

packages/parprouted: use uci config

Location:
packages/net/parprouted
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • packages/net/parprouted/Makefile

    r28915 r29213  
    1010PKG_NAME:=parprouted 
    1111PKG_VERSION:=0.64 
    12 PKG_RELEASE:=2 
     12PKG_RELEASE:=3 
    1313 
    1414PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
     
    4444endef 
    4545 
    46 define Package/parprouted/install        
     46define Package/parprouted/install 
    4747        $(INSTALL_DIR) $(1)/usr/sbin 
    4848        $(INSTALL_BIN) $(PKG_BUILD_DIR)/parprouted $(1)/usr/sbin/ 
    49         $(INSTALL_DIR) $(1)/etc/default 
    50         $(INSTALL_BIN) ./files/parprouted.default $(1)/etc/default/parprouted 
     49        $(INSTALL_DIR) $(1)/etc/config 
     50        $(INSTALL_BIN) ./files/parprouted.config $(1)/etc/config/parprouted 
    5151        $(INSTALL_DIR) $(1)/etc/init.d 
    5252        $(INSTALL_BIN) ./files/parprouted.init $(1)/etc/init.d/parprouted 
    5353endef 
    5454 
     55define Package/parprouted/conffiles 
     56/etc/config/parprouted 
     57endef 
     58 
    5559$(eval $(call BuildPackage,parprouted)) 
  • packages/net/parprouted/files/parprouted.init

    r28915 r29213  
    44START=50 
    55 
    6 PROG="parprouted" 
    7 COMMAND="/usr/sbin/$PROG" 
    8 DEFAULT="/etc/default/$PROG" 
     6section_enabled() { 
     7        local enabled 
     8        config_get_bool enabled "$1" 'enabled' 0 
     9        [ $enabled -gt 0 ] 
     10} 
     11 
     12append_interface() { 
     13        local name="$1" 
     14        local interface 
     15        config_get interface "$name" 'ifname' "$name" 
     16        append args "$interface" 
     17} 
     18 
     19start_instance() { 
     20        local section="$1" 
     21        local permanent 
     22        local interfaces 
     23        local args="" 
     24 
     25        section_enabled "$section" || return 1 
     26 
     27        config_get_bool permanent "$section" 'permanent' 0 
     28        [ $permanent -eq 0 ] || append args "-p" 
     29 
     30        config_list_foreach "$section" 'interfaces' append_interface 
     31 
     32        service_start /usr/sbin/parprouted $args 
     33} 
    934 
    1035start() { 
    11         [ -f $DEFAULT ] && . $DEFAULT 
    12         service_start $COMMAND $OPTIONS 
     36        include /lib/network 
     37        scan_interfaces 
     38        config_load 'parprouted' 
     39        config_foreach start_instance 'parprouted' 
    1340} 
    1441 
    1542stop() { 
    16         service_stop $COMMAND 
     43        service_stop /usr/sbin/parprouted 
    1744} 
Note: See TracChangeset for help on using the changeset viewer.