source: npl/commonservers/postgresql/postgresql.SlackBuild @ 47dca21

Last change on this file since 47dca21 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 4.8 KB
RevLine 
[c5c522c]1#!/bin/bash
2#DEP:libtermcap
3#DEP:readline
4#DEP:apache_ant
5#DEP:zlib
6
7PKGSOURCE=`ls postgresql*|grep -v DatuX`
8if [ -z '$PKGSOURCE' ] ; then
9    echo "First download postgresql source package to this `pwd` directory"
10    exit 1
11fi
12#butt VERSION=`echo $PKGSOURCE|cut -f2 -d -|sed s/.tar.gz//|sed s/.tar.bz2//`
13VERSION=9.1.21
14NAME=postgresql
15NAMELIB=libpq
16CWD=`pwd`
17PACKAGE=`echo $PKGSOURCE|cut -f1 -d"-"`
18ROOT=`pwd`
19EXT=`ls |grep postgresql|grep tar.gz`
20if [ -z $EXT ] ; then
21    EXT=tar.bz2
22    TARCMD="tar -xjf"
23    PGM=`ls postgresql-*.$EXT | sed s/.tar.bz2//`
24    else
25        EXT=tar.gz
26        TARCMD="tar -xzf"
27        PGM=`ls postgresql-*.$EXT | sed s/.tar.gz//`
28fi     
29#Der uut gebopt door Ronnie :-)
30#SLEXT=-i386-"$VERSIE"DatuX.tgz
31export MAKEFLAGS="-j5"
32if [ -d $ROOT/pkgtmp ] ; then
33        rm -rf "$ROOT/pkgtmp"
34fi     
35mkdir $ROOT/pkgtmp
36cd $ROOT/pkgtmp
37PKGROOT=`pwd`;
38cd $ROOT
39if [ -d $PGM ] ; then
40        rm -rf $PGM
41fi     
42echo $SLEXT
43
44# user adden
45useradd -u 100 postgresql
46
47
48
49$TARCMD $PGM.$EXT ||exit 1
50if [ $? == 1 ] ; then
51    echo "#"
52    echo "#########################  Untarring file failed  #################################"
53    echo "#"
54    exit 1
55fi   
56mkdir -p $PKGROOT/etc/rc.d $PKGROOT/install $PKGROOT/var/run/postgresql $PKGROOT/usr/doc/$PGM $PKGROOT/etc/postinst.d
57########################################## maken van de install scripts #######################################
58cat << EOF >$PKGROOT/install/slack-desc
59# HOW TO EDIT THIS FILE:
60# The "handy ruler" below makes it easier to edit a package description.  Line
61# up the first '|' above the ':' following the base package name, and the '|'
62# on the right side marks the last column you can put a character in.  You must
63# make exactly 11 lines for the formatting to be correct.  It's also
64# customary to leave one space after the ':'.
65   |-----handy-ruler------------------------------------------------------|
66postgresql: PostgreSQL is an advanced object-relational database
67postgresql: management system that supports an extended subset of
68postgresql: the SQL standard, including transactions, foreign keys,
69postgresql: subqueries, triggers, user-defined types and functions.
70postgresql: This distribution also contains several language bindings,
71postgresql: including C, Perl, Python, and Tcl, as well as a JDBC driver.
72postgresql:
73postgresql:
74postgresql:
75postgresql:
76postgresql: Package Created By: (c) 2006 DatuX
77EOF
78
79
80mkdir -p $PKGROOT/service/postgresql/log/main
81chown postgresql $PKGROOT/service/postgresql/log/main
82cat <<EOF >$PKGROOT/service/postgresql/run
83#!/bin/bash
84rm /home/system/postgresql/data/postmaster.pid
85exec 2>&1
86exec pgrphack setuidgid postgresql /usr/bin/postmaster -i -D /home/system/postgresql/data -h 127.0.0.1
87EOF
88
89
90cat <<EOF >$PKGROOT/service/postgresql/log/run
91#!/bin/bash
92exec setuidgid postgresql multilog t ./main
93EOF
94
95
96chmod +x $PKGROOT/service/postgresql/run
97
98chmod +x $PKGROOT/service/postgresql/log/run
99
100cp $CWD/{start,stop} $PKGROOT/service/postgresql
101chmod +x $PKGROOT/service/postgresql/{start,stop} || exit 1
102
103
104cat <<EOF >$PKGROOT/install/doinst.sh
105( sbin/postinst.sh )
106EOF
107
108chmod +x $PKGROOT/etc/postinst.d/post.postgresql
109
110cd $ROOT/$PGM &&
111if [ $? == 1 ] ; then
112    echo "#"
113    echo "#########################  Changing to source directory $PGM failed  #################################"
114    echo "#"
115    exit 1
116fi   
117export PATH=/usr/lib/ant/bin/:${PATH}
118./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib --with-java || exit 1
119if [ $? == 1 ] ; then
120    echo "#"
121    echo "#########################  ./configure failed please try it manualy  #################################"
122    echo "#"
123    exit 1
124fi   
125make
126make install DESTDIR=$PKGROOT/
127if [ $? == 1 ] ; then
128    echo "#"
129    echo "#########################  Installing to temporary directory failed  #################################"
130    echo "#"
131    exit 1
132fi   
133
134cd contrib
135make || exit 1
136make install DESTDIR=$PKGROOT/ || exit 1
137cd ..
138
139
140
141cd $PKGROOT &&
142cp $ROOT/post.postgresql $PKGROOT/etc/postinst.d/
143
144
145
146
147cd $PKGROOT
148#makepkg -l n -c n "postgresql-7.4.6-i386-1DatuX.tgz"
149makepkg -l y -c n $CWD/$NAME.pkg > /dev/null &&
150echo $VERSION > $CWD/$NAME.version &&
151arch > $CWD/$NAME.arch || exit 1
152
153#libpq ook appart voor kleine installs
154cd $CWD
155mv $PKGROOT $PKGROOT.old
156mkdir -p $PKGROOT/usr/lib
157cp -a $PKGROOT.old/usr/lib/libpq* $PKGROOT/usr/lib/ || exit 1
158cd $PKGROOT
159makepkg -l y -c n $CWD/$NAMELIB.pkg > /dev/null &&
160echo $VERSION > $CWD/$NAMELIB.version &&
161arch > $CWD/$NAMELIB.arch || exit 1
162
163
164if [ $? == 1 ] ; then
165    echo "#"
166    echo "#########################  creation of slackware package failed try it manualy  #################################"
167    echo "#"
168    exit 1
169fi   
170cd $ROOT
171
172#mv $PKGROOT/postgresql-7.4.6-i386-1DatuX.tgz $ROOT/
173#rm -r "$ROOT/pkgtmp"
174#rm -r "$ROOT/$PACKAGE-$VERSION"
175
176###########################################################################################################
177
Note: See TracBrowser for help on using the repository browser.