From patchwork Sat May 9 20:33:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 470376 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7E95D1401B5 for ; Sun, 10 May 2015 06:34:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=MkgMkDDB; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 21E96284401; Sat, 9 May 2015 22:33:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, T_DKIM_INVALID autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 4A51228428E for ; Sat, 9 May 2015 22:32:58 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sat, 9 May 2015 22:32:55 +0200 (CEST) Received: by widdi4 with SMTP id di4so59613518wid.0 for ; Sat, 09 May 2015 13:34:08 -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=4LSoTZVK6TjrHTdjsO6cMvY2L/teI7k3mSHB5KSgWrU=; b=MkgMkDDB89PtNqnZdCoxE5EpuaDEBX1evUj7nIJCnarR9EbyMsEuiJ3p/K6GJdfRAq fh7VYisy15gMVXVt4vuOH2qtQVGAzjywUr3gEOAMKBDrReGyIU1dU+mfieiUQcxb23Rs 4XIxs4Yfzt/mv+ZW0/HkcrdBW/r8Yt95wAtZhAH2l4QZ/6IPkH6eHTA/jC7biIq6fpIe KCcwNsXfU7MMbTlyvv08trBtTJo7pL1JmTmbRvXRDuv7zBcMfW9DFhH+FQcPEDdv+8qK Cn0IVTc34TLbBUHWxly2tK/CtrrISVJ+LoXr/icu9yqQNFyY6lpkHG2nH/F6t5K61E5Y bIzg== X-Received: by 10.194.242.166 with SMTP id wr6mr7431675wjc.76.1431203648490; Sat, 09 May 2015 13:34:08 -0700 (PDT) Received: from linux-tdhb.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by mx.google.com with ESMTPSA id l3sm5336936wiv.18.2015.05.09.13.34.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 May 2015 13:34:07 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: openwrt-devel@lists.openwrt.org Date: Sat, 9 May 2015 22:33:52 +0200 Message-Id: <1431203632-18662-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Subject: [OpenWrt-Devel] [PATCH RFC] base-files: switch reset button support to hotplug.d X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" For years now we have procd (with its hotplug support) and action JSON executing all scripts in /etc/hotplug.d/SUBSYSTEM/. Move reset button support to handle it the same way we handle other subsystems. Signed-off-by: Rafał Miłecki --- package/base-files/files/etc/hotplug.d/button/reset | 18 ++++++++++++++++++ package/base-files/files/etc/rc.button/reset | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100755 package/base-files/files/etc/hotplug.d/button/reset delete mode 100755 package/base-files/files/etc/rc.button/reset diff --git a/package/base-files/files/etc/hotplug.d/button/reset b/package/base-files/files/etc/hotplug.d/button/reset new file mode 100755 index 0000000..4586f0a --- /dev/null +++ b/package/base-files/files/etc/hotplug.d/button/reset @@ -0,0 +1,18 @@ +#!/bin/sh + +[ "$BUTTON" = "reset" -a "${ACTION}" = "released" ] || exit 0 + +. /lib/functions.sh + +logger "$BUTTON pressed for $SEEN seconds" + +if [ "$SEEN" -lt 1 ] +then + echo "REBOOT" > /dev/console + sync + reboot +elif [ "$SEEN" -gt 5 ] +then + echo "FACTORY RESET" > /dev/console + jffs2reset -y && reboot & +fi diff --git a/package/base-files/files/etc/rc.button/reset b/package/base-files/files/etc/rc.button/reset deleted file mode 100755 index 229b503..0000000 --- a/package/base-files/files/etc/rc.button/reset +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -[ "${ACTION}" = "released" ] || exit 0 - -. /lib/functions.sh - -logger "$BUTTON pressed for $SEEN seconds" - -if [ "$SEEN" -lt 1 ] -then - echo "REBOOT" > /dev/console - sync - reboot -elif [ "$SEEN" -gt 5 ] -then - echo "FACTORY RESET" > /dev/console - jffs2reset -y && reboot & -fi