Gentoo Archives: gentoo-commits

From: "Stefan Briesenick (sbriesen)" <sbriesen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-dialup/capi4k-utils/files: capi.initd
Date: Sun, 20 Apr 2008 23:00:49
Message-Id: E1JniWd-0001lt-42@stork.gentoo.org
1 sbriesen 08/04/20 23:00:47
2
3 Modified: capi.initd
4 Log:
5 made init-script posix-shell compatible
6 (Portage version: 2.1.5_rc5)
7
8 Revision Changes Path
9 1.8 net-dialup/capi4k-utils/files/capi.initd
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-dialup/capi4k-utils/files/capi.initd?rev=1.8&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-dialup/capi4k-utils/files/capi.initd?rev=1.8&content-type=text/plain
13 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-dialup/capi4k-utils/files/capi.initd?r1=1.7&r2=1.8
14
15 Index: capi.initd
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.initd,v
18 retrieving revision 1.7
19 retrieving revision 1.8
20 diff -u -r1.7 -r1.8
21 --- capi.initd 3 Sep 2005 20:25:17 -0000 1.7
22 +++ capi.initd 20 Apr 2008 23:00:46 -0000 1.8
23 @@ -1,21 +1,21 @@
24 #!/sbin/runscript
25 -# Copyright 1999-2005 Gentoo Foundation
26 +# Copyright 1999-2008 Gentoo Foundation
27 # Distributed under the terms of the GNU General Public License v2
28 -# $Header: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.initd,v 1.7 2005/09/03 20:25:17 sbriesen Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/net-dialup/capi4k-utils/files/capi.initd,v 1.8 2008/04/20 23:00:46 sbriesen Exp $
30
31 opts="info showconfig"
32
33 depend() {
34 - after isapnp pcmcia bluetooth hotplug
35 + after isapnp pcmcia bluetooth
36 }
37
38 # possible firmware locations (list and order taken from 'capiinit')
39 -FWDIRS=(/lib/firmware/isdn /lib/firmware /usr/share/isdn /usr/lib/isdn /lib/isdn)
40 +FWDIRS="/lib/firmware/isdn /lib/firmware /usr/share/isdn /usr/lib/isdn /lib/isdn"
41
42 # Firmware search
43 findfw() { # <fw_name>
44 local DIR
45 - for DIR in ${FWDIRS[*]}; do
46 + for DIR in ${FWDIRS}; do
47 if [ -f "${DIR}/${1}" ]; then
48 echo "${DIR}/${1}"; return 0
49 fi
50 @@ -26,26 +26,27 @@
51 # looking for 'detected' cards (currently only 'sedlfax')
52 detected() { # <driver>
53 # /proc/capi/controller: <controller> <drivername> <state> <cardname> <controllerinfo>
54 - /bin/sed -n "s:^\([1-9][0-9]*\) \+${1} \+detected \+.*:\1:p" \
55 + sed -n "s:^\([1-9][0-9]*\) \+${1} \+detected \+.*:\1:p" \
56 /proc/capi/controller 2>/dev/null
57 }
58
59 # detecting loaded mISDN modules
60 misdn_modules() {
61 - /bin/sed -n "s:^mISDN_core \+[0-9]\+ \+[0-9]\+ \+\([^ ]\+\).*\$:\1:p" \
62 - /proc/modules 2>/dev/null | /bin/tr "," " "
63 + sed -n "s:^mISDN_core \+[0-9]\+ \+[0-9]\+ \+\([^ ]\+\).*\$:\1:p" \
64 + /proc/modules 2>/dev/null | tr "," " "
65 }
66
67 # detecting loaded CAPI drivers
68 capi_drivers() {
69 local DRV MISDN=0
70 - while read DRV; do
71 + for DRV in $(sed -n "s:^[0-9]\+ \+\([^ ]\+\).*\$:\1:p" /proc/capi/controller 2>/dev/null); do
72 case "${DRV}" in
73 mISDN) MISDN=1;;
74 ?*) echo "${DRV}";;
75 esac
76 - done < <(/bin/sed 2>/dev/null -n "s:^[0-9]\+ \+\([^ ]\+\).*\$:\1:p" /proc/capi/controller)
77 - if [ ${MISDN} -gt 0 ]; then # dirty hack to find loaded mISDN modules
78 + done
79 + # dirty hack to find loaded mISDN modules
80 + if [ ${MISDN} -gt 0 ]; then
81 for DRV in $(misdn_modules); do
82 case "${DRV}" in
83 mISDN_*|l3udss1|faxl3) continue;;
84 @@ -58,7 +59,7 @@
85 # detecting bluetooth CIP connections
86 bluez_cip() {
87 [ -x /usr/bin/ciptool ] && \
88 - /bin/sed -n "s:[0-9]\+ \+cmtp \+[^ ]\+ \+\([0-9A-F:]\+\) \+.*\$:\1:p" \
89 + sed -n "s:[0-9]\+ \+cmtp \+[^ ]\+ \+\([0-9A-F:]\+\) \+.*\$:\1:p" \
90 /proc/capi/controller 2>/dev/null
91 }
92
93 @@ -81,7 +82,7 @@
94 done
95
96 ebegin "Starting CAPI"
97 - /usr/sbin/capiinit 2>/dev/null activate
98 + /usr/sbin/capiinit activate 2>/dev/null
99 if eend $?; then
100 local CIP MSG INFO FW CARD MISDN
101
102 @@ -93,11 +94,11 @@
103 if [ -n "${FW}" ]; then
104 for CARD in ${MISDN}; do
105 ebegin "Loading firmware '${FW##*/}' onto controller ${CARD}"
106 - /usr/sbin/avmcapictrl &>/dev/null load "${FW}" "${CARD}"
107 + /usr/sbin/avmcapictrl load "${FW}" "${CARD}" 2>&1 >/dev/null
108 eend $?
109 done
110 else
111 - eerror "Firmware 'ISAR.BIN' not found in ${FWDIRS[0]}"
112 + eerror "Firmware 'ISAR.BIN' not found in ${FWDIRS%% *}"
113 fi
114 fi
115
116 @@ -105,10 +106,10 @@
117 if [ -n "${CAPI_CIP_DEVICES}" -a -x /usr/bin/ciptool ]; then
118 for CIP in ${CAPI_CIP_DEVICES}; do
119 ebegin "CIP connect to ${CIP}"
120 - INFO=$(/usr/bin/ciptool 2>&1 connect "${CIP}")
121 + INFO=$(/usr/bin/ciptool connect "${CIP}" 2>&1)
122 if ! eend $?; then
123 [ -n "${INFO}" ] && \
124 - while read line MSG; do eerror " ${MSG}"; done < <(echo "${INFO}")
125 + echo "${INFO}" | while read line MSG; do eerror " ${MSG}"; done
126 fi
127 done
128 sleep 0.3 # give subsystems time to initialize
129 @@ -118,26 +119,26 @@
130 [ -f /proc/capi/capidrv -o "${CAPI_LOAD_CAPIDRV}" != "yes" ] || /sbin/modprobe -s capidrv
131
132 # show controllers
133 - INFO=$(</proc/capi/controller)
134 + INFO=$(cat /proc/capi/controller)
135 if [ -n "${INFO}" ]; then
136 einfo "Available CAPI controllers:"
137 - while read MSG; do einfo " ${MSG}"; done < <(echo "${INFO}")
138 + echo "${INFO}" | while read MSG; do einfo " ${MSG}"; done
139 fi
140 fi
141 return 0 # never fail
142 }
143
144 stop() {
145 - local DRV CIP RET FCNT=0 DRIVERS=$(/bin/sort -u <(capi_drivers))
146 + local DRV CIP RET FCNT=0 DRIVERS=$(capi_drivers | sort -u)
147
148 # if some CAPI applications are still running, kill 'em
149 - if /bin/fuser 2>/dev/null -s /dev/capi20; then
150 + if fuser -s /dev/capi20 2>/dev/null; then
151 ebegin "Stopping CAPI applications"
152 - /bin/fuser -ks /dev/capi20; RET=$?
153 + fuser -ks /dev/capi20; RET=$?
154 while [ ${RET} -eq 0 -a ${FCNT} -lt 10 ]; do
155 - : $((FCNT++)); sleep 0.5; /bin/fuser -s /dev/capi20; RET=$?
156 + : $((FCNT++)); sleep 0.5; fuser -s /dev/capi20; RET=$?
157 done
158 - [ $RET -ne 0 ]
159 + [ ${RET} -ne 0 ]
160 eend $?
161 fi
162
163 @@ -150,8 +151,10 @@
164
165 ebegin "Stopping CAPI"
166 [ "${CAPI_LOAD_CAPIDRV}" = "yes" ] && /sbin/modprobe -sqr capidrv
167 - [ "${CAPI_UNLOAD_CARDS}" = "yes" ] && /usr/sbin/capiinit &>/dev/null stop
168 - for DRV in ${DRIVERS}; do /sbin/modprobe -sqr "${DRV}"; done
169 + [ "${CAPI_UNLOAD_CARDS}" = "yes" ] && /usr/sbin/capiinit stop &>/dev/null
170 + for DRV in ${DRIVERS}; do
171 + /sbin/modprobe -sqr "${DRV}"
172 + done
173 /sbin/modprobe -sqr capi
174 eend 0 # ignore errors
175 }
176 @@ -168,10 +171,10 @@
177
178 showconfig() {
179 local MSG INFO
180 - if INFO=$(/usr/sbin/capiinit 2>&1 show); then
181 - while read MSG; do einfo "${MSG}"; done < <(echo "${INFO}")
182 + if INFO=$(/usr/sbin/capiinit show 2>&1); then
183 + echo "${INFO}" | while read MSG; do einfo "${MSG}"; done
184 return 0
185 fi
186 - while read MSG; do eerror "${MSG}"; done < <(echo "${INFO}")
187 + echo "${INFO}" | while read MSG; do eerror "${MSG}"; done
188 return 1
189 }
190
191
192
193 --
194 gentoo-commits@l.g.o mailing list