#
-# 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.
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
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))
--- /dev/null
+#!/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'
+}