blob: b0982a0fc6b15f15e2d9748d9559339c1b439e35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-dialup/isdn4k-utils/files/3.6_pre20041219/isdn.initd,v 1.1 2004/12/23 22:12:34 mrness Exp $
opts="start stop save reload info show cards"
depend() {
use capi hisax
}
check_cards() {
local -a _idxa
local _it _lin _idx=0
read _it _lin < <(/usr/bin/head 2>/dev/null -n1 /dev/isdninfo) || return 1
read -a _idxa < <(echo $_lin)
while [ $_idx -lt 65 ]; do
[ "${_idxa[$_idx]}" = "-" ] || return 0
: $((_idx+=2)); [ -z "${_idxa[$_idx]}" ] && break
done
return 1
}
check_module() {
/bin/grep 2>/dev/null -q "^${1} " /proc/modules
}
start() {
/sbin/modprobe -s isdn && check_module isdn
if [ $? -ne 0 ]; then
eerror "ERROR: could not load ISDN driver"
/sbin/modprobe -sqr isdn
return 1
fi
if ! check_cards; then
eerror "ERROR: no ISDN cards available"
/sbin/modprobe -sqr isdn
return 1
fi
ebegin "Loading isdnctrl configuration"
[ ! -f "${ISDNCTRL_CONFIG}" ] || /usr/sbin/isdnctrl readconf "${ISDNCTRL_CONFIG}" >/dev/null
eend $?
if [ -n "${IPROFD_SETTINGS}" ]; then
ebegin "Starting modem-register daemon"
start-stop-daemon --start --quiet --exec /usr/sbin/iprofd -- "${IPROFD_SETTINGS}"
eend $?
fi
}
stop() {
if [ -n "${IPROFD_SETTINGS}" ]; then
ebegin "Stopping modem-register daemon"
start-stop-daemon --stop --quiet --retry 5 --exec /usr/sbin/iprofd
eend $?
fi
ebegin "Unloading isdnctrl configuration"
/usr/sbin/isdnctrl reset force >/dev/null
eend $?
}
save() {
ebegin "Saving isdnctrl configuration"
/usr/sbin/isdnctrl writeconf "${ISDNCTRL_CONFIG}" >/dev/null
eend $?
}
reload() {
ebegin "Reloading isdnctrl configuration"
/usr/sbin/isdnctrl reset >/dev/null
[ ! -f "${ISDNCTRL_CONFIG}" ] || /usr/sbin/isdnctrl readconf "${ISDNCTRL_CONFIG}" >/dev/null
eend $?
}
cards() {
local -a _idxa
local _it _lin _idx=0
if ! read _it _lin < <(/usr/bin/head 2>/dev/null -n1 /dev/isdninfo); then
eerror "ERROR: no ISDN cards available"
return 1
fi
read -a _idxa < <(echo $_lin)
while [ $_idx -lt 65 ]; do
[ "${_idxa[$_idx]}" = "-" ] || einfo "$((_idx / 2)) ${_idxa[$_idx]}"
: $((_idx+=2)); [ -z "${_idxa[$_idx]}" ] && break
done
}
info() {
/usr/sbin/isdnctrl status all
}
show() {
/usr/sbin/isdnctrl list all
}
|