[__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 exit 0
fi fi
if [ ! -f "$__object/parameter/sum" ]
then
echo 'present'
exit 0
fi
sum_should="$( cat "$__object/parameter/sum" )" sum_should="$( cat "$__object/parameter/sum" )"
if [ -f "$__object/parameter/cmd-sum" ] if [ -f "$__object/parameter/cmd-sum" ]

View file

@ -8,9 +8,6 @@ cdist-type__download - Download a file
DESCRIPTION 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``. By default type will try to use ``wget``, ``curl`` or ``fetch``.
If download happens in target (see ``--download``) then type will If download happens in target (see ``--download``) then type will
fallback to (and install) ``wget``. fallback to (and install) ``wget``.
@ -25,14 +22,14 @@ REQUIRED PARAMETERS
url url
File's 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 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 download
If ``local`` (default), then download file to local storage and copy If ``local`` (default), then download file to local storage and copy
it to target host. If ``remote``, then download happens in target. it to target host. If ``remote``, then download happens in target.
@ -81,7 +78,7 @@ Ander Punnar <ander-at-kvlt-dot-ee>
COPYING 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 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 published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version. License, or (at your option) any later version.

View file

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

View file

@ -1,2 +1 @@
url url
sum