2020-06-14 08:07:18 +00:00
|
|
|
cdist-type__download(7)
|
|
|
|
=======================
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2020-06-28 13:38:15 +00:00
|
|
|
cdist-type__download - Download a file
|
2020-06-14 08:07:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2020-06-28 13:43:45 +00:00
|
|
|
Destination (``$__object_id``) in target host must be persistent storage
|
|
|
|
in order to calculate checksum and decide if file must be (re-)downloaded.
|
2020-06-20 22:13:30 +00:00
|
|
|
|
2020-06-28 13:43:45 +00:00
|
|
|
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``.
|
2020-06-20 22:13:30 +00:00
|
|
|
|
2020-06-28 13:43:45 +00:00
|
|
|
If download happens in local machine, then environment variables like
|
2020-06-28 13:38:15 +00:00
|
|
|
``{http,https,ftp}_proxy`` etc can be used on cdist execution
|
|
|
|
(``http_proxy=foo cdist config ...``).
|
2020-06-14 08:07:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
REQUIRED PARAMETERS
|
|
|
|
-------------------
|
|
|
|
url
|
2020-06-28 13:38:15 +00:00
|
|
|
File's URL.
|
2020-06-14 08:07:18 +00:00
|
|
|
|
|
|
|
sum
|
2020-06-20 22:13:30 +00:00
|
|
|
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:``.
|
|
|
|
|
2020-06-14 08:07:18 +00:00
|
|
|
|
|
|
|
OPTIONAL PARAMETERS
|
|
|
|
-------------------
|
2020-06-28 13:38:15 +00:00
|
|
|
download
|
|
|
|
If ``local`` (default), then download file to local storage and copy
|
|
|
|
it to target host. If ``remote``, then download happens in target.
|
|
|
|
|
2020-06-14 08:07:18 +00:00
|
|
|
cmd-get
|
|
|
|
Command used for downloading.
|
|
|
|
Command must output to ``stdout``.
|
2020-06-20 22:13:30 +00:00
|
|
|
Parameter will be used for ``printf`` and must include only one
|
2020-07-07 21:20:55 +00:00
|
|
|
format specification ``%s`` which will become URL.
|
2020-06-20 22:13:30 +00:00
|
|
|
For example: ``wget -O - '%s'``.
|
2020-06-14 08:07:18 +00:00
|
|
|
|
|
|
|
cmd-sum
|
|
|
|
Command used for checksum calculation.
|
|
|
|
Command output and ``--sum`` parameter must match.
|
2020-06-20 22:13:30 +00:00
|
|
|
Parameter will be used for ``printf`` and must include only one
|
2020-07-07 21:20:55 +00:00
|
|
|
format specification ``%s`` which will become destination.
|
2020-06-20 22:13:30 +00:00
|
|
|
For example: ``md5sum '%s' | awk '{print $1}'``.
|
2020-06-14 08:07:18 +00:00
|
|
|
|
2020-08-17 21:48:58 +00:00
|
|
|
onchange
|
|
|
|
Execute this command after download.
|
|
|
|
|
2020-06-14 08:07:18 +00:00
|
|
|
|
|
|
|
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 \
|
2020-06-20 22:13:30 +00:00
|
|
|
--sum md5:46da3021ca9eace277115ec9106c5b46
|
2020-06-14 08:07:18 +00:00
|
|
|
|
|
|
|
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.
|