* [Buildroot] [PATCH 2/2] apache init script
@ 2018-02-27 11:50 Christopher McCrory
2018-02-27 21:18 ` Thomas Petazzoni
2018-03-01 19:55 ` Arnout Vandecappelle
0 siblings, 2 replies; 5+ messages in thread
From: Christopher McCrory @ 2018-02-27 11:50 UTC (permalink / raw)
To: buildroot
This patches and installs the included init script. The script mostly works, but could use a little more editing.
Signed-off-by: Christopher McCrory <chrismcc@gmail.com>
---
package/apache/0003-init-script.patch | 56 +++++++++++++++++++++++++++++++++++
package/apache/apache.mk | 6 ++++
2 files changed, 62 insertions(+)
create mode 100644 package/apache/0003-init-script.patch
diff --git a/package/apache/0003-init-script.patch b/package/apache/0003-init-script.patch
new file mode 100644
index 0000000000..1d7a6a022a
--- /dev/null
+++ b/package/apache/0003-init-script.patch
@@ -0,0 +1,56 @@
+--- apache-2.4.29/build/rpm/httpd.init.orig 2018-02-26 01:04:07.243097556 -0800
++++ apache-2.4.29/build/rpm/httpd.init 2018-02-26 01:50:18.311683909 -0800
+@@ -22,7 +22,7 @@
+ # description: The Apache HTTP Server is an efficient and extensible \
+ # server implementing the current HTTP standards.
+ # processname: httpd
+-# pidfile: /var/run/httpd.pid
++# pidfile: /var/logs/httpd.pid
+ # config: /etc/sysconfig/httpd
+ #
+ ### BEGIN INIT INFO
+@@ -36,7 +36,7 @@
+ ### END INIT INFO
+
+ # Source function library.
+-. /etc/rc.d/init.d/functions
++#. /etc/rc.d/init.d/functions
+
+ # What were we called? Multiple instances of the same daemon can be
+ # created by creating suitably named symlinks to this startup script
+@@ -58,13 +58,13 @@
+ # work correctly with a thread-based MPM; notably PHP will refuse to start.
+
+ httpd=${HTTPD-/usr/sbin/httpd}
+-pidfile=${PIDFILE-/var/run/${prog}.pid}
+-lockfile=${LOCKFILE-/var/lock/subsys/${prog}}
++pidfile=${PIDFILE-/var/logs/httpd.pid}
++lockfile=${LOCKFILE-/var/lock/httpd}
+ RETVAL=0
+
+ # check for 1.3 configuration
+ check13 () {
+- CONFFILE=/etc/httpd/conf/httpd.conf
++ CONFFILE=/etc/apache2/httpd.conf
+ GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
+ GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
+ GONE="${GONE}AccessConfig|ResourceConfig)"
+@@ -85,7 +85,8 @@
+ start() {
+ echo -n $"Starting $prog: "
+ check13 || exit 1
+- LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
++ LANG=$HTTPD_LANG start-stop-daemon -S -q --pidfile=${pidfile} -x $httpd -- $OPTIONS
++
+ RETVAL=$?
+ echo
+ [ $RETVAL = 0 ] && touch ${lockfile}
+@@ -93,7 +94,7 @@
+ }
+ stop() {
+ echo -n $"Stopping $prog: "
+- killproc -p ${pidfile} -d 10 $httpd
++ start-stop-daemon -K -p ${pidfile}
+ RETVAL=$?
+ echo
+ [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
diff --git a/package/apache/apache.mk b/package/apache/apache.mk
index 010ec31c33..5921d48b18 100644
--- a/package/apache/apache.mk
+++ b/package/apache/apache.mk
@@ -82,6 +82,12 @@ define APACHE_FIX_STAGING_APACHE_CONFIG
endef
APACHE_POST_INSTALL_STAGING_HOOKS += APACHE_FIX_STAGING_APACHE_CONFIG
+define APACHE_INSTALL_INIT_SCRIPT
+ $(INSTALL) -D -m 0755 $(@D)/build/rpm/httpd.init \
+ $(TARGET_DIR)/etc/init.d/S85httpd
+endef
+APACHE_POST_INSTALL_TARGET_HOOKS += APACHE_INSTALL_INIT_SCRIPT
+
define APACHE_CLEANUP_TARGET
$(RM) -rf $(TARGET_DIR)/usr/manual $(TARGET_DIR)/usr/build
endef
--
2.14.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [Buildroot] [PATCH 2/2] apache init script
2018-02-27 11:50 [Buildroot] [PATCH 2/2] apache init script Christopher McCrory
@ 2018-02-27 21:18 ` Thomas Petazzoni
2018-03-02 17:08 ` Christopher McCrory
2018-03-01 19:55 ` Arnout Vandecappelle
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2018-02-27 21:18 UTC (permalink / raw)
To: buildroot
Hello,
Thanks for this contribution!
The commit title should be something like:
apache: install an sysv init script
On Tue, 27 Feb 2018 03:50:22 -0800, Christopher McCrory wrote:
> This patches and installs the included init script. The script mostly works, but could use a little more editing.
The commit log should be wrapped to 72 characters.
> package/apache/0003-init-script.patch | 56 +++++++++++++++++++++++++++++++++++
> package/apache/apache.mk | 6 ++++
> 2 files changed, 62 insertions(+)
> create mode 100644 package/apache/0003-init-script.patch
>
> diff --git a/package/apache/0003-init-script.patch b/package/apache/0003-init-script.patch
> new file mode 100644
> index 0000000000..1d7a6a022a
> --- /dev/null
> +++ b/package/apache/0003-init-script.patch
All patches should have a description and a Signed-off-by line.
What does the complete init script looks like after your patch ? Is it
worth re-using the init script provided by Apache, as opposed to
providing a simple one in package/apache/S<xy>apache ?
> +define APACHE_INSTALL_INIT_SCRIPT
Just call this variable:
APACHE_INSTALL_INIT_SYSV
This way, no need to add it to APACHE_POST_INSTALL_TARGET_HOOKS, and
the script will not be installed if the Buildroot configuration uses
systemd instead of busybox init or sysvinit.
> + $(INSTALL) -D -m 0755 $(@D)/build/rpm/httpd.init \
> + $(TARGET_DIR)/etc/init.d/S85httpd
Second line should be intended with two tabs.
> +endef
> +APACHE_POST_INSTALL_TARGET_HOOKS += APACHE_INSTALL_INIT_SCRIPT
So this line can go away.
Could you take into account those comments and submit an updated
version ?
Thanks a lot!
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 2/2] apache init script
2018-02-27 21:18 ` Thomas Petazzoni
@ 2018-03-02 17:08 ` Christopher McCrory
2018-03-02 20:08 ` Thomas Petazzoni
0 siblings, 1 reply; 5+ messages in thread
From: Christopher McCrory @ 2018-03-02 17:08 UTC (permalink / raw)
To: buildroot
Hello
D'oh sending to list also
<snip>
> What does the complete init script looks like after your patch ? Is it
> worth re-using the init script provided by Apache, as opposed to
> providing a simple one in package/apache/S<xy>apache ?
>
>
I started with the idea of changing just enough of the included init script
to get the daemon running. I am used to the RedHat/Fedora sysv init
system, not the debian/start-stop-daemon style. I didn't want to snag some
other init file using start-stop-daemon, replace a variable, and submit it
as my own work. I'd rather learn the nuances of start-stop-daemon and
write a script that I understand and works as expected.
After testing a few other packages, I noticed quite a few that don't have
init scripts. Is this by design? I'd like to add the ability to generate
an initscript within the buildroot system. something like
$PACKAGE_GENERATE_AND_INSTALL_SYSV_INIT_SCRIPT = YES # with a shorter name
though :)
in the package.mk file that would use a template to create a working init
script. And a global toggle in makemenu -> Build Options to
enable/disable. yes? no? maybe?
<snip>
--
Christopher McCrory
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180302/e0f60077/attachment.html>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 2/2] apache init script
2018-03-02 17:08 ` Christopher McCrory
@ 2018-03-02 20:08 ` Thomas Petazzoni
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2018-03-02 20:08 UTC (permalink / raw)
To: buildroot
Hello,
On Fri, 2 Mar 2018 09:08:06 -0800, Christopher McCrory wrote:
> I started with the idea of changing just enough of the included init script
> to get the daemon running. I am used to the RedHat/Fedora sysv init
> system, not the debian/start-stop-daemon style. I didn't want to snag some
> other init file using start-stop-daemon, replace a variable, and submit it
> as my own work. I'd rather learn the nuances of start-stop-daemon and
> write a script that I understand and works as expected.
Well, we very much prefer to have init scripts that all follow the same
patterns, rather than init scripts that are all very different from
each other. Having similar init scriptss makes maintenance a lot easier
for us.
So please, re-use the same pattern as existing init scripts. You're not
stealing the work of anyone, because you're also contributing to
Buildroot, under the same license.
> After testing a few other packages, I noticed quite a few that don't have
> init scripts. Is this by design? I'd like to add the ability to generate
> an initscript within the buildroot system. something like
> $PACKAGE_GENERATE_AND_INSTALL_SYSV_INIT_SCRIPT = YES # with a shorter name
> though :)
> in the package.mk file that would use a template to create a working init
> script. And a global toggle in makemenu -> Build Options to
> enable/disable. yes? no? maybe?
Most init scripts have subtle nuances that make a completely
auto-generated init script mechanism not really desirable. I think we
prefer the dumb approach we have today.
However, patches adding init scripts to more packages are definitely
welcome.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 2/2] apache init script
2018-02-27 11:50 [Buildroot] [PATCH 2/2] apache init script Christopher McCrory
2018-02-27 21:18 ` Thomas Petazzoni
@ 2018-03-01 19:55 ` Arnout Vandecappelle
1 sibling, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2018-03-01 19:55 UTC (permalink / raw)
To: buildroot
On 27-02-18 12:50, Christopher McCrory wrote:
> +@@ -58,13 +58,13 @@
> + # work correctly with a thread-based MPM; notably PHP will refuse to start.
> +
> + httpd=${HTTPD-/usr/sbin/httpd}
> +-pidfile=${PIDFILE-/var/run/${prog}.pid}
> +-lockfile=${LOCKFILE-/var/lock/subsys/${prog}}
> ++pidfile=${PIDFILE-/var/logs/httpd.pid}
PID files really should go into /var/run, not in /var/logs.
Regards,
Arnout
> ++lockfile=${LOCKFILE-/var/lock/httpd}
> + RETVAL=0
> +
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-03-02 20:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-27 11:50 [Buildroot] [PATCH 2/2] apache init script Christopher McCrory
2018-02-27 21:18 ` Thomas Petazzoni
2018-03-02 17:08 ` Christopher McCrory
2018-03-02 20:08 ` Thomas Petazzoni
2018-03-01 19:55 ` Arnout Vandecappelle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox