epm-info 1.92 KB
Newer Older
1 2 3 4 5
#!/bin/sh
#
# Copyright (C) 2012  Etersoft
# Copyright (C) 2012  Vitaly Lipatov <lav@etersoft.ru>
#
6 7 8
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
9 10 11 12 13
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
15
#
16 17
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18 19
#

20 21
load_helper epm-query

22 23 24 25 26 27
__epm_info_rpm_low()
{
	if [ -n "$pkg_files" ] ; then
		docmd rpm -qip $pkg_files
	fi
	[ -z "$pkg_names" ] && return
28
	is_installed $pkg_names && docmd rpm -qi $pkg_names && return
29 30
}

31 32 33
epm_info()
{
case $PMTYPE in
34
	apt-rpm)
35
		__epm_info_rpm_low && return
36 37 38
		docmd apt-cache show $pkg_names
		;;
	apt-dpkg)
39 40 41
		if [ -n "$pkg_files" ] ; then
			docmd dpkg -I $pkg_files
		fi
42
		[ -z "$pkg_names" ] && return
43
		is_installed $pkg_names && docmd dpkg -p $pkg_names && return
44
		docmd apt-cache show $pkg_names
45 46
		;;
	yum-rpm)
47
		__epm_info_rpm_low && return
48
		docmd yum info $pkg_names
49
		;;
50 51 52 53
	dnf-rpm)
		__epm_info_rpm_low && return
		docmd dnf info $pkg_names
		;;
54
	zypper-rpm)
55
		__epm_info_rpm_low && return
56 57 58
		docmd zypper info $pkg_names
		;;
	pacman)
59
		is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
60
		docmd pacman -Si $pkg_names
61
		;;
62 63 64 65
	aura)
		is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
		docmd aura -Ai $pkg_names
		;;
66 67 68 69
	npackd)
		# FIXME: --version=
		docmd npackdcl info --package=$pkg_names
		;;
70
	slackpkg)
71
		docmd /usr/sbin/slackpkg info $pkg_names
72
		;;
73 74 75
	ipkg)
		docmd ipkg info $pkg_names
		;;
76
	*)
77
		fatal "Have no suitable command for $PMTYPE"
78 79 80 81
		;;
esac

}