33 lines
699 B
Bash
33 lines
699 B
Bash
|
#! /usr/bin/env nix-shell
|
||
|
#! nix-shell -i bash -p nix-prefetch-github gnused jq
|
||
|
|
||
|
function help() {
|
||
|
echo "Regenerates packaging data for the fawltydeps package."
|
||
|
echo "Usage: $0 <rev>"
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
if [[ $# -gt 1 || $1 == -* ]]; then
|
||
|
help
|
||
|
fi
|
||
|
|
||
|
set -x
|
||
|
|
||
|
cd "$(dirname "$0")"
|
||
|
version="$1"
|
||
|
|
||
|
set -euo pipefail
|
||
|
|
||
|
if [ -z "$version" ]; then
|
||
|
help
|
||
|
fi
|
||
|
|
||
|
src_hash=$(nix-prefetch-github tweag FawltyDeps --rev "${version}" | jq -r .sha256)
|
||
|
src_hash=$(nix hash to-sri --type sha256 "$src_hash")
|
||
|
|
||
|
sed -i -E -e "s#rev = \".*\"#rev = \"$version\"#" default.nix
|
||
|
sed -i -E -e "s#sha256 = \".*\"#sha256 = \"$src_hash\"#" default.nix
|
||
|
sed -i -E -e "s#version = \".*\"#version = \"$(date +%Y-%m-%d)\"#" default.nix
|
||
|
|
||
|
|