and drop the compat code.

Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---
 PVE/Storage/CIFSPlugin.pm |  3 ---
 debian/postinst           | 30 ++++++++++++++++++++++++++++++
 2 files changed, 30 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..e2453d2
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+case "$1" in
+  configure)
+    if test -n "$2"; then
+
+        # TODO: remove once PVE 7.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
+                    base=$(basename --suffix=".cred" "$file")
+                    if [ -f "/etc/pve/priv/storage/$base.pw" ]; then
+                        echo "Warning: found obsolete CIFS credentials file: 
$file" >&2
+                        echo "File: /etc/pve/priv/storage/$base.pw also 
exists" >&2
+                    else
+                        cp "$file" "/etc/pve/priv/storage/$base.pw" && rm 
"$file"
+                    fi
+                fi
+            done
+        fi
+    fi
+    ;;
+
+esac
+
+exit 0
-- 
2.30.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to