lsupgrade.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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'/`luasrc' directories represent the whole image filesystem (which are all Gluon packages)
  5. SUFFIX1=files/lib/gluon/upgrade
  6. SUFFIX2=luasrc/lib/gluon/upgrade
  7. shopt -s nullglob
  8. if tty -s <&1; then
  9. RED="$(echo -e '\x1b[01;31m')"
  10. GREEN="$(echo -e '\x1b[01;32m')"
  11. BLUE="$(echo -e '\x1b[01;34m')"
  12. RESET="$(echo -e '\x1b[0m')"
  13. else
  14. RED=
  15. GREEN=
  16. BLUE=
  17. RESET=
  18. fi
  19. pushd "$(dirname "$0")/.." >/dev/null
  20. find ./package packages -name Makefile | while read makefile; do
  21. dir="$(dirname "$makefile")"
  22. pushd "$dir" >/dev/null
  23. repo="$(dirname "$dir" | cut -d/ -f 2)"
  24. dirname="$(dirname "$dir" | cut -d/ -f 3-)"
  25. package="$(basename "$dir")"
  26. for file in "${SUFFIX1}"/*; do
  27. echo "${GREEN}$(basename "${file}")${RESET}" "(${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${SUFFIX1})"
  28. done
  29. for file in "${SUFFIX2}"/*; do
  30. echo "${GREEN}$(basename "${file}")${RESET}" "(${BLUE}${repo}${RESET}/${dirname}${dirname:+/}${RED}${package}${RESET}/${SUFFIX2})"
  31. done
  32. popd >/dev/null
  33. done | sort
  34. popd >/dev/null