#!/bin/bash #DEP:libtermcap #DEP:readline #DEP:apache_ant #DEP:zlib PKGSOURCE=`ls postgresql*|grep -v DatuX` if [ -z '$PKGSOURCE' ] ; then echo "First download postgresql source package to this `pwd` directory" exit 1 fi #butt VERSION=`echo $PKGSOURCE|cut -f2 -d -|sed s/.tar.gz//|sed s/.tar.bz2//` VERSION=9.1.21 NAME=postgresql NAMELIB=libpq CWD=`pwd` PACKAGE=`echo $PKGSOURCE|cut -f1 -d"-"` ROOT=`pwd` EXT=`ls |grep postgresql|grep tar.gz` if [ -z $EXT ] ; then EXT=tar.bz2 TARCMD="tar -xjf" PGM=`ls postgresql-*.$EXT | sed s/.tar.bz2//` else EXT=tar.gz TARCMD="tar -xzf" PGM=`ls postgresql-*.$EXT | sed s/.tar.gz//` fi #Der uut gebopt door Ronnie :-) #SLEXT=-i386-"$VERSIE"DatuX.tgz export MAKEFLAGS="-j5" if [ -d $ROOT/pkgtmp ] ; then rm -rf "$ROOT/pkgtmp" fi mkdir $ROOT/pkgtmp cd $ROOT/pkgtmp PKGROOT=`pwd`; cd $ROOT if [ -d $PGM ] ; then rm -rf $PGM fi echo $SLEXT # user adden useradd -u 100 postgresql $TARCMD $PGM.$EXT ||exit 1 if [ $? == 1 ] ; then echo "#" echo "######################### Untarring file failed #################################" echo "#" exit 1 fi mkdir -p $PKGROOT/etc/rc.d $PKGROOT/install $PKGROOT/var/run/postgresql $PKGROOT/usr/doc/$PGM $PKGROOT/etc/postinst.d ########################################## maken van de install scripts ####################################### cat << EOF >$PKGROOT/install/slack-desc # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. |-----handy-ruler------------------------------------------------------| postgresql: PostgreSQL is an advanced object-relational database postgresql: management system that supports an extended subset of postgresql: the SQL standard, including transactions, foreign keys, postgresql: subqueries, triggers, user-defined types and functions. postgresql: This distribution also contains several language bindings, postgresql: including C, Perl, Python, and Tcl, as well as a JDBC driver. postgresql: postgresql: postgresql: postgresql: postgresql: Package Created By: (c) 2006 DatuX EOF mkdir -p $PKGROOT/service/postgresql/log/main chown postgresql $PKGROOT/service/postgresql/log/main cat <$PKGROOT/service/postgresql/run #!/bin/bash rm /home/system/postgresql/data/postmaster.pid exec 2>&1 exec pgrphack setuidgid postgresql /usr/bin/postmaster -i -D /home/system/postgresql/data -h 127.0.0.1 EOF cat <$PKGROOT/service/postgresql/log/run #!/bin/bash exec setuidgid postgresql multilog t ./main EOF chmod +x $PKGROOT/service/postgresql/run chmod +x $PKGROOT/service/postgresql/log/run cp $CWD/{start,stop} $PKGROOT/service/postgresql chmod +x $PKGROOT/service/postgresql/{start,stop} || exit 1 cat <$PKGROOT/install/doinst.sh ( sbin/postinst.sh ) EOF chmod +x $PKGROOT/etc/postinst.d/post.postgresql cd $ROOT/$PGM && if [ $? == 1 ] ; then echo "#" echo "######################### Changing to source directory $PGM failed #################################" echo "#" exit 1 fi export PATH=/usr/lib/ant/bin/:${PATH} ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib --with-java || exit 1 if [ $? == 1 ] ; then echo "#" echo "######################### ./configure failed please try it manualy #################################" echo "#" exit 1 fi make make install DESTDIR=$PKGROOT/ if [ $? == 1 ] ; then echo "#" echo "######################### Installing to temporary directory failed #################################" echo "#" exit 1 fi cd contrib make || exit 1 make install DESTDIR=$PKGROOT/ || exit 1 cd .. cd $PKGROOT && cp $ROOT/post.postgresql $PKGROOT/etc/postinst.d/ cd $PKGROOT #makepkg -l n -c n "postgresql-7.4.6-i386-1DatuX.tgz" makepkg -l y -c n $CWD/$NAME.pkg > /dev/null && echo $VERSION > $CWD/$NAME.version && arch > $CWD/$NAME.arch || exit 1 #libpq ook appart voor kleine installs cd $CWD mv $PKGROOT $PKGROOT.old mkdir -p $PKGROOT/usr/lib cp -a $PKGROOT.old/usr/lib/libpq* $PKGROOT/usr/lib/ || exit 1 cd $PKGROOT makepkg -l y -c n $CWD/$NAMELIB.pkg > /dev/null && echo $VERSION > $CWD/$NAMELIB.version && arch > $CWD/$NAMELIB.arch || exit 1 if [ $? == 1 ] ; then echo "#" echo "######################### creation of slackware package failed try it manualy #################################" echo "#" exit 1 fi cd $ROOT #mv $PKGROOT/postgresql-7.4.6-i386-1DatuX.tgz $ROOT/ #rm -r "$ROOT/pkgtmp" #rm -r "$ROOT/$PACKAGE-$VERSION" ###########################################################################################################