Summary: | www-servers/apache: apache2ctl broken on systemd installations | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Manuel Nickschas <sputnick> |
Component: | Current packages | Assignee: | Lars Wendler (Polynomial-C) (RETIRED) <polynomial-c> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jarodiv |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Proposed patch for apache2ctl that supports systemd |
Description
Manuel Nickschas
2018-12-21 14:26:43 UTC
This is mentioned here: https://github.com/certbot/certbot/issues/3411#issuecomment-464845143 Patches are highly welcome especially as I don't use systemd anywhere. If you wanna create a patch against latest apache2ctl, please use the following git repo and attach a git-formatted patch to this bug: https://gitweb.gentoo.org/proj/apache.git/ Created attachment 570900 [details, diff]
Proposed patch for apache2ctl that supports systemd
Being annoyed by this bug for quite a while now I finally rewrote the apache2ctl script to add systemd support.
My suggested fix basically has two modes of operation:
If systemd is NOT detected, it behaves exactly like it used to (using the original code). I intentionally decided to use a negative test to ensure that the new code only is used if systemd is detected.
If systemd IS detected, it does not call "/etc/init.d/apache2" anymore but maps every item in RC_VERBS to the corresponding systemd service command. For items without a matching service command, actually the majority, it calls a function with the original code from "/etc/init.d/apache2", slightly modified to run without open-rc (mostly replacing "eerror" with a simple "echo").
In my tests this worked fine, so I hope it does the trick. In any case, I am open for suggestions.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/apache.git/commit/?id=fcc7da95dd75910085a8c688b8ec5d25ba11bd1e commit fcc7da95dd75910085a8c688b8ec5d25ba11bd1e Author: Lars Wendler <polynomial-c@gentoo.org> AuthorDate: 2019-04-02 08:31:45 +0000 Commit: Lars Wendler <polynomial-c@gentoo.org> CommitDate: 2019-04-02 08:39:12 +0000 Several fixes to previous apache2ctl systemd enhancement - Attempt to keep the script POSIX sh compliant - Don't use "function" prefix - Use curly braces for variables - Fixed indentation - Put code for systemd into an "else" part - Renamed "ERROR" variable to "retval" - Made some variables local - Put the systemd apache2 service file reference into a variable Bug: https://bugs.gentoo.org/673530 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> 2.4/scripts/apache2ctl | 198 ++++++++++++++++++++++++------------------------- 1 file changed, 97 insertions(+), 101 deletions(-) The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ba34aa34c25d07f495ae56fc56a2bbaab5d4dd6 commit 9ba34aa34c25d07f495ae56fc56a2bbaab5d4dd6 Author: Lars Wendler <polynomial-c@gentoo.org> AuthorDate: 2019-04-02 08:50:44 +0000 Commit: Lars Wendler <polynomial-c@gentoo.org> CommitDate: 2019-04-02 08:54:13 +0000 www-servers/apache: Security bump to version 2.4.39 Attempt to make apache2ctl systemd compatible Bug: https://bugs.gentoo.org/673530 Bug: https://bugs.gentoo.org/682306 Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Lars Wendler <polynomial-c@gentoo.org> www-servers/apache/Manifest | 2 + www-servers/apache/apache-2.4.39.ebuild | 257 ++++++++++++++++++++++++++++++++ 2 files changed, 259 insertions(+) Please test apache2ctl from >=www-servers/apache-2.4.39 and report back success/failure to this bug. Thanks for the additional QA. I tested www-servers/apache-2.4.39 and the script worked as intended. I also was able to run Certbot on my systemd host for the very first time without any hacks, thanks a lot for that too :D |