at master 1.6 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p curl gnused jq common-updater-scripts 3 4set -euo pipefail 5 6current_version=$(nix-instantiate --eval -E "with import ./. {}; libcef.version or (lib.getVersion libcef)" | tr -d '"') 7 8ROOT="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" 9 10version_json=$(curl --silent https://cef-builds.spotifycdn.com/index.json | jq '[.linux64.versions[] | select (.channel == "stable")][0]') 11cef_version=$(echo "$version_json" | jq -r '.cef_version' | cut -d'+' -f1) 12git_revision=$(echo "$version_json" | jq -r '.cef_version' | cut -d'+' -f2 | cut -c 2-) 13chromium_version=$(echo "$version_json" | jq -r '.chromium_version') 14 15echo "Latest version: $cef_version" 16echo "Current version: $current_version" 17 18if [[ "$cef_version" == "$current_version" ]]; then 19 echo "Package is up-to-date" 20 exit 0 21fi 22 23update_nix_value() { 24 local key="$1" 25 local value="${2:-}" 26 sed -i "s|$key = \".*\"|$key = \"$value\"|" $ROOT/default.nix 27} 28 29update_nix_value version "$cef_version" 30update_nix_value gitRevision "$git_revision" 31update_nix_value chromiumVersion "$chromium_version" 32 33declare -a platforms=( 34 "x86_64-linux 64" 35 "aarch64-linux arm64" 36) 37 38for platform in "${platforms[@]}"; do 39 read -r system arch <<< "$platform" 40 url="https://cef-builds.spotifycdn.com/cef_binary_${cef_version}+g${git_revision}+chromium-${chromium_version}_linux${arch}_minimal.tar.bz2" 41 hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 "$(nix-prefetch-url --quiet "$url")") 42 update-source-version libcef "$cef_version" "$hash" --system="$system" --ignore-same-version 43done