]>
Commit | Line | Data |
---|---|---|
1a4ab884 FE |
1 | #!/bin/sh |
2 | ||
3 | set -e | |
4 | ||
5 | #DEBHELPER# | |
6 | ||
7 | case "$1" in | |
8 | configure) | |
9 | if test -n "$2"; then | |
10 | ||
11 | # TODO: remove once PVE 8.0 is released | |
12 | if dpkg --compare-versions "$2" 'lt' '7.0-3'; then | |
cd48e163 | 13 | warning="Warning: failed to move old CIFS credential file, cluster not quorate?" |
1a4ab884 FE |
14 | for file in /etc/pve/priv/*.cred; do |
15 | if [ -f "$file" ]; then | |
16 | echo "Info: found CIFS credentials using old path: $file" >&2 | |
cd48e163 | 17 | mkdir -p "/etc/pve/priv/storage" || { echo "$warning" && continue; } |
1a4ab884 FE |
18 | base=$(basename --suffix=".cred" "$file") |
19 | target="/etc/pve/priv/storage/$base.pw" | |
20 | if [ -f "$target" ]; then | |
d3c3c114 FE |
21 | if diff "$file" "$target" >&2 > /dev/null; then |
22 | echo "Info: removing $file, because it is identical to $target" >&2 | |
23 | rm "$file" || { echo "$warning" && continue; } | |
24 | else | |
25 | echo "Warning: not renaming $file, because $target already exists and differs!" >&2 | |
26 | fi | |
1a4ab884 FE |
27 | else |
28 | echo "Info: renaming $file to $target" >&2 | |
cd48e163 | 29 | mv "$file" "$target" || { echo "$warning" && continue; } |
1a4ab884 FE |
30 | fi |
31 | fi | |
32 | done | |
33 | fi | |
34 | fi | |
35 | ;; | |
36 | ||
37 | esac | |
38 | ||
39 | exit 0 |