[__download] make --sum optional

This commit is contained in:
ander 2021-04-11 23:05:48 +03:00
parent 750c71fb5a
commit d2eec60668
No known key found for this signature in database
GPG Key ID: 0A2971E562D618F3
4 changed files with 13 additions and 10 deletions

View File

@ -8,6 +8,12 @@ then
exit 0
fi
if [ ! -f "$__object/parameter/sum" ]
then
echo 'present'
exit 0
fi
sum_should="$( cat "$__object/parameter/sum" )"
if [ -f "$__object/parameter/cmd-sum" ]

View File

@ -8,9 +8,6 @@ cdist-type__download - Download a file
DESCRIPTION
-----------
Destination (``$__object_id``) in target host must be persistent storage
in order to calculate checksum and decide if file must be (re-)downloaded.
By default type will try to use ``wget``, ``curl`` or ``fetch``.
If download happens in target (see ``--download``) then type will
fallback to (and install) ``wget``.
@ -25,14 +22,14 @@ REQUIRED PARAMETERS
url
File's URL.
sum
Checksum of file going to be downloaded.
By default output of ``cksum`` without filename is expected.
Other hash formats supported with prefixes: ``md5:``, ``sha1:`` and ``sha256:``.
OPTIONAL PARAMETERS
-------------------
sum
Checksum is used to decide if existing destination file must be redownloaded.
By default output of ``cksum`` without filename is expected.
Other hash formats supported with prefixes: ``md5:``, ``sha1:`` and ``sha256:``.
download
If ``local`` (default), then download file to local storage and copy
it to target host. If ``remote``, then download happens in target.
@ -81,7 +78,7 @@ Ander Punnar <ander-at-kvlt-dot-ee>
COPYING
-------
Copyright \(C) 2020 Ander Punnar. You can redistribute it
Copyright \(C) 2021 Ander Punnar. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -1,3 +1,4 @@
sum
cmd-get
cmd-sum
download

View File

@ -1,2 +1 @@
url
sum