File: drvdsninst.sh

package info (click to toggle)
db5.3 5.3.28%2Bdfsg1-0.5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 158,360 kB
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,326; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,077; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (56 lines) | stat: -rw-r--r-- 1,111 bytes parent folder | download | duplicates (18)
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
#!/bin/sh
#
# Install ODBC driver and system DSN
#    $1   driver name
#    $2   DSN name
#    $3   libtool .la file
#    $4   directory where libtool installs shared library

which odbcinst > /dev/null || {
    echo >&2 "no usable odbcinst program"
    exit 1
}

DRVNAME=$1
DRVNAME_BR='['"$1"']'

DSNNAME=$2
DSNNAME_BR='['"$2"']'

. $3 || exit 1

for n in $library_names ; do
    true
done
if [ -z "$n" ] ; then
    echo >&2 "no shared library name for driver $DRVNAME in $3"
    exit 1
fi
DRVSHLIB="$4/$n"
if [ ! -r "$DRVSHLIB" ] ; then
    echo >&2 "no shared library for driver $DRVNAME in $4"
    exit 1
fi

cat > /tmp/drvinst.$$ << __EOD__
$DRVNAME_BR
Description=$DRVNAME
Driver=$DRVSHLIB
Setup=$DRVSHLIB
FileUsage=1
__EOD__

odbcinst -q -d -n "$DRVNAME" | fgrep "$DRVNAME_BR" > /dev/null || {
    odbcinst -i -d -n "$DRVNAME" -f /tmp/drvinst.$$ || true
}
rm -f /tmp/drvinst.$$

cat > /tmp/dsninst.$$ << __EOD__
$DSNNAME_BR
Driver=$DRVNAME
__EOD__

odbcinst -q -s -n "$DSNNAME" | fgrep "$DSNNAME_BR" > /dev/null || {
    odbcinst -i -l -s -n "$DSNNAME" -f /tmp/dsninst.$$ || true
}
rm -f /tmp/dsninst.$$