packages/setserial: rename serial initscript to setserial, use uci config

git-svn-id: svn://svn.openwrt.org/openwrt/packages@29212 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2011-11-17 10:47:17 +00:00
parent 783e5578ad
commit a3b544664f
4 changed files with 49 additions and 10 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2006-2008 OpenWrt.org
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=setserial
PKG_VERSION:=2.17
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/setserial
@ -43,8 +43,14 @@ endef
define Package/setserial/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/setserial $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/setserial.config $(1)/etc/config/setserial
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/serial.init $(1)/etc/init.d/setserial
$(INSTALL_BIN) ./files/setserial.init $(1)/etc/init.d/setserial
endef
define Package/setserial/conffiles
/etc/config/setserial
endef
$(eval $(call BuildPackage,setserial))

View File

@ -1,7 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=15
boot() {
/usr/sbin/setserial /dev/tts/1 irq 3
}

View File

@ -0,0 +1,6 @@
package 'setserial'
config 'setserial'
option enabled 0
option device '/dev/ttyS1'
option parameters 'irq 3'

View File

@ -0,0 +1,34 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2011 OpenWrt.org
START=15
section_enabled() {
local enabled
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ] || return 1
}
start_instance() {
local section="$1"
local device
local parameters
local args=""
section_enabled "$section" || return 1
config_get device "$section" 'device'
[ -n "$device" ] || return 1
append args "$device"
config_get parameters "$section" 'parameters'
[ -n "$parameters" ] || return 1
append args "$parameters"
/usr/sbin/setserial $device $parameters
}
boot() {
config_load 'setserial'
config_foreach start_instance 'setserial'
}