1 |
#!/bin/sh |
2 |
|
3 |
sudo echo "Cache credentials for sudo..." |
4 |
|
5 |
function check_upstream() { |
6 |
what="$1" |
7 |
upstream=`wget -O - http://${what}.sourceforge.net/ -o /dev/null | grep "Latest Source Package" | cut -d\" -f2` |
8 |
|
9 |
echo "Upstream version of $what is $upstream" |
10 |
|
11 |
if echo $upstream | grep 'http://' ; then |
12 |
wget -nc -c $upstream |
13 |
else |
14 |
wget -nc -c http://${what}.sourceforge.net/$upstream |
15 |
fi |
16 |
} |
17 |
|
18 |
d=`pwd` |
19 |
tmp="/tmp/est-latest" |
20 |
|
21 |
function extract() { |
22 |
arc="$1" |
23 |
|
24 |
name=`echo $arc | cut -d- -f1` |
25 |
ver=`echo $arc | cut -d- -f2 | sed 's/\.tar.gz//'` |
26 |
|
27 |
if dpkg -l "$name" | grep "^ii" | grep "$ver" 2>&1 >/dev/null ; then |
28 |
echo "Skipping $name [$ver], allready installed." |
29 |
return |
30 |
fi |
31 |
|
32 |
mkdir $tmp |
33 |
cd $tmp |
34 |
|
35 |
echo "Extracting $name [$ver] to $tmp" |
36 |
tar xvfz "$d/$arc" |
37 |
cd * |
38 |
./configure |
39 |
make |
40 |
sudo checkinstall -y |
41 |
|
42 |
# build perl bindings? |
43 |
test -d perlnative && ( |
44 |
echo "*** installing native perl bindings" |
45 |
cd perlnative |
46 |
./configure |
47 |
make |
48 |
sudo make install |
49 |
) |
50 |
|
51 |
cd $d |
52 |
sudo rm -Rf $tmp |
53 |
} |
54 |
|
55 |
dpkg -l | awk '{ print $2 }' | egrep '^lib(estraier|qdbm)' | xargs apt-get remove -y |
56 |
|
57 |
qdbm_ver="$1" |
58 |
est_ver="$2" |
59 |
|
60 |
if [ -z "$qdbm_ver" ] ; then |
61 |
check_upstream 'qdbm' |
62 |
extract `ls -d qdbm-*.tar.gz | tail -1` |
63 |
else |
64 |
extract `ls -d qdbm-${qdbm_ver}.tar.gz | tail -1` |
65 |
fi |
66 |
|
67 |
if [ -z "$est_ver" ] ; then |
68 |
check_upstream 'hyperestraier' |
69 |
extract `ls -d hyperestraier-*.tar.gz | tail -1` |
70 |
else |
71 |
extract `ls -d hyperestraier-${est_ver}.tar.gz | tail -1` |
72 |
fi |