lsupgrade.sh 951 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # Script to list all upgrade scripts in a clear manner
  3. # Limitations:
  4. # * Does only show scripts of packages whose `files' directory represent the whole image filesystem (which are all Gluon packages)
  5. SUFFIX=files/lib/gluon/upgrade
  6. shopt -s nullglob
  7. if tty -s <&1; then
  8. RED="$(echo -e '\x1b[01;31m')"
  9. GREEN="$(echo -e '\x1b[01;32m')"
  10. BLUE="$(echo -e '\x1b[01;34m')"
  11. RESET="$(echo -e '\x1b[0m')"
  12. else
  13. RED=
  14. GREEN=
  15. BLUE=
  16. RESET=
  17. fi
  18. pushd "$(dirname "$0")/.." >/dev/null
  19. find ./package packages -name Makefile | while read makefile; do
  20. dir="$(dirname "$makefile")"
  21. pushd "$dir" >/dev/null
  22. repo="$(dirname "$dir" | cut -d/ -f 2)"
  23. dirname="$(dirname "$dir" | cut -d/ -f 3-)"
  24. package="$(basename "$dir")"
  25. for file in "${SUFFIX}"/*; do
  26. echo "${GREEN}$(basename "${file}")${RESET}" "(${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${SUFFIX})"
  27. done
  28. popd >/dev/null
  29. done | sort
  30. popd >/dev/null