#!/usr/bin/env bash set -xo pipefail apt-get update && apt-get install -y jq curl xz-utils TMP_DIR=$(mktemp -d) pushd ${TMP_DIR} # Install minisign curl -Ls https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz -o - | tar --strip-components 2 -C /usr/local/bin/ -vxzf - minisign-linux/x86_64/minisign # Installing zig, checking its validity mkdir -p /usr/local/bin curl -Ls https://ziglang.org/download/index.json -o zig-versions.json ZIG_SHASUM=".\"${ZIG_VERSION}\".\"x86_64-linux\".shasum" ZIG_TARBALL_URL=".\"${ZIG_VERSION}\".\"x86_64-linux\".tarball" echo "$(jq -r ${ZIG_SHASUM} zig-versions.json) zig.tar.xz" > zig.tar.xz.shasum curl -Ls "$(jq -r ${ZIG_TARBALL_URL} zig-versions.json)" -o zig.tar.xz curl -Ls "$(jq -r ${ZIG_TARBALL_URL} zig-versions.json).minisig" -o zig.tar.xz.minisig sha256sum -c zig.tar.xz.shasum if [ $? -ne 0 ]; then echo "Error in SHA256 hash!" exit 1 else echo "SHA256 hash OK" fi minisign -P 'RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U' -Vm zig.tar.xz if [ $? -ne 0 ]; then echo "Error in signature!" exit 1 else echo "Signature OK" fi tar -C /usr/local/bin --strip-components 1 -xf zig.tar.xz # Installing binstall and zigbuild curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash cargo binstall -y cargo-zigbuild popd rm -rf ${TMP_DIR} apt-get clean rm -rf /var/lib/apt/lists/*