diff options
Diffstat (limited to 'pkgs/os-specific/linux/kernel/update.sh')
-rwxr-xr-x | pkgs/os-specific/linux/kernel/update.sh | 76 |
1 files changed, 9 insertions, 67 deletions
diff --git a/pkgs/os-specific/linux/kernel/update.sh b/pkgs/os-specific/linux/kernel/update.sh index 4171b7492b7..37e1cc1a5cd 100755 --- a/pkgs/os-specific/linux/kernel/update.sh +++ b/pkgs/os-specific/linux/kernel/update.sh @@ -1,72 +1,14 @@ #!/usr/bin/env bash -set -e +cd "$(dirname "$(readlink -f "$0")")" || exit -# Get the latest versions from kernel.org -LINUXSED='s/.*linux-\([0-9]\+\(.[0-9]\+\)*\).*/\1/p' -KDATA="$(curl -s https://www.kernel.org | sed -n -e '/Download complete/p')" -VERSIONS=($(sed -n -e $LINUXSED <<< "$KDATA" | sort -Vr)) +echo "Update linux (mainline)" +COMMIT=1 ./update-mainline.py || echo "update-mainline failed with exit code $?" -# Remove mainline version if there is a stable update -# Note due to sorting these two will always exist at the bottom -if grep -q "^${VERSIONS[1]}" <<< "${VERSIONS[0]}"; then - VERSIONS=(${VERSIONS[@]:0:1} ${VERSIONS[@]:2}) -fi +echo "Update linux-rt" +COMMIT=1 ./update-rt.sh || echo "update-rt failed with exit code $?" -# Inspect each file and see if it has the latest version -NIXPKGS="$(git rev-parse --show-toplevel)" -ls $NIXPKGS/pkgs/os-specific/linux/kernel | while read FILE; do - KERNEL="$(sed -n -e $LINUXSED <<< "$FILE")" - [ -z "$KERNEL" ] && continue +echo "Update linux-libre" +COMMIT=1 ./update-libre.sh || echo "update-libre failed with exit code $?" - # Find the matching new kernel version - MATCHING="" - for V in "${VERSIONS[@]}"; do - if grep -q "^$KERNEL" <<< "$V"; then - MATCHING="$V" - break - fi - done - if [ -z "$MATCHING" ]; then - echo "Out-of-support $KERNEL" - continue - fi - - # Inspect the nix expression to check for changes - DATA="$(<$NIXPKGS/pkgs/os-specific/linux/kernel/$FILE)" - URL="$(sed -n -e 's/.*url = "\(.*\)";.*/\1/p' <<< "$DATA" | sed -e "s/\${version}/$MATCHING/g")" - OLDVER=$(sed -n -e 's/.*version = "\(.*\)".*/\1/p' <<< "$DATA") - if [ "$OLDVER" = "$V" ]; then - echo "No updates for $KERNEL" - continue - fi - - # Download the new file for the hash - if ! HASH="$(nix-prefetch-url $URL 2>/dev/null)"; then - echo "Failed to get hash of $URL" - continue - fi - sed -i -e "s/sha256 = \".*\"/sha256 = \"$HASH\"/g" $NIXPKGS/pkgs/os-specific/linux/kernel/$FILE - - # Rewrite the expression - sed -i -e '/version = /d' $NIXPKGS/pkgs/os-specific/linux/kernel/$FILE - sed -i -e "\#buildLinux (args // rec {#a \ version = \"$V\";" $NIXPKGS/pkgs/os-specific/linux/kernel/$FILE - - # Commit the changes - git add -u $NIXPKGS/pkgs/os-specific/linux/kernel/$FILE - git commit -m "linux: $OLDVER -> $V" >/dev/null 2>&1 - - echo "Updated $OLDVER -> $V" -done - -# Allowing errors again: one broken update script shouldn't inhibit the -# update of other kernel variants. -set +e - -echo Update linux-rt -COMMIT=1 $NIXPKGS/pkgs/os-specific/linux/kernel/update-rt.sh || echo "update-rt failed with exit code $?" - -echo Update linux-libre -COMMIT=1 $NIXPKGS/pkgs/os-specific/linux/kernel/update-libre.sh || echo "update-libre failed with exit code $?" - -echo Update linux-hardened -COMMIT=1 $NIXPKGS/pkgs/os-specific/linux/kernel/hardened/update.py || echo "update-hardened failed with exit code $?" +echo "Update linux-hardened" +COMMIT=1 ./hardened/update.py || echo "update-hardened failed with exit code $?" |