forked from yutakat/pgsqlenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgsqlenv-install
executable file
·44 lines (37 loc) · 1.2 KB
/
pgsqlenv-install
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
#!/usr/bin/env bash
URL=ftp://ftp.postgresql.org/pub/source/v$1/postgresql-$1.tar.bz2
MD5URL=$URL.md5
SRCDIR=$PGSQLBUILD_PATH
DIR=postgresql-$1
FILENAME=postgresql-$1.tar.bz2
MD5FILENAME=$FILENAME.md5
PREFIX=$PGSQLENV_VERSION_INSTALL_DIR/$1
if [ -d $PREFIX ] ; then
if [ "$FLAG_FORCE" = "1" ] ; then
pgsqlenv -f uninstall $1
else
echo Already installed.
exit 1
fi
fi
if [ ! -d $SRCDIR ]
then
mkdir -p $SRCDIR
fi
cd $SRCDIR
echo -n downloading...
if [ -e $FILENAME ]
then
( wget -q -O - $MD5URL | md5sum --status -c ) || ( rm -f $FILENAME ; wget -q $URL )
else
wget -q $URL
fi
(tar xjf $FILENAME && echo OK ) || (echo FAILED && exit 1)
cd $SRCDIR/$DIR
(echo -n configuring... ; ./configure prefix=$PREFIX >configure.log 2>&1 && echo DONE ) || echo FAILED
(echo -n building... ; make >make.log 2>&1 && echo DONE ) || echo FAILED
(echo -n regression test... ; make check >make_check.log 2>&1 && echo DONE ) || echo FAILED
(echo -n installing...; make install >>make_install.log 2>&1 && echo DONE ) || echo FAILED
cd contrib
(echo -n building contrib... ; make >make.log 2>&1 && echo DONE ) || echo FAILED
(echo -n installing contrib...; make install >>make_install.log 2>&1 && echo DONE ) || echo FAILED