Files
pve-storage/debian/postinst
Thomas Lamprecht a81ee83127 config: rename external-snapshots to snapshot-as-volume-chain
Not perfect but now it's still easy to rename and the new variant fits
a bit better to the actual design and implementation.

Add best-effort migration for storage.cfg, this has been never
publicly released after all.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-07-17 20:15:48 +02:00

51 lines
2.0 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
# TODO: Can be dropped with some 9.x stable release, this was never in a publicly available
# package, so only for convenience for internal testing setups.
if dpkg --compare-versions "$2" 'lt' '9.0.5'; then
if grep -Pq '^\texternal-snapshots ' /etc/pve/storage.cfg; then
echo "Replacing old 'external-snapshots' with 'snapshot-as-volume-chain' in /etc/pve/storage.cfg"
sed -i 's/^\texternal-snapshots /\tsnapshot-as-volume-chain /' /etc/pve/storage.cfg || \
echo "Failed to replace old 'external-snapshots' with 'snapshot-as-volume-chain' in /etc/pve/storage.cfg"
fi
fi
fi
;;
esac
exit 0