Skip to content

Commit 95e9441

Browse files
committed
Add gobi-loader config file and init script
1 parent c672639 commit 95e9441

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

openwrt/trunk/package/iapps/gobi_loader/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ endef
3333
define Package/$(PKG_NAME)/install
3434
$(INSTALL_DIR) $(1)/usr/bin
3535
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/bin
36+
$(INSTALL_DIR) $(1)/etc/init.d
37+
$(INSTALL_BIN) ./files/gobi-loader.init $(1)/etc/init.d/gobi-loader
38+
$(INSTALL_DIR) $(1)/etc/config
39+
$(INSTALL_DATA) ./files/gobi-loader.config $(1)/etc/config/gobi-loader
3640
endef
3741

3842
# pre-install script
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
config gobi-loader 'core'
2+
option enabled '1'
3+
option type 'gobi2000'
4+
option device '/dev/ttyUSB0'
5+
option firmware '/mnt/openwrt/gobi2k/firmware/Images/HP/gsm/'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/sh /etc/rc.common
2+
# Copyright (C) 2009-2014 OpenWrt.org
3+
4+
START=96
5+
6+
PROG=/usr/bin/gobi_loader
7+
8+
error() {
9+
echo "${initscript}:" "$@" 1>&2
10+
}
11+
12+
start_instance() {
13+
local s="$1"
14+
15+
config_get_bool enabled "$1" 'enabled' 0
16+
[ $enabled -eq 0 ] && return
17+
18+
config_get device "$s" 'device'
19+
if [ -z "$device" ]; then
20+
error "in section '$s' option device is missing"
21+
return 1
22+
elif [ ! -c "$device" ]; then
23+
error "device '$device' does not exist"
24+
return 1
25+
fi
26+
27+
config_get firmware "$s" 'firmware'
28+
if [ -z "$firmware" ]; then
29+
error "in section '$s' option firmware is missing"
30+
return 1
31+
elif [ ! -d "$firmware" ]; then
32+
error "firmware '$firmware' does not exist"
33+
return 1
34+
fi
35+
36+
config_get type "$s" 'type'
37+
38+
local type_arg
39+
if [ "x$type" = 'xgobi2000' ]; then
40+
type_arg='-2000'
41+
else
42+
type_arg=''
43+
fi
44+
45+
"$PROG" "$type_arg" "$device" "$firmware"
46+
}
47+
48+
start() {
49+
config_load 'gobi-loader'
50+
config_foreach start_instance 'gobi-loader'
51+
}

0 commit comments

Comments
 (0)