[pve-devel] [PATCH v2 storage 1/5] postinst: move cifs credential files into subdirectory upon update

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jun 16 15:11:37 CEST 2021


On 16.06.21 09:26, Fabian Ebner wrote:
> +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
> +                    mkdir -p "/etc/pve/priv/storage"
> +                    echo "Info: found CIFS credentials using old path: $file" >&2
> +                    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

can we diff in this case and remove the old one if the files are identical?

> +                    else
> +                        echo "Info: renaming $file to $target" >&2
> +                        mv "$file" "$target"
> +                    fi
> +                fi
> +            done
> +        fi
> +    fi
> +    ;;
> +
> +esac
> +
> +exit 0
> 






More information about the pve-devel mailing list