summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkinori Hattori <hattya@gentoo.org>2018-07-04 22:19:12 +0900
committerAkinori Hattori <hattya@gentoo.org>2018-07-04 22:23:47 +0900
commitd789b6541c11824fe6c54368c7dd14416d463bed (patch)
tree18be1281b23990fc5daa414dfeb6c82551f21cdd /www-servers
parentwww-servers/h2o: specify ruby version (diff)
downloadgentoo-d789b6541c11824fe6c54368c7dd14416d463bed.tar.gz
gentoo-d789b6541c11824fe6c54368c7dd14416d463bed.tar.bz2
gentoo-d789b6541c11824fe6c54368c7dd14416d463bed.zip
www-servers/h2o: update init script
Closes: https://bugs.gentoo.org/655468 Package-Manager: Portage-2.3.40, Repoman-2.3.9
Diffstat (limited to 'www-servers')
-rw-r--r--www-servers/h2o/files/h2o.initd54
1 files changed, 20 insertions, 34 deletions
diff --git a/www-servers/h2o/files/h2o.initd b/www-servers/h2o/files/h2o.initd
index ad598a5f6199..b100434bd20e 100644
--- a/www-servers/h2o/files/h2o.initd
+++ b/www-servers/h2o/files/h2o.initd
@@ -1,51 +1,37 @@
#!/sbin/openrc-run
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-extra_commands="configtest"
+extra_commands="checkconfig"
extra_started_commands="reload"
-description="An optimized HTTP/1.x, HTTP/2 server"
-description_configtest="Run H2O' internal config check"
-description_reload="Reload the H2O configuration or upgrade the binary without losing connections"
-: ${config:="/etc/h2o/h2o.conf"}
-pidfile=$(grep pid-file "${config}" | cut -d' ' -f2)
+description_checkconfig="Check the configuration file"
+description_reload="Reload the configuration file"
+: ${h2o_config:="/etc/${RC_SVCNAME}/${RC_SVCNAME}.conf"}
+
+start_stop_daemon_args="--group ${RC_SVCNAME}"
+command="/usr/bin/${RC_SVCNAME}"
+command_args="-m daemon -c \"${h2o_config}\""
+pidfile="$(grep pid-file "${h2o_config}" | cut -d' ' -f2-)"
name="H2O"
-command="/usr/bin/h2o"
-command_args="-m daemon -c ${config}"
-required_files="$config"
depend() {
- use net
- after logger
+ need net
+ use dns
}
-start_pre() {
- if [ "${RC_CMD}" != "restart" ]; then
- configtest || return 1
- fi
+checkconfig() {
+ "${command}" -m test -c "${h2o_config}" || return 1
}
-stop_pre() {
- if [ "${RC_CMD}" = "restart" ]; then
- configtest || return 1
- fi
+start_pre() {
+ checkconfig || return 1
}
reload() {
- configtest || return 1
- ebegin "Refreshing ${name} configuration"
- kill -HUP $(cat ${pidfile}) &>/dev/null
- eend $? "Failed to reload ${name}"
-}
-
-configtest() {
- ebegin "Checking ${name} configuration"
-
- if ! ${command} -c ${config} -t &>/dev/null; then
- ${command} -c ${config} -t
- fi
-
- eend $? "Failed, please correct the errors above"
+ checkconfig || return 1
+ ebegin "Reloading ${name:-${RC_SVCNAME}}"
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend ${?}
}