mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-08-25 21:49:35 +03:00
postinst: move cifs credential files into subdirectory upon update
and drop the compat code. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Fabian Grünbichler
parent
d7f6f85ea0
commit
1a4ab884e8
@ -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;
|
||||
}
|
||||
|
33
debian/postinst
vendored
Normal file
33
debian/postinst
vendored
Normal file
@ -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
|
||||
echo "Info: found CIFS credentials using old path: $file" >&2
|
||||
mkdir -p "/etc/pve/priv/storage" || (echo "Warning: failed to move old CIFS credential file, cluster not quorate?" && continue)
|
||||
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" || (echo "Warning: failed to move old CIFS credential file, cluster not quorate?" && continue)
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user