1CDIST-TYPE__DOWNLOAD(7)              cdist             CDIST-TYPE__DOWNLOAD(7)
2
3
4

NAME

6       cdist-type__download - Download a file
7

DESCRIPTION

9       By  default type will try to use curl, fetch or wget.  If download hap‐
10       pens in target (see --download) then type will  fallback  to  (and  in‐
11       stall) wget.
12
13       If  download  happens in local machine, then environment variables like
14       {http,https,ftp}_proxy   etc   can   be   used   on   cdist   execution
15       (http_proxy=foo cdist config ...).
16
17       To  change  downloaded  file's  owner,  group  or  permissions, use re‐
18       quire='__download/path/to/file' __file ....
19

REQUIRED PARAMETERS

21       url    File's URL.
22

OPTIONAL PARAMETERS

24       destination
25              Downloaded file's destination in target. If unset,  $__object_id
26              is used.
27
28       sum    Supported formats: cksum output without file name, MD5, SHA1 and
29              SHA256.
30
31              Type tries to detect hash format with regexes, but prefixes  ck‐
32              sum:, md5:, sha1: and sha256: are also supported.
33
34              Checksum have two purposes - state check and post-download veri‐
35              fication.  In state check, if destination  checksum  mismatches,
36              then  content  of  URL  will be downloaded to temporary file. If
37              downloaded temporary file's checksum matches, then  it  will  be
38              moved to destination (overwritten).
39
40              For  local  downloads  it  is expected that usable utilities for
41              checksum calculation exist in the system.
42
43       download
44              If local (default), then file is downloaded to local storage and
45              copied  to target host. If remote, then download happens in tar‐
46              get.
47
48              For local downloads it is expected  that  usable  utilities  for
49              downloading  exist  in  the  system.  Type will try to use curl,
50              fetch or wget.
51
52       cmd-get
53              Command used for downloading.  Command must  output  to  stdout.
54              Parameter will be used for printf and must include only one for‐
55              mat specification %s which will become URL.  For  example:  wget
56              -O - '%s'.
57
58       cmd-sum
59              Command used for checksum calculation.  Command output and --sum
60              parameter must match.  Parameter will be  used  for  printf  and
61              must  include only one format specification %s which will become
62              destination.  For example: md5sum '%s' | awk '{print $1}'.
63
64       onchange
65              Execute this command after download.
66

EXAMPLES

68          __directory /opt/cpma
69
70          require='__directory/opt/cpma' \
71              __download /opt/cpma/cnq3.zip \
72                  --url https://cdn.playmorepromode.com/files/cnq3/cnq3-1.51.zip \
73                  --sum 46da3021ca9eace277115ec9106c5b46
74
75          require='__download/opt/cpma/cnq3.zip' \
76              __unpack /opt/cpma/cnq3.zip \
77                  --backup-destination \
78                  --preserve-archive \
79                  --destination /opt/cpma/server
80

AUTHORS

82       Ander Punnar <ander-at-kvlt-dot-ee>
83

COPYING

85       Copyright (C) 2021 Ander Punnar. You can redistribute it and/or  modify
86       it  under  the  terms of the GNU General Public License as published by
87       the Free Software Foundation, either version 3 of the License,  or  (at
88       your option) any later version.
89
91       ungleich GmbH 2021
92
93
94
95
967.0.0                            Jul 31, 2022          CDIST-TYPE__DOWNLOAD(7)
Impressum