PostgreSQL 8.0.0

Pošto nemamo posebnog dijela za Slackware korisnike, prisiljen sam postati ovdje :wink:

Ako se ko želi igrati sa PostgreSQL evo build skripti za slackware paket. Skinite ‘postgresql-8.0.0-tar.bz2’ pokrenite postgresql.SlackBuild i instalirajte kreirani paket.

postgresql.SlackBuild

#!/bin/sh
CWD=`pwd`
TMP=/tmp
PKGNAME=postgresql
PKG=$TMP/package-$PKGNAME
rm -rf $PKG
mkdir -p $PKG/usr

VERSION=8.0.0
ARCH=${ARCH:-i486}
BUILD=2nzx

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

cd $TMP
rm -rf $PKGNAME-$VERSION
tar xjvf $CWD/$PKGNAME-$VERSION.tar.bz2
cd $PKGNAME-$VERSION
chown -R root:root .
find . -perm 664 -exec chmod 644 {} ;

CFLAGS="$SLKCFLAGS" 
./configure --prefix=/usr 
            --sysconfdir=/etc 
			--with-openssl 
			--enable-thread-safety
make
make DESTDIR=$PKG install

strip $PKG/usr/bin/*
chown -R root:bin $PKG/usr/bin

gzip -9 $PKG/usr/man/man?/*

mv $PKG/usr/doc/$PKGNAME $PKG/usr/doc/$PKGNAME-$VERSION

cp -a HISTORY README doc/bug.template doc/FAQ doc/FAQ_DEV doc/TODO 
$PKG/usr/doc/$PKGNAME-$VERSION

mkdir -p $PKG/install
cat $CWD/slack-desc.$PKGNAME > $PKG/install/slack-desc

mkdir -p $PKG/var/log/setup
cat $CWD/setup.$PKGNAME > $PKG/var/log/setup/setup.$PKGNAME

cd $PKG
makepkg -l y -c n ../$PKGNAME-$VERSION-$ARCH-$BUILD.tgz

slack-desc.postgresql

          |-----handy-ruler-------------------------------------------------|
postgresql: PostgreSQL 8.0
postgresql:
postgresql: PostgreSQL is an advanced object-relational database management
postgresql: system (ORDBMS) based on POSTGRES.
postgresql:
postgresql: Homepage: http://www.postgresql.org
postgresql:
postgresql:
postgresql:
postgresql: packaged by ME <me@domain>
postgresql:

setup.postgresql

#!/bin/sh
#BLURB="PostgreSQL"

echo "Adding 'postgres' user and group..."
groupadd postgres
useradd -g postgres -d /var/lib/pgsql -c PostgreSQL postgres
mkdir -p /var/lib/pgsql/data

#tidying up permissions
echo "Setting up permissions..."
chown -R postgres:postgres /var/lib/pgsql
chmod 750 /var/lib/pgsql

#creating database cluster
if [ ! -f /var/lib/pgsql/data/PG_VERSION ]; then
	echo "Creating database cluster..."
	sudo -u postgres initdb -D /var/lib/pgsql/data
else
	echo "*** WARNING ***" >&2
	echo "  There is already database cluster in/var/lib/pgsql/data." >&2
	echo "  If you are upgrading from an older version of PostgreSQL" >&2
	echo "  you will have to 'dump' and 'restore' your database." >&2
	echo "  See postgres manual for details." >&2
fi	

#setting up startup scripts
echo "Setting up startup scripts..."
if [ -f /etc/rc.d/rc.postgres ]; then
	RCFILE=/etc/rc.d/rc.postgres.new
else
	RCFILE=/etc/rc.d/rc.postgres
fi
touch $RCFILE
chmod +x $RCFILE

cat << EOF > $RCFILE
#!/bin/sh

LOGFILE=/var/log/postgresql
DATADIR=/var/lib/pgsql/data
POSTMASTER=/usr/bin/postmaster
if [ ! -f $POSTMASTER ]; then
	echo "Could not find 'postmaster'. Maybe PostgreSQL is not installed properly?"
	return 5
fi

# Return values (according to LSB):
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running

pg_ctl()
{
	CMD="/usr/bin/pg_ctl $@"
	su - postgres -c "$CMD"
}

case "$1" in

start)
	touch $LOGFILE
	chown postgres:postgres $LOGFILE
	chmod 0600 $LOGFILE
	if [ ! -f $DATADIR/PG_VERSION ]; then
	    echo "You should initialize the PostgreSQL database at location ${DATADIR}"
		return 6
	fi
	echo "Starting PostgreSQL"
    
	# remove old socket, if it exists and no daemon is running.
	if [ ! -f /var/lib/pgsql/data/postmaster.pid ]; then
		rm -f /tmp/.s.PGSQL.5432
		pg_ctl start -s -w -p $POSTMASTER -l $LOGFILE -D $DATADIR
	else
		echo "PostgreSQL daemon already running!"
	fi	
    ;;

	stop)
		echo "Shutting down PostgreSQL..."
		pg_ctl stop -s -D $DATADIR -m fast
    ;;

	restart)
		$0 stop
		$0 start
	;;

	reload)
		echo "Reloading configuration for PostgreSQL..."
		kill -SIGHUP $POSTMASTER
	;;

	status)
		# Obviously this is not the righ stuff
		# but some cheating wont kill you
		# 'ps -axu' is your best friend
		if [ -f /var/lib/pgsql/data/postmaster.pid ]; then
			echo "PostgreSQL is running"
		else
			echo "PostgreSQL is stopped"
		fi
    ;;
    

	*)
		echo "Usage: $0 {start|stop|status|restart|reload}"
		return 1
	;;
esac	
EOF
echo "PostgreSQL post installation setup completed"

Aferim,

Podržavam ideju da se otvori novi podforum!
Takođe predlažem da se Opšta diskusija (pod GNU/Linux pomoć) preimenuje u Opšta pomoć, kako se ne bi miješalo sa OFF: Opšta diskusija.

I ja se slazem sa oba prijedloga :slight_smile:
Bilo bi fino imati i Slackware podforum :smiley:

Pozdravi

Pa ja sam mislio da cijelo vrijeme postoji taj podforum. :wink: 8) U svakom slučaju podržavam prijedlog za otvaranje tog podforuma.

Naravno, treba nama (slackerima) podforum…

Hehe

Jah

Prostor obezbjeđen. Sad ga samo trebate popuniti kvalitetnim sadržajem.
+ciao+