82 lines
2.2 KiB
ReStructuredText
82 lines
2.2 KiB
ReStructuredText
cdist-type__download(7)
|
|
=======================
|
|
|
|
NAME
|
|
----
|
|
cdist-type__download - Download file to local storage and copy it to target host
|
|
|
|
|
|
DESCRIPTION
|
|
-----------
|
|
You must use persistent storage in target host for destination file
|
|
(``$__object_id``) because it will be used for checksum calculation
|
|
in order to decide if file must be (re-)downloaded.
|
|
|
|
By default type will try to use following locally installed utilities
|
|
for downloading (in order): ``wget``, ``curl`` or ``fetch``.
|
|
|
|
Environment variables like ``{http,https,ftp}_proxy`` etc can be used on
|
|
cdist execution (``http_proxy=foo cdist config ...``).
|
|
|
|
|
|
REQUIRED PARAMETERS
|
|
-------------------
|
|
url
|
|
URL from which to download the file.
|
|
|
|
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:``.
|
|
|
|
onchange
|
|
Execute this command after download.
|
|
|
|
|
|
OPTIONAL PARAMETERS
|
|
-------------------
|
|
cmd-get
|
|
Command used for downloading.
|
|
Command must output to ``stdout``.
|
|
Parameter will be used for ``printf`` and must include only one
|
|
variable ``%s`` which will become URL.
|
|
For example: ``wget -O - '%s'``.
|
|
|
|
cmd-sum
|
|
Command used for checksum calculation.
|
|
Command output and ``--sum`` parameter must match.
|
|
Parameter will be used for ``printf`` and must include only one
|
|
variable ``%s`` which will become destination.
|
|
For example: ``md5sum '%s' | awk '{print $1}'``.
|
|
|
|
|
|
EXAMPLES
|
|
--------
|
|
|
|
.. code-block:: sh
|
|
|
|
__directory /opt/cpma
|
|
|
|
require='__directory/opt/cpma' \
|
|
__download /opt/cpma/cnq3.zip \
|
|
--url https://cdn.playmorepromode.com/files/cnq3/cnq3-1.51.zip \
|
|
--sum md5:46da3021ca9eace277115ec9106c5b46
|
|
|
|
require='__download/opt/cpma/cnq3.zip' \
|
|
__unpack /opt/cpma/cnq3.zip \
|
|
--move-existing-destination \
|
|
--destination /opt/cpma/server
|
|
|
|
|
|
AUTHORS
|
|
-------
|
|
Ander Punnar <ander-at-kvlt-dot-ee>
|
|
|
|
|
|
COPYING
|
|
-------
|
|
Copyright \(C) 2020 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.
|