Merge branch '3678_hardlink_error'
[midnight-commander.git] / misc / ext.d / package.sh
blobfc1aa1f1df7e2702a57d7320630adb8a3927e9aa
1 #!/bin/sh
3 # $1 - action
4 # $2 - type of file
6 action=$1
7 filetype=$2
9 [ -n "${MC_XDG_OPEN}" ] || MC_XDG_OPEN="xdg-open"
11 do_view_action() {
12 filetype=$1
14 case "${filetype}" in
15 trpm)
16 rpm -qivl --scripts `basename "${MC_EXT_BASENAME}" .trpm`
18 src.rpm|rpm)
19 if rpm --nosignature --version >/dev/null 2>&1; then
20 RPM="rpm --nosignature"
21 else
22 RPM="rpm"
24 $RPM -qivlp --scripts "${MC_EXT_FILENAME}"
26 deb)
27 dpkg-deb -I "${MC_EXT_FILENAME}" && echo && dpkg-deb -c "${MC_EXT_FILENAME}"
29 debd)
30 dpkg -s `echo "${MC_EXT_BASENAME}" | sed 's/\([0-9a-z.-]*\).*/\1/'`
32 deba)
33 apt-cache show `echo "${MC_EXT_BASENAME}" | sed 's/\([0-9a-z.-]*\).*/\1/'`
37 esac
40 do_open_action() {
41 filetype=$1
43 case "${filetype}" in
46 esac
49 case "${action}" in
50 view)
51 do_view_action "${filetype}"
53 open)
54 ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \
55 do_open_action "${filetype}"
59 esac