-define Build/InstallDev
- mkdir -p $(STAGING_DIR)/usr/bin
- $(CP) $(PKG_INSTALL_DIR)/usr/bin/pg_config $(STAGING_DIR)/usr/bin/
- mkdir -p $(STAGING_DIR)/usr/include
- $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(STAGING_DIR)/usr/include/
- $(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(STAGING_DIR)/usr/include/
- $(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(STAGING_DIR)/usr/include/
- $(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(STAGING_DIR)/usr/include/
- $(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(STAGING_DIR)/usr/include/
- mkdir -p $(STAGING_DIR)/usr/lib
- $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(STAGING_DIR)/usr/lib/
+define Package/pgsql-server/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_DIR) $(1)/usr/share/postgresql
+ $(INSTALL_DIR) $(1)/usr/lib
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_DIR) $(1)/etc/config
+ $(INSTALL_BIN) \
+ $(PKG_INSTALL_DIR)/usr/bin/postgres \
+ $(PKG_INSTALL_DIR)/usr/bin/dropdb \
+ $(PKG_INSTALL_DIR)/usr/bin/clusterdb \
+ $(PKG_INSTALL_DIR)/usr/bin/createdb \
+ $(PKG_INSTALL_DIR)/usr/bin/createlang \
+ $(PKG_INSTALL_DIR)/usr/bin/createuser \
+ $(PKG_INSTALL_DIR)/usr/bin/droplang \
+ $(PKG_INSTALL_DIR)/usr/bin/dropuser \
+ $(PKG_INSTALL_DIR)/usr/bin/initdb \
+ $(PKG_INSTALL_DIR)/usr/bin/ipcclean \
+ $(PKG_INSTALL_DIR)/usr/bin/pg_config \
+ $(PKG_INSTALL_DIR)/usr/bin/pg_controldata \
+ $(PKG_INSTALL_DIR)/usr/bin/pg_ctl \
+ $(PKG_INSTALL_DIR)/usr/bin/pg_dump \
+ $(PKG_INSTALL_DIR)/usr/bin/pg_dumpall \
+ $(PKG_INSTALL_DIR)/usr/bin/pg_restore \
+ $(PKG_INSTALL_DIR)/usr/bin/pg_resetxlog \
+ $(PKG_INSTALL_DIR)/usr/bin/reindexdb \
+ $(PKG_INSTALL_DIR)/usr/bin/vacuumdb \
+ $(1)/usr/bin
+ ln -sf postgres $(1)/usr/bin/postmaster
+
+ $(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
+
+ $(INSTALL_DATA) \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.bki \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.description \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/conversion_create.sql \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/information_schema.sql \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/pg_hba.conf.sample \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/pg_ident.conf.sample \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/pg_service.conf.sample \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/postgresql.conf.sample \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/sql_features.txt \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/postgres.shdescription \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/psqlrc.sample \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/recovery.conf.sample \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/system_views.sql \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/snowball_create.sql \
+ $(1)/usr/share/postgresql
+
+ $(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
+
+ $(CP) -r \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/timezone \
+ $(PKG_INSTALL_DIR)/usr/share/postgresql/timezonesets \
+ $(1)/usr/share/postgresql
+
+ $(CP) -r \
+ $(PKG_INSTALL_DIR)/usr/lib/postgresql \
+ $(1)/usr/lib
+endef
+
+define Package/pgsql-server/postinst
+#!/bin/sh
+grep -q '^postgres:' /etc/passwd && exit 0
+
+if [ -e /bin/addgroup ]; then
+ /bin/addgroup postgres
+ RG=$$?
+
+ if [ -e /bin/adduser ]; then
+ /bin/adduser -h /tmp -H -g 'PostgreSQL administrator' -s /bin/ash -D -H -G postgres postgres
+ RU=$$?
+ fi
+fi
+
+if [ -z "$${RG}" -o -z "$${RU}" ]; then
+ echo "Could not find user utils, you will need to create the postgres user by hand"
+ exit
+fi
+
+if [ "$${RG}" != "0" -o "$${RU}" != "0" ]; then
+ echo "Failed to created postgres user"
+ exit 1
+fi