package.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. # $1 - action
  3. # $2 - type of file
  4. action=$1
  5. filetype=$2
  6. do_view_action() {
  7. filetype=$1
  8. case "${filetype}" in
  9. trpm)
  10. rpm -qivl --scripts `basename "${MC_EXT_BASENAME}" .trpm`
  11. ;;
  12. src.rpm|rpm)
  13. if rpm --nosignature --version >/dev/null 2>&1; then
  14. RPM="rpm --nosignature"
  15. else
  16. RPM="rpm"
  17. fi
  18. $RPM -qivlp --scripts "${MC_EXT_FILENAME}"
  19. ;;
  20. deb)
  21. dpkg-deb -I "${MC_EXT_FILENAME}" && echo && dpkg-deb -c "${MC_EXT_FILENAME}"
  22. ;;
  23. debd)
  24. dpkg -s `echo "${MC_EXT_BASENAME}" | sed 's/\([0-9a-z.-]*\).*/\1/'`
  25. ;;
  26. deba)
  27. apt-cache show `echo "${MC_EXT_BASENAME}" | sed 's/\([0-9a-z.-]*\).*/\1/'`
  28. ;;
  29. *)
  30. ;;
  31. esac
  32. }
  33. do_open_action() {
  34. filetype=$1
  35. case "${filetype}" in
  36. *)
  37. ;;
  38. esac
  39. }
  40. case "${action}" in
  41. view)
  42. do_view_action "${filetype}"
  43. ;;
  44. open)
  45. xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \
  46. do_open_action "${filetype}"
  47. ;;
  48. *)
  49. ;;
  50. esac