DEV Community

António Meireles
António Meireles

Posted on • Updated on

easily track Clear Linux releases from your shell

  • running Clear Linux, with swupd's auto-updates disabled ?
  • wanting to know what's going on before updating or just curious ?
  • want to save time and avoid browsing the releases web page ?

if yes to all the above that then just add to your .bashrc (or .zshrc) the following snippet:

function clr-releases {
  TAIL=${TAIL:-10}
  upstream="https://download.clearlinux.org"
  latest=$(curl -Ls ${upstream}/latest)
  last=()

  while IFS='' read -r line; do
    last+=("${line}")
  done < <(curl -Ls ${upstream}/releases | sed -e 's/<[^>]*>//g' | \
           awk '/^[0-9]/ {print gensub(/\//,"",1,$1)"_"$2"_"$3}' | \
           sort -hk1 -t _ | tail -n "${TAIL}")

  for r in "${last[@]}"; do
    [[ "${r}" == ^${latest}* ]] && echo "${r//_/ }" || echo "${r//_/ } (current)"
  done
}

function clr-log {
  upstream="https://download.clearlinux.org"
  [ -z "$1" ] && rev=current || rev=$1
  {
    [[ ${rev} != "current" ]] && printf "=> current is %s\n" "$(curl -Ls ${upstream}/latest)"
    curl -Ls "${upstream}/releases/${rev}/clear/RELEASENOTES" && echo
  } | less
}

clr-releases will display, by default, the last 10 published releases (can be tweaked via the TAIL env variable)

clr-log will display the changelog of the current ClearLinux release if no argument is supplied or the one of the supplied release number

Top comments (0)