rpm_versions.sh 575 B

123456789101112
  1. #!/bin/bash
  2. if [ `which dnf 2> /dev/null` ]; then
  3. installed=$(dnf repoquery --installed --latest-limit 1 -d 0 --qf '%{version}-%{release}' "${@}" 2> /dev/null)
  4. installed=$(dnf repoquery --available --latest-limit 1 -d 0 --qf '%{version}-%{release}' "${@}" 2> /dev/null)
  5. else
  6. installed=$(repoquery --plugins --pkgnarrow=installed --qf '%{version}-%{release}' "${@}" 2> /dev/null)
  7. available=$(repoquery --plugins --pkgnarrow=available --qf '%{version}-%{release}' "${@}" 2> /dev/null)
  8. fi
  9. echo "---"
  10. echo "curr_version: ${installed}"
  11. echo "avail_version: ${available}"