Browse Source

postgresql: update source to 9.4.4 and refresh scripts

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Daniel Golle 9 years ago
parent
commit
714a408a6e
2 changed files with 61 additions and 102 deletions
  1. 9
    30
      libs/postgresql/Makefile
  2. 52
    72
      libs/postgresql/files/postgresql.init

+ 9
- 30
libs/postgresql/Makefile View File

@@ -8,7 +8,7 @@
8 8
 include $(TOPDIR)/rules.mk
9 9
 
10 10
 PKG_NAME:=postgresql
11
-PKG_VERSION:=9.4.1
11
+PKG_VERSION:=9.4.4
12 12
 PKG_RELEASE:=1
13 13
 PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
14 14
 PKG_LICENSE:=PostgreSQL
@@ -18,7 +18,7 @@ PKG_SOURCE_URL:=\
18 18
 	http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v$(PKG_VERSION) \
19 19
 	http://ftp.be.postgresql.org/postgresql/source/v$(PKG_VERSION) \
20 20
 	ftp://ftp-archives.postgresql.org/pub/source/v$(PKG_VERSION)
21
-PKG_MD5SUM:=2cf30f50099ff1109d0aa517408f8eff
21
+PKG_MD5SUM:=1fe952c44ed26d7e6a335cf991a9c1c6
22 22
 PKG_BUILD_PARALLEL:=1
23 23
 PKG_USE_MIPS16:=0
24 24
 PKG_FIXUP:=autoreconf
@@ -59,6 +59,7 @@ define Package/pgsql-server
59 59
   TITLE:=PostgreSQL databases Server
60 60
   URL:=http://www.postgresql.org/
61 61
   SUBMENU:=database
62
+  USERID:=postgres=5432:postgres=5432
62 63
 endef
63 64
 
64 65
 define Package/pgsql-server/description
@@ -86,7 +87,9 @@ define Build/Configure
86 87
 			--enable-static \
87 88
 			--disable-integer-datetimes \
88 89
 			--disable-rpath \
89
-			--without-krb5 \
90
+			--without-bonjour \
91
+			--without-gssapi \
92
+			--without-ldap \
90 93
 			--without-openssl \
91 94
 			--without-pam \
92 95
 			--without-perl \
@@ -138,7 +141,9 @@ define Build/Configure
138 141
 			--enable-static \
139 142
 			--disable-integer-datetimes \
140 143
 			--disable-rpath \
141
-			--without-krb5 \
144
+			--without-bonjour \
145
+			--without-gssapi \
146
+			--without-ldap \
142 147
 			--without-openssl \
143 148
 			--without-pam \
144 149
 			--without-perl \
@@ -200,32 +205,6 @@ define Package/pgsql-server/conffiles
200 205
 /etc/config/postgresql
201 206
 endef
202 207
 
203
-define Package/pgsql-server/postinst
204
-#!/bin/sh
205
-grep -q '^postgres:' /etc/passwd && exit 0
206
-group=$$(grep '^postgres:' /etc/group | cut -f3 -d:)
207
-if [ -z "$${group}" ] ; then
208
-	group=1000
209
-	tst=$$(cat /etc/group | grep ":$${group}:")
210
-	while [ -n "$${tst}" ] ; do
211
-		group=$$(($${group}+1))
212
-		tst=$$(cat /etc/group | grep ":$${group}:")
213
-	done
214
-	echo "postgres:x:$${group}:" >>/etc/group
215
-fi
216
-
217
-user=$$(cat /etc/passwd | grep "^postgres:")
218
-if [ -z "$${user}" ] ; then
219
-	num="$${group}"
220
-	tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
221
-	while [ -n "$${tst}" ] ; do
222
-		num=$$(($${num}+1))
223
-		tst=$$(cat /etc/passwd | grep ":.*:$${num}:")
224
-	done
225
-	echo "postgres:*:$${num}:$${group}:PostgreSQL administrator:/tmp:/bin/ash" >>/etc/passwd
226
-fi
227
-endef
228
-
229 208
 define Build/InstallDev
230 209
 	$(INSTALL_DIR) $(1)/usr/bin
231 210
 	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/bin/pg_config/pg_config.host $(1)/usr/bin/pg_config

+ 52
- 72
libs/postgresql/files/postgresql.init View File

@@ -1,93 +1,73 @@
1 1
 #!/bin/sh /etc/rc.common
2
-# Copyright (C) 2006 OpenWrt.org
2
+# Copyright (C) 2006-2015 OpenWrt.org
3 3
 START=50
4 4
 
5
-EXTRA_COMMANDS="status reload"
5
+PROG=/usr/bin/postmaster
6 6
 
7
-config_load "postgresql"
8
-config_get pgdata config PGDATA
9
-config_get pguser config PGUSER
10
-config_get pgctl config PG_CTL
11
-config_get pglog config PGLOG
7
+USE_PROCD=1
12 8
 
