1 |
commit: d789b6541c11824fe6c54368c7dd14416d463bed |
2 |
Author: Akinori Hattori <hattya <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jul 4 13:19:12 2018 +0000 |
4 |
Commit: Akinori Hattori <hattya <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jul 4 13:23:47 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d789b654 |
7 |
|
8 |
www-servers/h2o: update init script |
9 |
|
10 |
Closes: https://bugs.gentoo.org/655468 |
11 |
Package-Manager: Portage-2.3.40, Repoman-2.3.9 |
12 |
|
13 |
www-servers/h2o/files/h2o.initd | 54 +++++++++++++++-------------------------- |
14 |
1 file changed, 20 insertions(+), 34 deletions(-) |
15 |
|
16 |
diff --git a/www-servers/h2o/files/h2o.initd b/www-servers/h2o/files/h2o.initd |
17 |
index ad598a5f619..b100434bd20 100644 |
18 |
--- a/www-servers/h2o/files/h2o.initd |
19 |
+++ b/www-servers/h2o/files/h2o.initd |
20 |
@@ -1,51 +1,37 @@ |
21 |
#!/sbin/openrc-run |
22 |
-# Copyright 1999-2017 Gentoo Foundation |
23 |
+# Copyright 1999-2018 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
|
26 |
-extra_commands="configtest" |
27 |
+extra_commands="checkconfig" |
28 |
extra_started_commands="reload" |
29 |
-description="An optimized HTTP/1.x, HTTP/2 server" |
30 |
-description_configtest="Run H2O' internal config check" |
31 |
-description_reload="Reload the H2O configuration or upgrade the binary without losing connections" |
32 |
|
33 |
-: ${config:="/etc/h2o/h2o.conf"} |
34 |
-pidfile=$(grep pid-file "${config}" | cut -d' ' -f2) |
35 |
+description_checkconfig="Check the configuration file" |
36 |
+description_reload="Reload the configuration file" |
37 |
|
38 |
+: ${h2o_config:="/etc/${RC_SVCNAME}/${RC_SVCNAME}.conf"} |
39 |
+ |
40 |
+start_stop_daemon_args="--group ${RC_SVCNAME}" |
41 |
+command="/usr/bin/${RC_SVCNAME}" |
42 |
+command_args="-m daemon -c \"${h2o_config}\"" |
43 |
+pidfile="$(grep pid-file "${h2o_config}" | cut -d' ' -f2-)" |
44 |
name="H2O" |
45 |
-command="/usr/bin/h2o" |
46 |
-command_args="-m daemon -c ${config}" |
47 |
-required_files="$config" |
48 |
|
49 |
depend() { |
50 |
- use net |
51 |
- after logger |
52 |
+ need net |
53 |
+ use dns |
54 |
} |
55 |
|
56 |
-start_pre() { |
57 |
- if [ "${RC_CMD}" != "restart" ]; then |
58 |
- configtest || return 1 |
59 |
- fi |
60 |
+checkconfig() { |
61 |
+ "${command}" -m test -c "${h2o_config}" || return 1 |
62 |
} |
63 |
|
64 |
-stop_pre() { |
65 |
- if [ "${RC_CMD}" = "restart" ]; then |
66 |
- configtest || return 1 |
67 |
- fi |
68 |
+start_pre() { |
69 |
+ checkconfig || return 1 |
70 |
} |
71 |
|
72 |
reload() { |
73 |
- configtest || return 1 |
74 |
- ebegin "Refreshing ${name} configuration" |
75 |
- kill -HUP $(cat ${pidfile}) &>/dev/null |
76 |
- eend $? "Failed to reload ${name}" |
77 |
-} |
78 |
- |
79 |
-configtest() { |
80 |
- ebegin "Checking ${name} configuration" |
81 |
- |
82 |
- if ! ${command} -c ${config} -t &>/dev/null; then |
83 |
- ${command} -c ${config} -t |
84 |
- fi |
85 |
- |
86 |
- eend $? "Failed, please correct the errors above" |
87 |
+ checkconfig || return 1 |
88 |
+ ebegin "Reloading ${name:-${RC_SVCNAME}}" |
89 |
+ start-stop-daemon --signal HUP --pidfile "${pidfile}" |
90 |
+ eend ${?} |
91 |
} |