From patchwork Fri Aug 24 00:21:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Araneda X-Patchwork-Id: 961651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aIh9ungN"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tTmKAkZb"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41xMS02Cwgz9ryn for ; Fri, 24 Aug 2018 10:22:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=2Hr+/ISn7MkSkK6GkFKS7JXMHdrCxdS/eyfw+GORumw=; b=aIh9ungNJxUxFE tnvT1hAEhU/pPPOEaurF5+R7m0AJyPEdm4NWNYAo3TBdqQMhI6W/ZeFTb3XzMzYercqvlrrI5ggnV 5LZxq9ddoDjtEBTSFhanlKPEOhzjepsLLUz7ArWk9FWGZVa/7tOIHSKKrAcPqDsOCp8/M9tJ5NoZ2 J5vPDKsCXbDvG024rWHF6WO6Ka+xMK/FMLLq+vIkFpZDWUFYMqpFjKNPa9g1T4wOdv37yZjWrGrct fS0JnLjx2fMcETYczGV5bNcC0pu2jBKY/H2VXh28NnZLigjWAbhOAV6Ayj59gET85Suk5ctvNDWq7 FIOfd/51l1xwki1VPHOg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fszs1-0005Wq-QQ; Fri, 24 Aug 2018 00:22:33 +0000 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fszry-0005Vr-1j for openwrt-devel@lists.openwrt.org; Fri, 24 Aug 2018 00:22:31 +0000 Received: by mail-qk0-x241.google.com with SMTP id j7-v6so4823696qkd.13 for ; Thu, 23 Aug 2018 17:22:18 -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=hmnVHqIo2j61S5qzm1RgrWytz2WrK3iB0knp16hD6DA=; b=tTmKAkZbSWWewRih1TreTq81PPkxjrsUJfxBP2MK26cm81w8IaUOiTLod8/jL73nnB sItW6oAMDFHWOpdi/vfQtc5j522InKtLA0uli8pvyoBvIt5a9WSUmq635JuVSJnaWkS7 HsL2dFZfvSmIFsEGsiruSxCM8MM4a25MmznIH+rgGwz4yPzHJPCOY6jfvG6ASxrE+sSZ qp7o2zoGUPrCIbmOO29qf5T8ZvndPdF7FTfXhdHXV0Hx4rCntdDOsBX0C+FC+EYFr3Ia nISfmFm5S9A7pf7wqSn3z2k48Iu+Cpc3Pk8GQ7hz6tNHL0wcYiTLJHKJMIzmb+AXcUGA hdFw== 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=hmnVHqIo2j61S5qzm1RgrWytz2WrK3iB0knp16hD6DA=; b=i8/Gc74cjgMS0RjZqE/HSnY5C+MgxjSnGL7wyoaEbSunjyqOQQxusUoc6GG3pvC1bh MIz9ye1KiBI4xW2DOBozNdLv7FBI35ssVIun/WpyT59xMZDtQo+aE4w9Wj23s6x7L/lD baI2oac3tJ7350cCxYNRfDGiVT+G6+umX550hg/lyywUgMOkkhpPmz3jFJkIURsJo7m8 lsVD4DcZR69geWEqNlnEC/ljgXfwTJeMjifnguwj0lS8z2g5vaZ9aN6sFV3vi6Vl+OQT fZUTY3vhTQoPTlMjJLwlzok5wunTcJV4BZ4xeobvm5GY+H4yrUi0EdFG31Zr/sIdEzFm 3tyQ== X-Gm-Message-State: AOUpUlEd6ddnHpGRgE35WZUQgj0LVe61sr1c3v/Pon+MFK/mwTb5w9iZ WzinGYPtBGKfWPcD98Vy4AGLtyWN X-Google-Smtp-Source: AA+uWPzNppcEChse1Ll+IOqa0ADpCfNhmQOJ1aJGi7Lr9hCk0PnWATLmZQSlB9H99rpEJ+O1szH8JQ== X-Received: by 2002:ae9:c112:: with SMTP id z18-v6mr56357939qki.96.1535070137906; Thu, 23 Aug 2018 17:22:17 -0700 (PDT) Received: from localhost.localdomain (186-106-13-190.baf.movistar.cl. [186.106.13.190]) by smtp.gmail.com with ESMTPSA id k15-v6sm3939565qtf.95.2018.08.23.17.22.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 17:22:17 -0700 (PDT) From: Luis Araneda To: openwrt-devel@lists.openwrt.org Date: Thu, 23 Aug 2018 21:21:22 -0300 Message-Id: <20180824002122.25770-1-luaraneda@gmail.com> X-Mailer: git-send-email 2.18.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180823_172230_142452_003BA950 X-CRM114-Status: UNSURE ( 9.28 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (luaraneda[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400d:c09:0:0:0:241 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [OpenWrt-Devel] [PATCH] base-files: execute package prerm script in a subshell X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Luis Araneda MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This fixes a problem that's causing an early return of default_prerm() when the package prerm script has an exit statement at the end, which is implemented as "exit 0" by most of the packages that use prerm With the new behavior, the execution of default_prerm() will continue only if the prerm script returns 0, otherwise the function will return the error code Additionally, this makes the execution consistent with the postinst script Signed-off-by: Luis Araneda --- Compile and run tested on ipq40xx --- package/base-files/files/lib/functions.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 318e91856b..579aa93dca 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -153,9 +153,14 @@ config_list_foreach() { default_prerm() { local root="${IPKG_INSTROOT}" local name + local ret name=$(basename ${1%.*}) - [ -f "$root/usr/lib/opkg/info/${name}.prerm-pkg" ] && . "$root/usr/lib/opkg/info/${name}.prerm-pkg" + if [ -f "$root/usr/lib/opkg/info/${name}.prerm-pkg" ]; then + ( . "$root/usr/lib/opkg/info/${name}.prerm-pkg" ) + ret=$? + [ $ret -ne 0 ] && return $ret + fi local shell="$(which bash)" for i in `cat "$root/usr/lib/opkg/info/${name}.list" | grep "^/etc/init.d/"`; do