Erwin Boskma
aad8139fdc
Possible values: - alpha (default): The base game - headless: For server use - demo: The Factorio Demo - expansion: Factorio: Space Age expansion
15 lines
445 B
Bash
15 lines
445 B
Bash
# shellcheck shell=bash
|
|
|
|
edition=alpha
|
|
if [[ $# -ge 1 ]]; then
|
|
edition="${1}"
|
|
fi
|
|
|
|
releases_file=$(mktemp --suffix=.json)
|
|
xhs -o "${releases_file}" factorio.com/api/latest-releases
|
|
|
|
version=$(jaq -r '.stable.alpha' "${releases_file}")
|
|
token=$(cat "${FACTORIO_TOKEN_FILE:?}")
|
|
|
|
nix-prefetch-url --name "factorio_${edition}_x64-${version}.tar.xz" \
|
|
"https://factorio.com/get-download/${version}/${edition}/linux64?username=eboskma&token=${token}"
|