mc/misc/ext.d/package.sh
Slava Zanko ec7aafef83 Use xdg-open by default in mc.ext.in if present to open files,
fallback on current scheme otherwise.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-05-18 13:06:20 +03:00

60 lines
1.0 KiB
Bash

#!/bin/sh
# $1 - action
# $2 - type of file
action=$1
filetype=$2
do_view_action() {
filetype=$1
filename=$2
case "${filetype}" in
trpm)
rpm -qivl --scripts `basename "${MC_EXT_BASENAME}" .trpm`
;;
src.rpm|rpm)
if rpm --nosignature --version >/dev/null 2>&1; then
RPM="rpm --nosignature"
else
RPM="rpm"
fi
$RPM -qivlp --scripts "${MC_EXT_FILENAME}"
;;
deb)
dpkg-deb -I "${filename}" && echo && dpkg-deb -c "${MC_EXT_FILENAME}"
;;
debd)
dpkg -s `echo "${MC_EXT_BASENAME}" | sed 's/\([0-9a-z.-]*\).*/\1/'`
;;
deba)
apt-cache show `echo "${MC_EXT_BASENAME}" | sed 's/\([0-9a-z.-]*\).*/\1/'`
;;
*)
;;
esac
}
do_open_action() {
filetype=$1
case "${filetype}" in
*)
;;
esac
}
case "${action}" in
view)
do_view_action "${filetype}"
;;
open)
xdg-open "${MC_EXT_FILENAME}" 2>/dev/null || \
do_open_action "${filetype}"
;;
*)
;;
esac