File: tsipackdb.in

package info (click to toggle)
libtabe 0.2.6-1.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,576 kB
  • ctags: 1,777
  • sloc: ansic: 17,458; sh: 9,848; makefile: 273
file content (49 lines) | stat: -rwxr-xr-x 871 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
#
# Copyright 1999, TaBE Project, All Rights Reserved.
# Copyright 1999, Pai-Hsiang Hsiao, All Rights Reserved.
#
# $Id: tsipackdb.in,v 1.8 2004/09/28 14:59:14 kcwu Exp $
#

PATH=@with_db_bin@

path_list="`echo $PATH | sed 's/:/ /g'`"
export PATH path_list

if [ "$#" != 1 ]; then
    echo "Usage: tsipackdb <filename.db>"
    exit 0
fi

mywhich () {
    for p in $path_list; do
	if [ -x $p/$1 ]; then
	    echo $p/$1
	    break
	fi
    done
}

pack_db_file () {
    db_dump=`mywhich ${1}_dump`
    db_load=`mywhich ${1}_load`
    if [ -x "$db_dump" ] && [ -x "$db_load" ]; then
	echo "Try using $db_dump and $db_load to pack $2 ...."

	${1}_dump $2 > $2.tmp && \
	${1}_load $2.new < $2.tmp && \
	mv $2.new $2 && \
	rm -f $2.tmp && \
	return 0
    fi

    return 1
}

for dbprefix in db4.5 db db2 db3 db4
do
    pack_db_file $dbprefix $1 && exit 0
done

exit 0