<?xml version="1.0"?>
<package name="postgresql">
	<description>PostgreSQL database server</description>
	<releases>
		<release version="17.5" revision="1">
			<deps>
				<dep name="readline"/>
				<dep name="perl"/>
				<dep name="Python"/>
				<dep name="gettext"/>
				<dep name="openssl"/>
				<dep name="Linux-PAM"/>
				<dep name="sudo"/>
			</deps>
			<preinst>
				<cmd>sed -i "/postgres/d" /etc/passwd</cmd>
				<cmd>sed -i "/postgres/d" /etc/group</cmd>
				<cmd check="no">echo "postgres:x:20:20:postgresql::/bin/false" &gt;&gt; /etc/passwd</cmd>
				<cmd check="no">echo "postgres:x:20:" &gt;&gt; /etc/group</cmd>
			</preinst>
			<build>
				<script>
					<archive name="postgresql-$VERSION">
						<cmd>CFLAGS="-g -O2 -std=gnu17" ./configure --with-docdir=/usr/share/doc --enable-thread-safety --with-perl --with-python --with-pam --with-openssl</cmd>
						<cmd>make</cmd>
						<cmd>make install</cmd>
						<install name="postgresql.service-20170810" dest="/lib/systemd/system/postgresql.service"/>
					</archive>
				</script>
				<ignore>
					<file>/var/lib/postgres/*</file>
				</ignore>
			</build>
			<postinst>
				<cmd>install -d -o postgres -g postgres /var/lib/postgres/</cmd>
				<cmd>install -d -o postgres -g postgres -m 0700 /var/lib/postgres/data</cmd>
				<cmd>install -d -o postgres -g postgres /var/log/postgres/</cmd>
				<!-- postgresql 8.1.1 caused semaphore creation error on buildd2. check whether this happens on normal installations, too -->
				<cmd check="no">[ -e /var/lib/postgres/data/postgresql.conf ] || sudo -u postgres /usr/bin/initdb -D /var/lib/postgres/data</cmd>
			</postinst>
			<prerm>
				<cmd>sed -i "/postgres/d" /etc/passwd</cmd>
				<cmd>sed -i "/postgres/d" /etc/group</cmd>
			</prerm>
			<config>
				<configfile name="psqlrc-20050208" default="$DOCDIR/psqlrc.paldo" dest="/etc/psqlrc"/>
			</config>
		</release>
	</releases>
</package>
