2019-12-16 04:25:42 +00:00
|
|
|
#! /usr/bin/env nix-shell
|
|
|
|
#! nix-shell -i bash -p nix-prefetch-svn git curl
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
|
|
path="$nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix"
|
|
|
|
|
|
|
|
old_rev="$(grep -o 'rev = ".*"' "$path" | awk -F'"' '{print $2}')"
|
2020-01-13 13:43:55 +00:00
|
|
|
old_sha256="$(grep -o 'sha256 = ".*"' "$path" | awk -F'"' '{print $2}')"
|
2019-12-16 04:25:42 +00:00
|
|
|
|
|
|
|
svn_url=https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/branches/
|
|
|
|
rev="$(curl -s "$svn_url" | grep -Em 1 -o 'Revision [0-9]+' | awk '{print $2}')"
|
|
|
|
|
|
|
|
if [ "$old_rev" = "$rev" ]; then
|
|
|
|
echo "No updates for linux-libre"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
sha256="$(QUIET=1 nix-prefetch-svn "$svn_url" "$rev" | tail -1)"
|
|
|
|
|
2020-01-13 13:43:55 +00:00
|
|
|
if [ "$old_sha256" = "$sha256" ]; then
|
|
|
|
echo "No updates for linux-libre"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-12-16 04:25:42 +00:00
|
|
|
sed -i -e "s/rev = \".*\"/rev = \"$rev\"/" \
|
|
|
|
-e "s/sha256 = \".*\"/sha256 = \"$sha256\"/" "$path"
|
|
|
|
|
2020-01-13 13:42:13 +00:00
|
|
|
if [ -n "${COMMIT-}" ]; then
|
2020-01-13 13:45:40 +00:00
|
|
|
git commit -qm "linux_latest-libre: $old_rev -> $rev" "$path" \
|
|
|
|
$nixpkgs/pkgs/os-specific/linux/kernel/linux-libre.nix
|
2019-12-16 16:35:53 +00:00
|
|
|
echo "Updated linux_latest-libre $old_rev -> $rev"
|
2019-12-16 04:25:42 +00:00
|
|
|
fi
|