linux_zen: add update script

+21
+21
pkgs/os-specific/linux/kernel/update-zen.sh
··· 1 + #! /usr/bin/env nix-shell 2 + #! nix-shell -I nixpkgs=../../../.. -i bash -p nix-prefetch git gnused gnugrep nix curl 3 + set -euo pipefail -x 4 + 5 + nixpkgs="$(git rev-parse --show-toplevel)" 6 + old=$(nix-instantiate --eval -A linuxPackages_zen.kernel.modDirVersion "$nixpkgs") 7 + old="${old%\"}" 8 + old="${old#\"}" 9 + new=$(curl https://github.com/zen-kernel/zen-kernel/releases.atom | grep -m1 -o -E '[0-9.]+-zen[0-9]+') 10 + if [[ "$new" == "$old" ]]; then 11 + echo "already up-to-date" 12 + exit 0 13 + fi 14 + 15 + path="$nixpkgs/pkgs/os-specific/linux/kernel/linux-zen.nix" 16 + 17 + sed -i -e "s!modDirVersion = \".*\"!modDirVersion = \"${new}\"!" "$path" 18 + checksum=$(nix-prefetch "(import ${nixpkgs} {}).linuxPackages_zen.kernel") 19 + sed -i -e "s!sha256 = \".*\"!sha256 = \"${checksum}\"!" "$path" 20 + 21 + git commit -m "linux_zen: ${old} -> ${new}" $path