13
-start() {
14
-    if [ ! -e /usr/bin/su ]; then
15
-        echo "The su command is requred to run postgres"
16
-        exit 1
17
-    fi
9
+EXTRA_COMMANDS="status"
10
+EXTRA_HELP="        status  Show current status of the PostgreSQL server"
18 11
 
19
-    if [ ! -d ${pgdata} ]; then
20
-        echo "Create the data directory (${pgdata}) and try again"
21
-        exit 1
22
-    fi
12
+fix_hosts() {
13
+	# make sure localhost (without a dot) is in /etc/hosts
14
+	grep -q 'localhost$' /etc/hosts || echo '127.0.0.1 localhost' >> /etc/hosts
15
+}
23 16
 
24
-    echo "starting postgres..."
25
-    # make sure localhost (without a dot) is in /etc/hosts
26
-    grep -q 'localhost$' /etc/hosts || echo '127.0.0.1 localhost' >> /etc/hosts
17
+fix_perms() {
18
+	# for whatever reason, /dev/null gets wrong perms
19
+	chmod a+w /dev/null
20
+}
27 21
 
28
-    # for whatever reason, /dev/null gets wrong perms
29
-    chmod a+w /dev/null
22
+cleanup() {
23
+	if [ -f "$1/postmaster.pid" ]; then
24
+		rm "$1/postmaster.pid"
25
+	fi
26
+}
30 27
 
31
-    if [ -f ${pgdata}/postmaster.pid ]; then
32
-        rm ${pgdata}/postmaster.pid
33
-    fi
28
+start_service() {
29
+	config_load "postgresql"
30
+	config_get pgdata config PGDATA
31
+	config_get pguser config PGUSER
32
+	config_get pgctl config PG_CTL
33
+	config_get pgopts config PGOPTS
34 34
 
35
-    config_get pgopts config PGOPTS
36
-    if [ -n "${pgopts}" ]; then
37
-        pgopts="-o ${pgopts}"
38
-    fi
39
-    /usr/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1
35
+	user_exists postgres 5432 || user_add postgres 5432
36
+	group_exists postgres 5432 || group_add postgres 5432
40 37
 
41
-    while :
42
-    do
43
-        cnt=$((${cnt} + 1))
44
-        if [ -f "${pgdata}/postmaster.pid" ]; then
45
-            ret=0
46
-            break
47
-        fi
38
+	if [ ! -d "${pgdata}" ]; then
39
+		echo "Create the data directory (${pgdata}) and try again"
40
+		return 1
41
+	fi
48 42
 
49
-        if [ ${cnt} -eq 30 ]; then
50
-            echo "Postgres failed to start.  See ${pglog} for details"
51
-            ret=1
52
-            break
53
-        fi
54
-        sleep 1
55
-    done
43
+	fix_perms
44
+	fix_hosts
56 45
 
57
-    echo "ok"
58
-    return ${ret}
59
-}
46
+	procd_open_instance
60 47
 
61
-stop() {
62
-    echo "stopping postgres..."
63
-    /usr/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast"
64
-    ret=$?
65
-    if [ -f ${pgdata}/postmaster.pid ]; then
66
-        rm ${pgdata}/postmaster.pid
67
-    fi
68
-    echo "ok"
69
-    return ${ret}
70
-}
48
+	procd_set_param user ${pguser}
49
+	procd_set_param command $PROG
50
+	procd_append_param command -D "${pgdata}"
51
+	[ -n "${pgopts}" ] && procd_append_param command -o "${pgopts}"
71 52
 
72
-restart() {
73
-    echo "restarting postgres..."
74
-    /usr/bin/su ${pguser} -c "${pgctl} stop -D '${pgdata}' -s -m fast -w"
75
-    if [ -f ${pgdata}/postmaster.pid ]; then
76
-        rm ${pgdata}/postmaster.pid
77
-    fi
78
-    /usr/bin/su ${pguser} -c "/usr/bin/postmaster -D '${pgdata}' &" >> ${pglog} 2>&1
79
-    echo "ok"
80
-    return $?
53
+	procd_set_param respawn retry=60
54
+	procd_close_instance
81 55
 }
82 56
 
83
-reload() {
84
-    echo "reloading postgres..."
85
-    /usr/bin/su ${pguser} -c "${pgctl} reload -D '${pgdata}' -s"
86
-    echo "ok"
57
+reload_service() {
58
+	config_load "postgresql"
59
+	config_get pgdata config PGDATA
60
+	config_get pguser config PGUSER
61
+	config_get pgctl config PG_CTL
62
+	${pgctl} reload -U ${pguser} -D '${pgdata}' -s
87 63
 }
88 64
 
89 65
 status() {
90
-    echo "status postgres..."
91
-    /usr/bin/su ${pguser} -c "${pgctl} status -D '${pgdata}'"
92
-    echo "ok"
66
+	config_load "postgresql"
67
+	config_get pgdata config PGDATA
68
+	config_get pguser config PGUSER
69
+	config_get pgctl config PG_CTL
70
+	echo "status postgres..."
71
+	${pgctl} status -U ${pguser} -D '${pgdata}'
72
+	echo "ok"
93 73
 }