From patchwork Sun Oct 25 00:59:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau?= X-Patchwork-Id: 535514 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id CA1BD14131D for ; Sun, 25 Oct 2015 11:59:55 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=MjgsLNtS; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A063A248A1; Sun, 25 Oct 2015 00:59:53 +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 BeaWCW4q3NOy; Sun, 25 Oct 2015 00:59:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id B81D030A61; Sun, 25 Oct 2015 00:59:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 44B551C0BE0 for ; Sun, 25 Oct 2015 00:59:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 419C187354 for ; Sun, 25 Oct 2015 00:59:50 +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 1xEY6VxvmaLr for ; Sun, 25 Oct 2015 00:59:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 0729E872F3 for ; Sun, 25 Oct 2015 00:59:49 +0000 (UTC) Received: by wikq8 with SMTP id q8so120569854wik.1 for ; Sat, 24 Oct 2015 17:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=qKOOLxXq6bPDAbCvFiTr/jPexgu+rGcsRBkksWXBcjU=; b=MjgsLNtSmL4CE/FMZeedMsoIRxmnDfc5Moy1XG+smCw4ufnhhxjEhtHzim7anegEvR vVi8/ou6C52v1YNkacrA2ZLJf2MV30xBSs1btEAEj1GXkB40KX0eG100dEJNJAgMf7RE oUUYOoCy+JnGOI1e0Ja/uGE5oWU42zEifBGYCAoumRIgJWk5qsjvqkkoe05oG8Vk86gG nCeIt+zqDHQqmONQKD7IqrX1wMuHBSqWOy3teo1Fm349RCBrDpBqbUMV+Tledwy3GvBj 6/zY8xnQj2Mxz0jx7XcZFJjE8Tull8cTIPM3rzUsP4UecAIeYG7uowNiUxjFfw+p/QIv ZlJA== X-Received: by 10.180.74.238 with SMTP id x14mr13194232wiv.39.1445734787571; Sat, 24 Oct 2015 17:59:47 -0700 (PDT) Received: from localhost.localdomain (vno44-1-88-172-188-148.fbx.proxad.net. [88.172.188.148]) by smtp.gmail.com with ESMTPSA id jd9sm8406757wic.0.2015.10.24.17.59.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Oct 2015 17:59:47 -0700 (PDT) From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= To: Date: Sun, 25 Oct 2015 02:59:27 +0200 Message-Id: <1445734779-7212-1-git-send-email-benoit.thebaudeau.dev@gmail.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Cc: Thomas Petazzoni , =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Subject: [Buildroot] [PATCH v3 01/13] package/dhcp: fix SysV init scripts option passing 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: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Benoît Thébaudeau The SysV init scripts have configuration variables like INTERFACES whose contents have to be passed to the daemon. These variables are initialized as empty strings, but some of them are not allowed to be empty and there was no means of filling them apart from creating a root FS overlay to overwrite these scripts. This commit adds support for files under /etc/default/ to set these configuration variables. Such light files can now be added to the root FS skeleton or overlays without having to duplicate most of the SysV init scripts. Signed-off-by: Benoît Thébaudeau --- Changes v2 -> v3: none. Changes v1 -> v2: - Rebase. --- package/dhcp/S80dhcp-relay | 4 ++++ package/dhcp/S80dhcp-server | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/package/dhcp/S80dhcp-relay b/package/dhcp/S80dhcp-relay index 5ee06c7..0f383e6 100755 --- a/package/dhcp/S80dhcp-relay +++ b/package/dhcp/S80dhcp-relay @@ -13,6 +13,10 @@ INTERFACES="" # Additional options that are passed to the DHCP relay daemon? OPTIONS="" +# Read configuration variable file if it is present +CFG_FILE="/etc/default/dhcrelay" +[ -r "${CFG_FILE}" ] && . "${CFG_FILE}" + # Sanity checks test -f /usr/sbin/dhcrelay || exit 0 test -n "$INTERFACES" || exit 0 diff --git a/package/dhcp/S80dhcp-server b/package/dhcp/S80dhcp-server index 3df14ff..f7907e2 100755 --- a/package/dhcp/S80dhcp-server +++ b/package/dhcp/S80dhcp-server @@ -7,6 +7,10 @@ # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACES="" +# Read configuration variable file if it is present +CFG_FILE="/etc/default/dhcpd" +[ -r "${CFG_FILE}" ] && . "${CFG_FILE}" + # Sanity checks test -f /usr/sbin/dhcpd || exit 0 test -f /etc/dhcp/dhcpd.conf || exit 0