]> git.proxmox.com Git - pve-storage.git/blob - debian/postinst
postinst: avoid spawning subshell
[pve-storage.git] / debian / postinst
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
13 warning="Warning: failed to move old CIFS credential file, cluster not quorate?"
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
17 mkdir -p "/etc/pve/priv/storage" || { echo "$warning" && continue; }
18 base=$(basename --suffix=".cred" "$file")
19 target="/etc/pve/priv/storage/$base.pw"
20 if [ -f "$target" ]; then
21 echo "Warning: not renaming $file, because $target already exists!" >&2
22 else
23 echo "Info: renaming $file to $target" >&2
24 mv "$file" "$target" || { echo "$warning" && continue; }
25 fi
26 fi
27 done
28 fi
29 fi
30 ;;
31
32 esac
33
34 exit 0