fetch-file
Declares one file downloaded to a destination where nothing is.
[[actions]]
type = "fetch-file"
id = "pathogen"
source = "https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim"
dest = "~/.vim/autoload/pathogen.vim"
| Field | Type | Required | Description |
|---|---|---|---|
source | template string | yes | An http://, https://, or file:// URL. Not a repository path. |
dest | template string | yes | Where the file goes, exactly. Never empty; ~ is the home. |
sha256 | template string | no | 64 hexadecimal digits: the digest the fetched bytes must have. |
executable | boolean | no | Whether the file lands executable. Defaults to false. |
decompress | boolean | no | Whether the download is a gzip or bzip2 stream holding the file. Defaults to false. |
The shared transfer,
seed,
staging, and
permission rules apply. An occupied
destination costs no transfer unless refresh is
requested. On Unix, executable installs the file 0755 rather than 0644.
Without decompress, downloaded bytes are installed unchanged, including any
archive. With it, gzip or bzip2 compression is detected from the leading bytes,
including concatenated streams, and the decompressed file is installed, as a
release publishing tool-linux.gz intends:
[[actions]]
type = "fetch-file"
source = "https://example.com/tool-linux.gz"
dest = "~/.local/bin/tool"
decompress = true
executable = true
Uncompressed data, a zip, or content that decompresses to a tar fails; use
fetch-archive for archives. sha256 checks the downloaded bytes before
decompression.
With templates, one record can fetch each machine’s build:
[[actions]]
type = "fetch-file"
source = "https://example.com/releases/tool-${facts.os}-${facts.arch}.gz"
dest = "~/.local/bin/tool"
decompress = true
executable = true
See common action fields for id, group, and
conditions.