From patchwork Sun Sep 15 00:06:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1162375 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VYpRLWEn"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46W8nc15jSz9s4Y for ; Sun, 15 Sep 2019 10:07:13 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5CF1586816; Sun, 15 Sep 2019 00:07:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sEj5jgQhXmZp; Sun, 15 Sep 2019 00:07:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 4924D86819; Sun, 15 Sep 2019 00:07:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id C09461BF4E2 for ; Sun, 15 Sep 2019 00:07:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BDD7F204DE for ; Sun, 15 Sep 2019 00:07:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xSphb9nuQlqF for ; Sun, 15 Sep 2019 00:07:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by silver.osuosl.org (Postfix) with ESMTPS id D8AAC204CC for ; Sun, 15 Sep 2019 00:07:03 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id s18so32328324qkj.3 for ; Sat, 14 Sep 2019 17:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=pfNGfH6V2GQ92h2h1QO0iknxS7sPHDlwwLOn2PPkndU=; b=VYpRLWEnK8+jdSAlsTi1FsBP5ql87nDX6MtfMJCKfBtgDEGEEP3wHoJnuaBdXS3ooL wSXYksrvtaAFpQ6dWD4xSl/1TK1oHbK6+nxUIGX63GlqEpfDClhqZVRZCs4IsbHG3hTI zZEvF2yYNS0neubu1xNriob49Sw+pqHQ+ZXKh9AIisIXi5K4ZToVRh256K8nf7g0TRJE DdvrU0SXyv/pq39qkMBRh/sYenhuJN4WQMZ/3I/AqA1N2kLngpimI4qFKRb+LDS7GgDE RwneevHW6SmU5ksUOIZVzYwbHqjElSxGdeieCmk5kPsahV57U3JlLM0w5cIUCDirQGkG 4a3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pfNGfH6V2GQ92h2h1QO0iknxS7sPHDlwwLOn2PPkndU=; b=JfYMHyQwlnFjr3Bo39NdRzKlYIM7JhYpey1Al7wEeh7xwJl0zAU57kDRVCGoqZ8fNa C8N30lsm8YtmuGHO/sds5rMaJLQvSOaknzwdBOFxPoab+6NrekTVM1NL2Kc0IQvRAIif 7mza4ykcgLQgyAnVmpCIht1/yGC6Ol7z5OWC/qdAZPD+OkjHZk+9XUCiB/SF1q2kyjzU pXzFJYJ05zyXOCVdCZImUbj+z+3OYQ/v72DGVYjwf5Qo8aCrAVPxYemJcoEnymg14zf1 5KeApNhsdOIrnqlMQcMEA3oa+YIe1+rad8jBgpmJOTdp9BjO+qaPnHTmnAiOBlDTF6wa yzug== X-Gm-Message-State: APjAAAWknWebHJfYycseeGpor50zenZeTW5zgU27D1jPGIfQUq8txpPZ HrHi5mzxDpAy7cZcucBtIGnTY7sj X-Google-Smtp-Source: APXvYqyC+aBxU9thsP2hHjVPK6m/oDKLnBTTmANtWC4F2dho8mfva1acBqDb63ByZ72XDSFNI/Yltw== X-Received: by 2002:a37:488d:: with SMTP id v135mr5114307qka.284.1568506022700; Sat, 14 Sep 2019 17:07:02 -0700 (PDT) Received: from casantos.casantos.org (189.27.155.121.dynamic.adsl.gvt.net.br. [189.27.155.121]) by smtp.gmail.com with ESMTPSA id b4sm15225644qkd.121.2019.09.14.17.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Sep 2019 17:07:02 -0700 (PDT) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Sat, 14 Sep 2019 21:06:57 -0300 Message-Id: <20190915000657.10570-1-unixmania@gmail.com> X-Mailer: git-send-email 2.18.1 Subject: [Buildroot] [PATCH v2 2/2] package/thttpd: fix init script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Santos MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos The init script provided by thttpd is for FreeBSD. Add a custom one, made specifically for Buildroot. Signed-off-by: Carlos Santos --- 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 diff --git a/package/thttpd/S90thttpd b/package/thttpd/S90thttpd new file mode 100644 index 0000000000..94b079b050 --- /dev/null +++ b/package/thttpd/S90thttpd @@ -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 diff --git a/package/thttpd/thttpd.mk b/package/thttpd/thttpd.mk index 03f148eb35..6cf86e4b95 100644 --- a/package/thttpd/thttpd.mk +++ b/package/thttpd/thttpd.mk @@ -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