package/thttpd: fix init script
PATCH v2 2/2 package/thttpd: fix init script
From: Carlos Santos <[email protected]>
The init script provided by thttpd is for FreeBSD. Add a custom one, made specifically for Buildroot.
---
Changes v1->v2:
- Fix commit message spell errors (maade, Buirdroot).
--- package/thttpd/S90thttpd | 54 ++++++++++++++++++++++++++++++++++++++++ package/thttpd/thttpd.mk | 4 +-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 package/thttpd/S90thttpd
package/thttpd/S90thttpd new file +54 -0
@@ -0,0 +1,54 @@ +#!/bin/sh + +DAEMON="thttpd" +PIDFILE="/var/run/$DAEMON.pid" + +THTTPD_ARGS="-C /etc/thttpd.conf" + +# shellcheck source=/dev/null +[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" + +start() { + printf 'Starting %s: ' "$DAEMON" + # shellcheck disable=SC2086 # we need the word splitting + start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ + -- $THTTPD_ARGS + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +stop() { + printf 'Stopping %s: ' "$DAEMON" + start-stop-daemon -K -q -p "$PIDFILE" + status=$? + if [ "$status" -eq 0 ]; then + # thttpd does not remove the pid file on exit + rm -f "$PIDFILE" + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +restart() { + stop + sleep 1 + start +} + +case "$1" in + start|stop|restart) + "$1";; + reload) + # Restart, since there is no true "reload" feature. + restart;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac
package/thttpd/thttpd.mk +2 -2
@@ -29,8 +29,8 @@ define THTTPD_INSTALL_TARGET_CMDS endef define THTTPD_INSTALL_INIT_SYSV - $(INSTALL) -D -m 0755 $(@D)/scripts/thttpd.sh $(TARGET_DIR)/etc/init.d/S90thttpd - $(SED) 's:/usr/local/sbin:/usr/sbin:g' $(TARGET_DIR)/etc/init.d/S90thttpd + $(INSTALL) -D -m 0755 package/thttpd/S90thttpd \ + $(TARGET_DIR)/etc/init.d/S90thttpd endef define THTTPD_INSTALL_INIT_SYSTEMD
Signature · 1 line
2.18.1
Thomas Petazzoni
AppliedPATCH v2 2/2 package/thttpd: fix init script
Quoted 6 lines · On Sat, 14 Sep 2019 21:06:57 -0300 unixmania at gmail.com wrote:
From: Carlos Santos <[email protected]>
The init script provided by thttpd is for FreeBSD. Add a custom one, made specifically for Buildroot.
Signed-off-by Carlos Santos <[email protected]>
Quoted 8 lines
---
Changesv1->v2:
- Fix commit message spell errors (maade, Buirdroot).--- package/thttpd/S90thttpd | 54 ++++++++++++++++++++++++++++++++++++++++ package/thttpd/thttpd.mk | 4 +-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 package/thttpd/S90thttpd
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 2/2 package/thttpd: fix init script
Quoted 19 lines · Thomas Petazzoni
Quoted 6 lines · On Sat, 14 Sep 2019 21:06:57 -0300 unixmania at gmail.com wrote:
From: Carlos Santos <[email protected]>
The init script provided by thttpd is for FreeBSD. Add a custom one, made specifically for Buildroot.
Signed-off-by Carlos Santos <[email protected]>Quoted 8 lines
---
Changesv1->v2:
- Fix commit message spell errors (maade, Buirdroot).--- package/thttpd/S90thttpd | 54 ++++++++++++++++++++++++++++++++++++++++ package/thttpd/thttpd.mk | 4 +-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 package/thttpd/S90thttpd
Quoted 3 lines
Applied to master, thanks.
Thomas
Notice that the script requires /etc/thttpd.conf, introduced in a previous patch:
https://patchwork.ozlabs.org/patch/1154138/
Signature · 1 line
Carlos Santos <[email protected]>
PATCH v2 2/2 package/thttpd: fix init script
In reply to unixmania at gmail.comQuoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"unixmania" == unixmania <[email protected]> writes:
From: Carlos Santos <[email protected]>
The init script provided by thttpd is for FreeBSD. Add a custom one, made specifically for Buildroot.Signed-off-by Carlos Santos <[email protected]>---
Changesv1->v2:
- Fix commit message spell errors (maade, Buirdroot).
Committed to 2019.02.x, 2019.05.x and 2019.08.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard