From patchwork Tue Nov 18 14:54:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume GARDET X-Patchwork-Id: 412057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id C6777140186 for ; Wed, 19 Nov 2014 01:57:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id BD569A16AC; Tue, 18 Nov 2014 14:57:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a2r32ARJKANj; Tue, 18 Nov 2014 14:57:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id C4B9EA15BD; Tue, 18 Nov 2014 14:57:07 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 903E91C2579 for ; Tue, 18 Nov 2014 14:57:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8C9368F4B2 for ; Tue, 18 Nov 2014 14:57:04 +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 C+DBaxoDH1eD for ; Tue, 18 Nov 2014 14:57:04 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp6-g21.free.fr (smtp6-g21.free.fr [212.27.42.6]) by whitealder.osuosl.org (Postfix) with ESMTPS id 04FBC8D395 for ; Tue, 18 Nov 2014 14:57:04 +0000 (UTC) Received: from OLI01.site (unknown [82.244.147.214]) by smtp6-g21.free.fr (Postfix) with ESMTP id 32001822F0; Tue, 18 Nov 2014 15:56:49 +0100 (CET) From: Guillaume GARDET To: buildroot@busybox.net Date: Tue, 18 Nov 2014 15:54:44 +0100 Message-Id: <1416322487-14247-3-git-send-email-guillaume.gardet@oliseo.fr> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1416322487-14247-1-git-send-email-guillaume.gardet@oliseo.fr> References: <1415808993-2394-1-git-send-email-guillaume.gardet@oliseo.fr> <1416322487-14247-1-git-send-email-guillaume.gardet@oliseo.fr> Subject: [Buildroot] [PATCH V3 2/5] package/squid: add init script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Guillaume GARDET --- package/squid/S97squid | 36 ++++++++++++++++++++++++++++++++++++ package/squid/squid.mk | 7 +++++++ 2 files changed, 43 insertions(+) create mode 100644 package/squid/S97squid diff --git a/package/squid/S97squid b/package/squid/S97squid new file mode 100644 index 0000000..0908784 --- /dev/null +++ b/package/squid/S97squid @@ -0,0 +1,36 @@ +#!/bin/sh + +SQUID_BIN="/usr/sbin/squid" +SQUID_LOG_DIR="/var/log/squid" +SQUID_PID=/var/run/squid.pid +SQUID_CONF=/etc/squid.conf +SQUID_OPTS="" + +# (Re)create log directory and give access to squid user (nobody) +if [ ! -d $SQUID_LOG_DIR ]; then + mkdir -p $SQUID_LOG_DIR + chmod 777 $SQUID_LOG_DIR +fi + +case "$1" in + start) + echo -n "Starting WWW-proxy squid " + start-stop-daemon -S -x $SQUID_BIN -- -f $SQUID_CONF $SQUID_OPTS + [ $? == 0 ] && echo "OK" || echo "FAIL" + ;; + stop) + echo -n "Shutting down WWW-proxy squid " + start-stop-daemon -K -x $SQUID_BIN + ;; + restart | force-reload) + $0 stop + sleep 2 + $0 start + if [ "$?" != "0" ]; then + exit 1 + fi + ;; + *) + echo "Usage: /etc/init.d/S97squid {start|stop|restart|force-reload}" + exit 1 +esac diff --git a/package/squid/squid.mk b/package/squid/squid.mk index ed51881..b0fa69f 100644 --- a/package/squid/squid.mk +++ b/package/squid/squid.mk @@ -50,4 +50,11 @@ endef SQUID_POST_INSTALL_TARGET_HOOKS += SQUID_CLEANUP_TARGET +define SQUID_INSTALL_INIT_SYSV + # install start/stop script + @if [ ! -f $(TARGET_DIR)/etc/init.d/S97squid ]; then \ + $(INSTALL) -m 0755 -D package/squid/S97squid $(TARGET_DIR)/etc/init.d/S97squid; \ + fi +endef + $(eval $(autotools-package))