postgresql: update source to 9.4.4 and refresh scripts
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
6ae54e4075
commit
714a408a6e
2 changed files with 66 additions and 107 deletions
|
@ -8,7 +8,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=postgresql
|
PKG_NAME:=postgresql
|
||||||
PKG_VERSION:=9.4.1
|
PKG_VERSION:=9.4.4
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
|
PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
|
||||||
PKG_LICENSE:=PostgreSQL
|
PKG_LICENSE:=PostgreSQL
|
||||||
|
@ -18,7 +18,7 @@ PKG_SOURCE_URL:=\
|
||||||
http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v$(PKG_VERSION) \
|
http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v$(PKG_VERSION) \
|
||||||
http://ftp.be.postgresql.org/postgresql/source/v$(PKG_VERSION) \
|
http://ftp.be.postgresql.org/postgresql/source/v$(PKG_VERSION) \
|
||||||
ftp://ftp-archives.postgresql.org/pub/source/v$(PKG_VERSION)
|
ftp://ftp-archives.postgresql.org/pub/source/v$(PKG_VERSION)
|
||||||
PKG_MD5SUM:=2cf30f50099ff1109d0aa517408f8eff
|
PKG_MD5SUM:=1fe952c44ed26d7e6a335cf991a9c1c6
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
PKG_USE_MIPS16:=0
|
PKG_USE_MIPS16:=0
|
||||||
PKG_FIXUP:=autoreconf
|
PKG_FIXUP:=autoreconf
|
||||||
|
@ -59,6 +59,7 @@ define Package/pgsql-server
|
||||||
TITLE:=PostgreSQL databases Server
|
TITLE:=PostgreSQL databases Server
|
||||||
URL:=http://www.postgresql.org/
|
URL:=http://www.postgresql.org/
|
||||||
SUBMENU:=database
|
SUBMENU:=database
|
||||||
|
USERID:=postgres=5432:postgres=5432
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/pgsql-server/description
|
define Package/pgsql-server/description
|
||||||
|
@ -86,7 +87,9 @@ define Build/Configure
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-integer-datetimes \
|
--disable-integer-datetimes \
|
||||||
--disable-rpath \
|
--disable-rpath \
|
||||||
--without-krb5 \
|
--without-bonjour \
|
||||||
|
--without-gssapi \
|
||||||
|
--without-ldap \
|
||||||
--without-openssl \
|
--without-openssl \
|
||||||
--without-pam \
|
--without-pam \
|
||||||
--without-perl \
|
--without-perl \
|
||||||
|
@ -138,7 +141,9 @@ define Build/Configure
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-integer-datetimes \
|
--disable-integer-datetimes \
|
||||||
--disable-rpath \
|
--disable-rpath \
|
||||||
--without-krb5 \
|
--without-bonjour \
|
||||||
|
--without-gssapi \
|
||||||
|
--without-ldap \
|
||||||
--without-openssl \
|
--without-openssl \
|
||||||
--without-pam \
|
--without-pam \
|
||||||
--without-perl \
|
--without-perl \
|
||||||
|
@ -200,32 +205,6 @@ define Package/pgsql-server/conffiles
|
||||||
/etc/config/postgresql
|
/etc/config/postgresql
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/pgsql-server/postinst
|
|
||||||
#!/bin/sh
|
|
||||||
grep -q '^postgres:' /etc/passwd && exit 0
|
|
||||||
group=$$(grep '^postgres:' /etc/group | cut -f3 -d:)
|
|
||||||
if [ -z "$${group}" ] ; then
|
|
||||||
group=1000
|
|
||||||
tst=$$(cat /etc/group | grep ":$${group}:")
|
|
||||||
while [ -n "$${tst}" ] ; do
|
|
||||||
group=$$(($${group}+1))
|
|
||||||
tst=$$(cat /etc/group | grep ":$${group}:")
|
|
||||||
done
|
|
||||||
echo "postgres:x:$${group}:" >>/etc/group
|
|
||||||
fi
|
|
||||||
|
|
||||||
user=$$(cat /etc/passwd | grep "^postgres:")
|
|
||||||
if [ -z "$${user}" ] ; then
|
|
||||||
num="$${group}"
|
|
||||||
tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
|
|
||||||
while [ -n "$${tst}" ] ; do
|
|
||||||
num=$$(($${num}+1))
|
|
||||||
tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
|
|
||||||
done
|
|
||||||
echo "postgres:*:$${num}:$${group}:PostgreSQL administrator:/tmp:/bin/ash" >>/etc/passwd
|
|
||||||
fi
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Build/InstallDev
|
define Build/InstallDev
|
||||||
$(INSTALL_DIR) $(1)/usr/bin
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config
|
||||||
|
|
|
@ -1,93 +1,73 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2006 OpenWrt.org
|
# Copyright (C) 2006-2015 OpenWrt.org
|
||||||
START=50
|
START=50
|
||||||
|
|
||||||
EXTRA_COMMANDS="status reload"
|
PROG=/usr/bin/postmaster
|
||||||
|
|
||||||
config_load "postgresql"
|
USE_PROCD=1
|
||||||
config_get pgdata config PGDATA
|
|
||||||
config_get pguser config PGUSER
|
|
||||||
config_get pgctl config PG_CTL
|
|
||||||
config_get pglog config PGLOG
|
|
||||||
|
|
||||||
start() {
|
EXTRA_COMMANDS="status"
|
||||||
if [ ! -e /usr/bin/su ]; then
|
EXTRA_HELP=" status Show current status of the PostgreSQL server"
|
||||||
echo "The su command is requred to run postgres"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d ${pgdata} ]; then
|
fix_hosts() {
|
||||||
echo "Create the data directory (${pgdata}) and try again"
|
# make sure localhost (without a dot) is in /etc/hosts
|
||||||
exit 1
|
grep -q 'localhost$' /etc/hosts || echo '127.0.0.1 localhost' >> /etc/hosts
|
||||||
fi
|
|
||||||
|
|
||||||
echo "starting postgres..."
|
|
||||||
# make sure localhost (without a dot) is in /etc/hosts
|
|
||||||
grep -q 'localhost$' /etc/hosts || echo '127.0.0.1 localhost' >> /etc/hosts
|
|
||||||
|
|
||||||
# for whatever reason, /dev/null gets wrong perms
|
|
||||||
chmod a+w /dev/null
|
|
||||||
|
|
||||||
if [ -f ${pgdata}/postmaster.pid ]; then
|
|
||||||
rm ${pgdata}/postmaster.pid
|
|
||||||
fi
|
|
||||||
|
|
||||||
config_get pgopts config PGOPTS
|
|
||||||
if [ -n "${pgopts}" ]; then
|
|
||||||
pgopts="-o ${pgopts}"
|
|
||||||
fi
|
|
||||||
/usr/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1
|
|
||||||
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
cnt=$((${cnt} + 1))
|
|
||||||
if [ -f "${pgdata}/postmaster.pid" ]; then
|
|
||||||
ret=0
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${cnt} -eq 30 ]; then
|
|
||||||
echo "Postgres failed to start. See ${pglog} for details"
|
|
||||||
ret=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "ok"
|
|
||||||
return ${ret}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
fix_perms() {
|
||||||
echo "stopping postgres..."
|
# for whatever reason, /dev/null gets wrong perms
|
||||||
/usr/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast"
|
chmod a+w /dev/null
|
||||||
ret=$?
|
|
||||||
if [ -f ${pgdata}/postmaster.pid ]; then
|
|
||||||
rm ${pgdata}/postmaster.pid
|
|
||||||
fi
|
|
||||||
echo "ok"
|
|
||||||
return ${ret}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
cleanup() {
|
||||||
echo "restarting postgres..."
|
if [ -f "$1/postmaster.pid" ]; then
|
||||||
/usr/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast -w"
|
rm "$1/postmaster.pid"
|
||||||
if [ -f ${pgdata}/postmaster.pid ]; then
|
fi
|
||||||
rm ${pgdata}/postmaster.pid
|
|
||||||
fi
|
|
||||||
/usr/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1
|
|
||||||
echo "ok"
|
|
||||||
return $?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
start_service() {
|
||||||
echo "reloading postgres..."
|
config_load "postgresql"
|
||||||
/usr/bin/su ${pguser} -c "${pgctl} reload -D '${pgdata}' -s"
|
config_get pgdata config PGDATA
|
||||||
echo "ok"
|
config_get pguser config PGUSER
|
||||||
|
config_get pgctl config PG_CTL
|
||||||
|
config_get pgopts config PGOPTS
|
||||||
|
|
||||||
|
user_exists postgres 5432 || user_add postgres 5432
|
||||||
|
group_exists postgres 5432 || group_add postgres 5432
|
||||||
|
|
||||||
|
if [ ! -d "${pgdata}" ]; then
|
||||||
|
echo "Create the data directory (${pgdata}) and try again"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fix_perms
|
||||||
|
fix_hosts
|
||||||
|
|
||||||
|
procd_open_instance
|
||||||
|
|
||||||
|
procd_set_param user ${pguser}
|
||||||
|
procd_set_param command $PROG
|
||||||
|
procd_append_param command -D "${pgdata}"
|
||||||
|
[ -n "${pgopts}" ] && procd_append_param command -o "${pgopts}"
|
||||||
|
|
||||||
|
procd_set_param respawn retry=60
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
config_load "postgresql"
|
||||||
|
config_get pgdata config PGDATA
|
||||||
|
config_get pguser config PGUSER
|
||||||
|
config_get pgctl config PG_CTL
|
||||||
|
${pgctl} reload -U ${pguser} -D '${pgdata}' -s
|
||||||
}
|
}
|
||||||
|
|
||||||
status() {
|
status() {
|
||||||
echo "status postgres..."
|
config_load "postgresql"
|
||||||
/usr/bin/su ${pguser} -c "${pgctl} status -D '${pgdata}'"
|
config_get pgdata config PGDATA
|
||||||
echo "ok"
|
config_get pguser config PGUSER
|
||||||
|
config_get pgctl config PG_CTL
|
||||||
|
echo "status postgres..."
|
||||||
|
${pgctl} status -U ${pguser} -D '${pgdata}'
|
||||||
|
echo "ok"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue