Merge pull request #121491 from schnusch/oathtoolkit

oathToolkit: 2.6.6 -> 2.6.7

authored by

Sandro and committed by
GitHub
59edafbc a20ef493

+54 -2
+4 -2
pkgs/tools/security/oath-toolkit/default.nix
··· 7 8 in stdenv.mkDerivation rec { 9 pname = "oath-toolkit"; 10 - version = "2.6.6"; 11 12 src = fetchurl { 13 url = "mirror://savannah/${pname}/${pname}-${version}.tar.gz"; 14 - sha256 = "0v4lrgip08b8xlivsfn3mwql3nv8hmcpzrn6pi3xp88vqwav6s7x"; 15 }; 16 17 buildInputs = [ securityDependency ]; 18 19 meta = with lib; { 20 description = "Components for building one-time password authentication systems";
··· 7 8 in stdenv.mkDerivation rec { 9 pname = "oath-toolkit"; 10 + version = "2.6.7"; 11 12 src = fetchurl { 13 url = "mirror://savannah/${pname}/${pname}-${version}.tar.gz"; 14 + sha256 = "1aa620k05lsw3l3slkp2mzma40q3p9wginspn9zk8digiz7dzv9n"; 15 }; 16 17 buildInputs = [ securityDependency ]; 18 + 19 + passthru.updateScript = ./update.sh; 20 21 meta = with lib; { 22 description = "Components for building one-time password authentication systems";
+50
pkgs/tools/security/oath-toolkit/update.sh
···
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -i bash -p curl git gnugrep nix 3 + 4 + set -euo pipefail 5 + 6 + nixfile='default.nix' 7 + release_url='https://download.savannah.nongnu.org/releases/oath-toolkit/' 8 + attr='oathToolkit' 9 + command='oathtool --version' 10 + 11 + color() { 12 + printf '%s: \033[%sm%s\033[39m\n' "$0" "$1" "$2" >&2 || true 13 + } 14 + 15 + color 32 "downloading $release_url..." 16 + if ! release_page=$(curl -Lf "$release_url"); then 17 + color 31 "cannot download release page" 18 + exit 1 19 + fi 20 + 21 + tarball_name=$(printf '%s\n' "$release_page" \ 22 + | grep -Po '(?<=href=").*?\.tar\.gz(?=")' \ 23 + | sort -n | tail -n1) 24 + tarball_version="${tarball_name%.tar.*}" 25 + tarball_version="${tarball_version##*-}" 26 + tarball_url="mirror://savannah${release_url#https://*/releases}$tarball_name" 27 + 28 + color 32 "nix-prefetch-url $tarball_url..." 29 + if ! tarball_sha256=$(nix-prefetch-url --type sha256 "$tarball_url"); then 30 + color 31 "cannot prefetch $tarball_url" 31 + exit 1 32 + fi 33 + 34 + old_version=$(grep -Pom1 '(?<=version = ").*?(?=";)' "$nixfile") 35 + 36 + version=$(printf 'version = "%s";\n' "$tarball_version") 37 + sha256=$(printf 'sha256 = "%s";\n' "$tarball_sha256") 38 + sed -e "s,version = .*,$version," -e "s,sha256 = .*,$sha256," -i "$nixfile" 39 + 40 + if git diff --exit-code "$nixfile" > /dev/stderr; then 41 + printf '\n' >&2 || true 42 + color 32 "$tarball_version is up to date" 43 + else 44 + color 32 "running '$command' with nix-shell..." 45 + nix-shell -p "callPackage ./$nixfile {}" --run "$command" 46 + msg="$attr: $old_version -> $tarball_version" 47 + printf '\n' >&2 || true 48 + color 31 "$msg" 49 + git commit -m "$msg" "$nixfile" 50 + fi