]> git.proxmox.com Git - pve-storage.git/blame - debian/postinst
postinst: avoid spawning subshell
[pve-storage.git] / debian / postinst
CommitLineData
1a4ab884
FE
1#!/bin/sh
2
3set -e
4
5#DEBHELPER#
6
7case "$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
21 echo "Warning: not renaming $file, because $target already exists!" >&2
22 else
23 echo "Info: renaming $file to $target" >&2
cd48e163 24 mv "$file" "$target" || { echo "$warning" && continue; }
1a4ab884
FE
25 fi
26 fi
27 done
28 fi
29 fi
30 ;;
31
32esac
33
34exit 0