From patchwork Tue Aug 3 17:32:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 1513024 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=jpXwzyr1; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GfMXb0BtLz9s5R for ; Wed, 4 Aug 2021 03:38:06 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=pD8EcLfDggfEPtb9H88Es7h1b3Tqo0kh/RfB1yqXNRA=; b=jpXwzyr11zm5C8 6Fk9ckRmblXqrZKJQc+PjyO90xyl/kz6H8BPFRtjjU3ichYxVCK3dRyWz7gkIMTMNrEsjEU8+kNuQ wz0FyEXLYuuibD5/J9LYUtnSWR/eBhsV5g7uS+PWuBx7zQRKOOKMy/EXFr46lVwcD1aW80QTwHrky ka3f05dnBYWiMgI8Pmh+WuI3agiqafSFh9lYGUrj2HTmOf/EKYwHarYJJ8yw7E2xyw5OrSgtrhh3d GfpWPFLS/ghBmSGaBq3GHIYXRnl3xph7fQPEvcTxAol4WhvoZVZCRUr9fa23PyBKFb/3Bl1Z8Ha4/ l5Vp7Ac7egVSel+gMvLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAyIn-003p7w-TX; Tue, 03 Aug 2021 17:34:05 +0000 Received: from fudo.makrotopia.org ([2a07:2ec0:3002::71]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAyIl-003p7T-3y for openwrt-devel@lists.openwrt.org; Tue, 03 Aug 2021 17:34:04 +0000 Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.94.2) (envelope-from ) id 1mAyIg-0005Ui-Mc for openwrt-devel@lists.openwrt.org; Tue, 03 Aug 2021 19:33:59 +0200 Date: Tue, 3 Aug 2021 18:32:48 +0100 From: Daniel Golle To: openwrt-devel@lists.openwrt.org Subject: [PATCH] base-files: sysupgrade: include configured dirs Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210803_103403_225544_B2AA2C06 X-CRM114-Status: UNSURE ( 9.90 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: When the directory nodes themselves are not in the tar, the permissions on restore depend on the way the restore is executed. A 750 dir will be restored as 755 by luci and 700 by shell. Make sure dire [...] Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org When the directory nodes themselves are not in the tar, the permissions on restore depend on the way the restore is executed. A 750 dir will be restored as 755 by luci and 700 by shell. Make sure directories get included in the list as well. For compatbility reasons, do not change the output of list-backup and do not show directories there as the output of that command may be intepreted by existing (external) scripts/tools. Reported-by: fda77 Signed-off-by: Daniel Golle --- package/base-files/files/sbin/sysupgrade | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 7e0a00e13b..5ccfb55911 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -134,9 +134,13 @@ list_changed_conffiles() { list_static_conffiles() { local filter=$1 - find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \ - /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \ - \( -type f -o -type l \) $filter 2>/dev/null + local items="$(sed -ne '/^[[:space:]]*$/d; /^#/d; p' /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null)" + # directories + for item in $items; do + [ -d $item ] && echo ${item%%/}/ + done + # files + find $items \( -type f -o -type l \) $filter 2>/dev/null } add_conffiles() { @@ -270,7 +274,7 @@ do_save_conffiles() { if [ $CONF_BACKUP_LIST -eq 1 ]; then run_hooks "$CONFFILES" $sysupgrade_init_conffiles [ "$SAVE_INSTALLED_PKGS" -eq 1 ] && echo ${INSTALLED_PACKAGES} >> "$CONFFILES" - cat "$CONFFILES" + grep -v '/$' "$CONFFILES" # for compatibility dont show dirs rm -f "$CONFFILES" exit 0 fi