packages/utils/setserial/files/setserial.init
nico a3b544664f 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
2011-11-17 10:47:17 +00:00

35 lines
639 B
Bash

#!/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'
}