mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2024-12-22 13:34:16 +03:00
d3c3c114c3
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
40 lines
1.4 KiB
Bash
40 lines
1.4 KiB
Bash
#!/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
|
|
warning="Warning: failed to move old CIFS credential file, cluster not quorate?"
|
|
for file in /etc/pve/priv/*.cred; do
|
|
if [ -f "$file" ]; then
|
|
echo "Info: found CIFS credentials using old path: $file" >&2
|
|
mkdir -p "/etc/pve/priv/storage" || { echo "$warning" && continue; }
|
|
base=$(basename --suffix=".cred" "$file")
|
|
target="/etc/pve/priv/storage/$base.pw"
|
|
if [ -f "$target" ]; then
|
|
if diff "$file" "$target" >&2 > /dev/null; then
|
|
echo "Info: removing $file, because it is identical to $target" >&2
|
|
rm "$file" || { echo "$warning" && continue; }
|
|
else
|
|
echo "Warning: not renaming $file, because $target already exists and differs!" >&2
|
|
fi
|
|
else
|
|
echo "Info: renaming $file to $target" >&2
|
|
mv "$file" "$target" || { echo "$warning" && continue; }
|
|
fi
|
|
fi
|
|
done
|
|
fi
|
|
fi
|
|
;;
|
|
|
|
esac
|
|
|
|
exit 0
|