CDIST-TYPE__DOWNLOAD(7)

πŸ’– cdist-type__download πŸ’–

okay so bestie, welcome to cdist-type__download(7) β€” the manual page for the cdist type that downloads a file. that's it, that's the whole vibe, and it slays. πŸ¦‹


✨ DESCRIPTION ✨

by default the type is gonna try to use curl, fetch or wget. like, it'll figure it out. πŸ’…

if the download happens in the target (peep --download), then the type falls back to wget β€” and installs it, no cap. πŸ‘‘

if the download happens on the local machine, then environment variables like {http,https,ftp}_proxy and friends can be used when cdist runs. for example:

http_proxy=foo cdist config ...

lowkey so handy. 🫢

and hmm, want to change the downloaded file's owner, group or permissions? then do this:

require='__download/path/to/file' __file ....

periodt. 🌸


πŸ”₯ REQUIRED PARAMETERS πŸ”₯

  • url β€” the file's URL. you literally cannot skip this one bestie, it's giving mandatory. 😭

πŸ’… OPTIONAL PARAMETERS πŸ’…

  • destination β€” where the downloaded file goes in the target. if you don't set it, $__object_id gets used instead. πŸŽ€
  • sum β€” the checksum. supported formats: cksum output without the file name, plus MD5, SHA1 and SHA256.

the type tries to detect the hash format with regexes, but the prefixes cksum:, md5:, sha1: and sha256: are supported too. 🧚

checksums have two purposes, bestie β€” state check and post-download verification. in the state check, if the destination checksum mismatches, then the content of the URL gets downloaded to a temporary file. if the downloaded temporary file's checksum matches, then it gets moved to destination (overwritten). iconic behaviour honestly. ✨

for local downloads it is expected that usable utilities for checksum calculation exist in the system. so like, have those ready. πŸ™ˆ

  • download β€” if local (which is the default), then the file is downloaded to local storage and copied to the target host. if remote, then the download happens in the target. 🌈

for local downloads it is expected that usable utilities for downloading exist in the system. the type will try to use curl, fetch or wget. 🫑

  • cmd-get β€” the command used for downloading. the command must output to stdout. this parameter will be used for printf and must include only one format specification %s, which becomes the URL. for example:
wget -O - '%s'

πŸ’œ

  • cmd-sum β€” the command used for checksum calculation. the command output and the --sum parameter must match. this parameter will be used for printf and must include only one format specification %s, which becomes the destination. for example:
md5sum '%s' | awk '{print $1}'

⭐

  • onchange β€” execute this command after download. that's the whole thing. go off. πŸ”₯

🌟 EXAMPLES 🌟

__directory /opt/cpma

require='__directory/opt/cpma' \
    __download /opt/cpma/cnq3.zip \
        --url https://cdn.playmorepromode.com/files/cnq3/cnq3-1.51.zip \
        --sum 46da3021ca9eace277115ec9106c5b46

require='__download/opt/cpma/cnq3.zip' \
    __unpack /opt/cpma/cnq3.zip \
        --backup-destination \
        --preserve-archive \
        --destination /opt/cpma/server

look at that. clean. immaculate. no notes. πŸ‘‘


πŸŽ€ AUTHORS πŸŽ€

Ander Punnar <ander-at-kvlt-dot-ee> β€” thank you for your service bestie 🫢


πŸ“œ COPYING πŸ“œ

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. 🌈


ungleich GmbH 2021


and that's the whole page, bestie!! πŸ’– this is version 7.0.0, dated Jul 31, 2022, and it lives in the cdist manual, section 7. go download something cute. bye!! πŸ¦‹βœ¨

πŸ“¦ where this page comes from