package.sh 1.1 KB

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