Advertisement
rockdrilla

get Linux kernel changelog for specific version

Feb 24th, 2014
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. #!/bin/bash
  2. get_kernel_changelog() {
  3. [ -z "$1" ] && return 1
  4. U=https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-$1
  5. curl -qsI $U &>/dev/null || return 2
  6. curl -q $U \
  7. | sed -nre '/^commit/,/^    [^ ]/{s#^commit (.{,8}).*$#C|\1#;s#^    (.*)$#T|\1#;s#^Date: +(.+) +(.+) +(.+) +(.+) +(.+) +(.+)$#D|\3 \2 \5 \4 \6#;/^[CDT]\|(.*)$/{s##\1#;p}}' \
  8. | while readarray -n 3 -t; do
  9.     [ ${#MAPFILE[@]} -ne 3 ] && break
  10.     C=${MAPFILE[0]}
  11.     D=$(LC_ALL=C date -u +%s -d "${MAPFILE[1]}")
  12.     T=${MAPFILE[2]}
  13.     printf '%s [%s] %s\n' $D $C "$T"
  14.     done \
  15. | sed -re '1s#^([0-9]+)#9999999999#' \
  16. | sort -r -n \
  17. | sed -re '1{s#^[^ ]+ (.*)$#\1#};{s#^[^ ]+ (.*)$#\1#}'
  18. }
  19. get_kernel_changelog "$@"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement