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

Fabian Ebner f.ebner at proxmox.com
Thu Jun 17 10:09:28 CEST 2021


Am 16.06.21 um 15:11 schrieb Thomas Lamprecht:
> 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?
> 

Sure, I'll send a follow-up.

>> +                    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