packages/utils/setserial/files/setserial.init

35 lines
639 B
Plaintext
Raw Normal View History

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