aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2022-06-03 20:05:51 +0200
committerJakub Jirutka <jakub@jirutka.cz>2022-06-03 20:11:33 +0200
commit8a35928f3f2bee6751a25cb07de39596dc470053 (patch)
treeea8084f666cfd0b9f2f1f344c9adbedcf86f82a9
parent4bcc007614992c3bd2dc7e02b5ccbb9d8e98759e (diff)
downloadaports-8a35928f3f2bee6751a25cb07de39596dc470053.tar.gz
aports-8a35928f3f2bee6751a25cb07de39596dc470053.tar.bz2
aports-8a35928f3f2bee6751a25cb07de39596dc470053.tar.xz
main/postgresql-common: use service_set_value and service_get_value
...for pidfile and command. They are set when using the default start function and restored in the default stop function (https://github.com/OpenRC/openrc/blob/master/sh/start-stop-daemon.sh). Since we redefine start/stop functions, we should set/get them manually. The primary motivation for this change was this: https://github.com/jirutka/collectd-openrc/blob/d2e1beaa7325503e52d49aa9c70e27c531cd4b2b/openrc.c#L107-L113
-rw-r--r--main/postgresql-common/APKBUILD6
-rw-r--r--main/postgresql-common/postgresql.initd19
2 files changed, 15 insertions, 10 deletions
diff --git a/main/postgresql-common/APKBUILD b/main/postgresql-common/APKBUILD
index 2e9ca20f6f..213e009274 100644
--- a/main/postgresql-common/APKBUILD
+++ b/main/postgresql-common/APKBUILD
@@ -1,8 +1,8 @@
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-common
-pkgver=1.0
-pkgrel=1
+pkgver=1.1
+pkgrel=0
pkgdesc="Common files for PostgreSQL"
url="https://www.postgresql.org/"
arch="noarch"
@@ -33,6 +33,6 @@ openrc() {
sha512sums="
f9887e260bbcccb1a96030d3065459f1c0b4b8c50e62008ab1e0964e5b281de330e3d25b311eb88a729c23342193bedb3549913b24facd4f39c1398f819c0d8c pg_versions
-be0e1afaaf1d376f1d57d300d4bb314113b18bde4cd565a0532556c6ec753576eb9cbc08bdf7b18e3f1f63054cf8c96656c5216918642c54689c06a9a5e79992 postgresql.initd
+41590b3009c2d6e3b215bd8f1fa7f06a15c382a7609b60b171dae67dd7b5f71e651a2d3f6a8af0e9376ca94200ded745ae864f0b34565c6ccd7857389574e9e5 postgresql.initd
611cca04bdf97284bca2c85688e3512dd5fcce2c1d40dcf2082855008cbe988dccbdc589af5021a120b2de10455b3700712f99d1b60da1e10ee953516f030db5 postgresql.confd
"
diff --git a/main/postgresql-common/postgresql.initd b/main/postgresql-common/postgresql.initd
index 1c1a40d75c..a4ba83c64c 100644
--- a/main/postgresql-common/postgresql.initd
+++ b/main/postgresql-common/postgresql.initd
@@ -107,8 +107,6 @@ start_pre() {
}
start() {
- local retval
-
ebegin "Starting $name"
rm -f "$pidfile"
@@ -121,16 +119,20 @@ start() {
--log="$logfile" \
--pgdata="$conf_dir" \
-o "--data-directory=$data_dir $pg_opts"
- retval=$?
- if [ $retval -ne 0 ]; then
+ if eend $? "Failed to start $name"; then
+ service_set_value "command" "$command"
+ service_set_value "pidfile" "$pidfile"
+ else
eerror "Check the log for a possible explanation of the above error:"
eerror " $logfile"
+ return 1
fi
- eend $retval
}
stop() {
+ local command=$(service_get_value "command" || echo "$command")
+ local pidfile=$(service_get_value "pidfile" || echo "$pidfile")
local retry=''
[ "$stop_smart_timeout" -eq 0 ] \
@@ -151,7 +153,7 @@ stop() {
--retry "$retry" \
--progress \
--pidfile "$pidfile"
- eend $?
+ eend $? "Failed to stop $name"
}
stop_smart() {
@@ -167,6 +169,9 @@ stop_force() {
}
_stop() {
+ local command=$(service_get_value "command" || echo "$command")
+ local pidfile=$(service_get_value "pidfile" || echo "$pidfile")
+
ebegin "Stopping $name ($2)"
start-stop-daemon --stop \
@@ -174,7 +179,7 @@ _stop() {
--signal "$1" \
--pidfile "$pidfile" \
&& mark_service_stopped "$RC_SVCNAME"
- eend $?
+ eend $? "Failed to stop $name"
}
reload() {