From patchwork Fri Feb 7 22:33:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Santos X-Patchwork-Id: 1235153 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) 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.a=rsa-sha256 header.s=20161025 header.b=sCx9AMrh; 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 48DqpP4P9Rz9sRQ for ; Sat, 8 Feb 2020 09:33:49 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 464C086ED5; Fri, 7 Feb 2020 22:33:47 +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 wB6wqqntgoXa; Fri, 7 Feb 2020 22:33:46 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id E6BCF86E9E; Fri, 7 Feb 2020 22:33:45 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 623CD1BF57C for ; Fri, 7 Feb 2020 22:33:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5823788012 for ; Fri, 7 Feb 2020 22:33:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G4rgqoGEwLoy for ; Fri, 7 Feb 2020 22:33:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9968C88084 for ; Fri, 7 Feb 2020 22:33:38 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id g195so679294qke.13 for ; Fri, 07 Feb 2020 14:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LWTrUNkrLP13v6wvkO9lnL8JfppzhP/zZIRiI4/NYt4=; b=sCx9AMrhlPLk1uBXafi1EskWq7c/9ni2X2uvoHiI/MQgdLV0cI5YjRXxYQFcrgwbht GSwrUeza9eVd2oTimiuTfRRfmm39gB/jMeybMDGfbEu5wNWD/3qHpkV4yKpc/IAmoazr 7bQMqnCeUcmGg/no8YFnKwl+9wDym3NmlDW+vQZ56Sru+EBTRn37jdbImOWngqlRIyga xsGX6mwhoVNuogkpIamvfOkti1flYtKi4hSiDdtxvY7sGlD3dw5F4cHZC0Cb2h4qxzau UR8YFjLOCC9HjY+Q3i47xMdicfI4j+w0mqDRsoQPIuhkwQpTqyvsLZrZOhhPYqAKXsMg 2x3Q== 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:in-reply-to :references; bh=LWTrUNkrLP13v6wvkO9lnL8JfppzhP/zZIRiI4/NYt4=; b=FXZgDMwPiGBdDKNL6sWxgX+XuEW5csuzTS/QhXf+keXUK0XloQbf0d/Wh1OXzu94Al aZT5va677k9oNme0S/UbY/ivoZfqMKKyH/wkVWNNSkC2mIVNTdFkummow3t6P5COTU+k U1Ag/UQRnD4blnU41wrZ5uXqEMeGYWCkPcv7jn0pSgzMSXK4rR24HTbMr6D7T+yxaHMz m8nlUDQVaT3d8F+CJYlbv4zvaBQZOxlBUMFs/LcEoeI5kGjlqoMZm+o/hDyjJ9Sre/O0 zm685DEe2R+SpIiC70nu8ZMou7xqRXlLjVobVgbzMnxUbLVIpkTT3AqxewAdi0WcrkRH 9+4w== X-Gm-Message-State: APjAAAXNsJ80O+0guTqOEU0csaJwzvHeIrajXhC6oUOmiTlSmjJTBa7Q +sVitYl3XHTBplLK6wFg8h59psYIm+k= X-Google-Smtp-Source: APXvYqxjewDO9hOck1PBGQyWjc34G+DPuJo1sYwNEjv1hhqFva07hqZ22lkN+41kKaUFuOcVHtWYYg== X-Received: by 2002:a05:620a:2142:: with SMTP id m2mr1138660qkm.494.1581114817230; Fri, 07 Feb 2020 14:33:37 -0800 (PST) Received: from casantos.remote.com ([191.32.34.199]) by smtp.gmail.com with ESMTPSA id g37sm2185261qte.60.2020.02.07.14.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 14:33:36 -0800 (PST) From: unixmania@gmail.com To: buildroot@buildroot.org Date: Fri, 7 Feb 2020 19:33:22 -0300 Message-Id: <20200207223322.7182-3-unixmania@gmail.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20200207223322.7182-1-unixmania@gmail.com> References: <20200207223322.7182-1-unixmania@gmail.com> Subject: [Buildroot] [PATCH v2 2/2] package/skeleton-init-sysv: conditionally enable swapon/swapoff in inittab 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 , Peter Korsgaard , Thomas De Schampheleire , Adam Duskett MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Carlos Santos The default inittab files added by busybox and sysvinit run 'swapon -a' during init and 'swapoff -a' during shutdown but those programs are not guaranteed to be available, so the boot log may become polluted by error messages like this: swapon: not found Add a targe-finalize to skeleton-init-sysv that enables or disables the swapon/swapoff lines in /etc/inittab, depending on the existence of $(TARGET_DIR)/sbin/swap{on,off}. Based on a previous patch sent by Thomas De Schampheleire. Signed-off-by: Carlos Santos --- CC: Thomas De Schampheleire CC: Peter Korsgaard --- package/skeleton-init-sysv/skeleton-init-sysv.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/skeleton-init-sysv/skeleton-init-sysv.mk b/package/skeleton-init-sysv/skeleton-init-sysv.mk index c89c2dc1fd..6c9c2e80fb 100644 --- a/package/skeleton-init-sysv/skeleton-init-sysv.mk +++ b/package/skeleton-init-sysv/skeleton-init-sysv.mk @@ -19,4 +19,14 @@ define SKELETON_INIT_SYSV_INSTALL_TARGET_CMDS $(call SYSTEM_RSYNC,$(SKELETON_INIT_SYSV_PKGDIR)/skeleton,$(TARGET_DIR)) endef +define SKELETON_INIT_SYSV_SWAPON_SWAPOFF_INITTAB + if [ -x $(TARGET_DIR)/sbin/swapon -a -x $(TARGET_DIR)/sbin/swapoff ]; then \ + $(SED) '/^#.*\/sbin\/swap/s/^#\+[[:blank:]]*//' $(TARGET_DIR)/etc/inittab;\ + else \ + $(SED) '/^[^#].*\/sbin\/swap/s/^/#/' $(TARGET_DIR)/etc/inittab; \ + fi +endef + +SKELETON_INIT_SYSV_TARGET_FINALIZE_HOOKS += SKELETON_INIT_SYSV_SWAPON_SWAPOFF_INITTAB + $(eval $(generic-package))