From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1DD5A7277C for ; Wed, 16 Jun 2021 09:27:06 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 15AF7E7DC for ; Wed, 16 Jun 2021 09:27:06 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 8E1B3E798 for ; Wed, 16 Jun 2021 09:27:04 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 62BB142D92 for ; Wed, 16 Jun 2021 09:27:04 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Wed, 16 Jun 2021 09:26:56 +0200 Message-Id: <20210616072700.54289-5-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210616072700.54289-1-f.ebner@proxmox.com> References: <20210616072700.54289-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -1.748 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_SOMETLD_ARE_BAD_TLD 5 .stream, .trade, .pw, .top, .press, .guru, .casa & .date TLD Abuse SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [cifsplugin.pm, base.pw] Subject: [pve-devel] [PATCH v2 storage 1/5] postinst: move cifs credential files into subdirectory upon update X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jun 2021 07:27:06 -0000 and drop the compat code. Signed-off-by: Fabian Ebner --- Changes from v1: * make sure to create the /etc/pve/priv/storage directory which might not exist yet * always print info when a file was found * use variable for target path * use mv * removing the helper needs to wait until 8.0 PVE/Storage/CIFSPlugin.pm | 3 --- debian/postinst | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 debian/postinst diff --git a/PVE/Storage/CIFSPlugin.pm b/PVE/Storage/CIFSPlugin.pm index be06cc7..9d69b01 100644 --- a/PVE/Storage/CIFSPlugin.pm +++ b/PVE/Storage/CIFSPlugin.pm @@ -59,9 +59,6 @@ sub get_cred_file { if (-e $cred_file) { return $cred_file; - } elsif (-e "/etc/pve/priv/${storeid}.cred") { - # FIXME: remove fallback with 7.0 by doing a rename on upgrade from 6.x - return "/etc/pve/priv/${storeid}.cred"; } return undef; } diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..508075b --- /dev/null +++ b/debian/postinst @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +case "$1" in + configure) + if test -n "$2"; then + + # TODO: remove once PVE 8.0 is released + if dpkg --compare-versions "$2" 'lt' '7.0-3'; then + for file in /etc/pve/priv/*.cred; do + if [ -f "$file" ]; then + mkdir -p "/etc/pve/priv/storage" + echo "Info: found CIFS credentials using old path: $file" >&2 + base=$(basename --suffix=".cred" "$file") + target="/etc/pve/priv/storage/$base.pw" + if [ -f "$target" ]; then + echo "Warning: not renaming $file, because $target already exists!" >&2 + else + echo "Info: renaming $file to $target" >&2 + mv "$file" "$target" + fi + fi + done + fi + fi + ;; + +esac + +exit 0 -- 2.30.2