Merge pull request #233650 from K900/linux-firmware-update-script-cleanups
linux-firmware: allow passing ref to update-script
This commit is contained in:
commit
8fbdc4e611
|
@ -2,19 +2,24 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd "$(dirname "$(readlink -f "$0")")" || exit
|
cd "$(dirname "$(readlink -f "$0")")" || exit
|
||||||
|
|
||||||
# step 1: figure out the latest version from the tags
|
|
||||||
repo="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
|
repo="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
|
||||||
latestTag="$(git ls-remote --refs --tags --sort refname "$repo" | tail -n1 | cut -f2 | cut -d '/' -f3)"
|
|
||||||
|
# step 1: figure out the latest version from the tags
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
version="$(git ls-remote --refs --tags --sort refname "$repo" | tail -n1 | cut -f2 | cut -d '/' -f3)"
|
||||||
|
else
|
||||||
|
version=$1
|
||||||
|
fi
|
||||||
|
|
||||||
# step 2: prefetch the source tarball
|
# step 2: prefetch the source tarball
|
||||||
snapshotUrl="$repo/snapshot/linux-firmware-$latestTag.tar.gz"
|
snapshotUrl="$repo/snapshot/linux-firmware-$version.tar.gz"
|
||||||
hash="$(nix-prefetch-url --unpack "$snapshotUrl")"
|
hash="$(nix-prefetch-url --unpack "$snapshotUrl")"
|
||||||
sriHash="$(nix --experimental-features nix-command hash to-sri "sha256:$hash")"
|
sriHash="$(nix --experimental-features nix-command hash to-sri "sha256:$hash")"
|
||||||
|
|
||||||
# step 3: rebuild as a non-FO derivation to get the right hash
|
# step 3: rebuild as a non-FO derivation to get the right hash
|
||||||
cat > source.nix << EOF
|
cat > source.nix << EOF
|
||||||
{
|
{
|
||||||
version = "$latestTag";
|
version = "$version";
|
||||||
sourceHash = "$sriHash";
|
sourceHash = "$sriHash";
|
||||||
outputHash = null;
|
outputHash = null;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +32,7 @@ outHash="$(nix --experimental-features nix-command hash path "$outPath")"
|
||||||
cat > source.nix << EOF
|
cat > source.nix << EOF
|
||||||
# This file is autogenerated! Run ./update.sh to regenerate.
|
# This file is autogenerated! Run ./update.sh to regenerate.
|
||||||
{
|
{
|
||||||
version = "$latestTag";
|
version = "$version";
|
||||||
sourceHash = "$sriHash";
|
sourceHash = "$sriHash";
|
||||||
outputHash = "$outHash";
|
outputHash = "$outHash";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue