nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p bash curl coreutils jq common-updater-scripts
3
4latestTag=$(curl -sSfL ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} https://api.github.com/repos/cloud-fs/cloud-fs.github.io/releases/latest | jq -r ".tag_name")
5latestVersion="$(expr "$latestTag" : 'v\(.*\)')"
6currentVersion=$(nix-instantiate --eval -E "with import ./. {}; clouddrive2.version" | tr -d '"')
7
8echo "latest version: $latestVersion"
9echo "current version: $currentVersion"
10
11if [[ "$latestVersion" == "$currentVersion" ]]; then
12 echo "package is up-to-date"
13 exit 0
14fi
15for i in \
16 "x86_64-linux linux-x86_64" \
17 "aarch64-linux linux-aarch64" \
18 "x86_64-darwin macos-x86_64" \
19 "aarch64-darwin macos-aarch64"; do
20 set -- $i
21 prefetch=$(nix-prefetch-url "https://github.com/cloud-fs/cloud-fs.github.io/releases/download/v$latestVersion/clouddrive-2-$2-$latestVersion.tgz")
22 hash=$(nix-hash --type sha256 --to-sri $prefetch)
23
24 update-source-version clouddrive2 $latestVersion $hash --system=$1 --ignore-same-version
25done