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:
parent
783e5578ad
commit
a3b544664f
utils/setserial
@ -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.
|
# 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:=setserial
|
PKG_NAME:=setserial
|
||||||
PKG_VERSION:=2.17
|
PKG_VERSION:=2.17
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=@SF/setserial
|
PKG_SOURCE_URL:=@SF/setserial
|
||||||
@ -43,8 +43,14 @@ endef
|
|||||||
define Package/setserial/install
|
define Package/setserial/install
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/setserial $(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_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
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,setserial))
|
$(eval $(call BuildPackage,setserial))
|
||||||
|
@ -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
|
|
||||||
}
|
|
6
utils/setserial/files/setserial.config
Normal file
6
utils/setserial/files/setserial.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package 'setserial'
|
||||||
|
|
||||||
|
config 'setserial'
|
||||||
|
option enabled 0
|
||||||
|
option device '/dev/ttyS1'
|
||||||
|
option parameters 'irq 3'
|
34
utils/setserial/files/setserial.init
Normal file
34
utils/setserial/files/setserial.init
Normal 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'
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user