~xnox/debian/sid/dahdi-linux/nmu-659818

« back to all changes in this revision

Viewing changes to build_tools/live_dahdi

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell, Tzafrir Cohen, Victor Seva
  • Date: 2009-05-20 07:22:46 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090520072246-y1ba8ofc81ykgf8z
Tags: 1:2.2.0~dfsg~rc4-1
* New upstream release

[ Tzafrir Cohen ]
* NOT RELEASED YET
* Dropped qozap as wcb4xxp provides that functionality.
* New upstream RC.
* Actually build OpenVox drivers.
* opvxa1200.c: rev. 1.4.12.4 (battery fixes and such)
* Fix '${match}' in udev rules file (hardwire).
* no_firmware_download: Disable downloading a binary kernel module at 
  build time.

[ Victor Seva ]
* fix debian/watch. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
set -e
4
4
 
5
 
LINUX_DIR=${LINUX_DIR:=..}
6
 
TOOLS_DIR=${TOOLS_DIR:=`(cd ../../dahdi-tools; pwd)`}
 
5
LINUX_DIR=${LINUX_DIR:=.}
 
6
LINUX_DIR_FULL=`(cd $LINUX_DIR; pwd)`
 
7
TOOLS_DIR=${TOOLS_DIR:=`(cd ../dahdi-tools; pwd)`}
7
8
DESTDIR=$PWD/live
8
9
KVERS=${KVERS:-`uname -r`}
9
10
MODULES_DIR="$DESTDIR/lib/modules/$KVERS/dahdi"
36
37
FIRMWARE_DIR="$DESTDIR/usr/share/dahdi"
37
38
export FIRMWARE_DIR
38
39
 
 
40
ASTRIBANK_TOOL="$DESTDIR/usr/sbin/astribank_tool"
 
41
export ASTRIBANK_TOOL
 
42
 
 
43
ASTRIBANK_HEXLOAD="$DESTDIR/usr/sbin/astribank_hexload"
 
44
export ASTRIBANK_HEXLOAD
 
45
 
39
46
# make sure Astribank initialization scripts are from our tree.
40
47
xpp_ARGS="$xpp_ARGS initdir=$FIRMWARE_DIR"
41
48
 
43
50
# With the remote mode, I can't rely on files in the source directory.
44
51
dahdi_drivers() {
45
52
        perl -MDahdi::Hardware -e '
46
 
                my $hardware = Dahdi::Hardware->scan;
47
 
                print join(" ", $hardware->drivers);
 
53
                my @drivers = Dahdi::Hardware->drivers;
 
54
                print join(" ", @drivers);
48
55
                '
49
56
}
50
57
 
51
 
# Detect the modules used in the system:
52
 
for mod in `dahdi_drivers`; do
53
 
        case "$mod" in
 
58
# Add modules for existing hardware on the system for the list of 
 
59
# modules to load.
 
60
#
 
61
# As module loading is manual with insmod, some manual fixes are needed.
 
62
set_modules_to_load() {
 
63
        for mod in `dahdi_drivers`; do
 
64
                case "$mod" in
54
65
                xpp_usb) 
55
66
                        MODULES_LOAD="$MODULES_LOAD xpp/xpp xpp/xpd_fxs"
56
67
                        MODULES_LOAD="$MODULES_LOAD xpp/xpd_fxo xpp/xpd_pri" 
61
72
                        ;;
62
73
                wctdm24xxp | wct4xxp | wcte12xp | wctc4xp)
63
74
                        MODULES_LOAD="$MODULES_LOAD $mod/$mod"
64
 
                        ;;
 
75
                                ;;
65
76
                wanpipe)
66
77
                        : # requires different handling
67
78
                        ;;
68
79
                *)
69
80
                        MODULES_LOAD="$MODULES_LOAD $mod"
70
81
                        ;;
71
 
        esac
72
 
done
 
82
                esac
 
83
        done
 
84
}
73
85
 
74
86
# Initialize the Xorcom Astribank (xpp/) using perl utiliites:
75
87
# intended to replace all the the three functions below if user has 
96
108
# returns: the result from 
97
109
unload_module() {
98
110
        module="$1"
99
 
        line=`lsmod 2>/dev/null | grep "^$1 "`
 
111
        line=`lsmod 2>/dev/null | grep "^$1 " || :`
100
112
        if [ "$line" = '' ]; then return; fi # module was not loaded
101
113
 
102
114
        set -- $line
117
129
usage() {
118
130
        me=`basename $0`
119
131
        echo "$me: Run DAHDI in a test environment"
120
 
        echo 'Version: $Id: live_dahdi 5535 2008-12-15 20:31:27Z sruffell $'
 
132
        echo 'Version: $Id: live_dahdi 6487 2009-04-25 16:35:33Z tzafrir $'
121
133
        echo ''
122
134
        echo "Usage:           equivalent of:"
123
135
        echo "$me configure  ./configure"
137
149
case "$1" in
138
150
configure)
139
151
        shift
140
 
        cd "$TOOLS_DIR"; ./configure --with-dahdi="$LINUX_DIR" "$@"
 
152
        cd "$TOOLS_DIR"; ./configure --with-dahdi="$LINUX_DIR_FULL" "$@"
141
153
        ;;
142
154
install)
143
155
        shift
159
171
        rsync -ai "$0" $DESTDIR "$2:/tmp/"
160
172
        ;;
161
173
unload)
162
 
        $AST_SCRIPT stop
 
174
        # OK for Asterisk not to be running. TODO: a better test?
 
175
        $AST_SCRIPT stop || :
163
176
        for mod in $REMOVE_MODULES; do
164
177
                unload_module $mod
165
178
        done
167
180
load)
168
181
        # TODO: Find a way to use modprobe.
169
182
        # Or implement a way to pass arguments to modules here (yuck)
 
183
        set_modules_to_load
170
184
        for module in $MODULES_LOAD; do
171
185
                eval module_args="\$`basename ${module}`_ARGS"
172
186
                insmod $MODULES_DIR/$module.ko $module_args