epm-info 2.8 KB
Newer Older
1 2
#!/bin/sh
#
3 4
# Copyright (C) 2012, 2014, 2016  Etersoft
# Copyright (C) 2012, 2014, 2016  Vitaly Lipatov <lav@etersoft.ru>
5
#
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
# TODO: separate to _files and _names parts
Vitaly Lipatov's avatar
Vitaly Lipatov committed
32
# realize _files part per package, not by PMTYPE (see filelist)
33 34
epm_info()
{
Vitaly Lipatov's avatar
Vitaly Lipatov committed
35

Vitaly Lipatov's avatar
Vitaly Lipatov committed
36
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
37

38
case $PMTYPE in
39
	apt-rpm)
40
		__epm_info_rpm_low && return
41 42 43
		docmd apt-cache show $pkg_names
		;;
	apt-dpkg)
44 45 46
		if [ -n "$pkg_files" ] ; then
			docmd dpkg -I $pkg_files
		fi
47
		[ -z "$pkg_names" ] && return
48
		is_installed $pkg_names && docmd dpkg -p $pkg_names && return
49
		docmd apt-cache show $pkg_names
50
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
51 52 53 54 55 56 57
	aptitude-dpkg)
		if [ -n "$pkg_files" ] ; then
			docmd dpkg -I $pkg_files
		fi
		[ -z "$pkg_names" ] && return
		docmd aptitude show $pkg_names
		;;
58
	yum-rpm)
59
		__epm_info_rpm_low && return
60
		docmd yum info $pkg_names
61
		;;
62 63 64 65
	urpmi-rpm)
		__epm_info_rpm_low && return
		docmd urpmq -i $pkg_names
		;;
66 67 68 69
	dnf-rpm)
		__epm_info_rpm_low && return
		docmd dnf info $pkg_names
		;;
70
	zypper-rpm)
71
		__epm_info_rpm_low && return
72 73 74
		docmd zypper info $pkg_names
		;;
	pacman)
75
		is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
76
		docmd pacman -Si $pkg_names
77
		;;
78 79 80 81
	aura)
		is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
		docmd aura -Ai $pkg_names
		;;
82 83 84 85
	npackd)
		# FIXME: --version=
		docmd npackdcl info --package=$pkg_names
		;;
86 87 88 89
	conary)
		is_installed $pkg_names && docmd conary query $pkg_names --info && return
		docmd conary repquery $pkg_names --info
		;;
90 91 92 93 94 95 96
	emerge)
		assure_exists equery
		docmd equery meta $pkg_names
		docmd equery which $pkg_names
		docmd equery uses $pkg_names
		docmd equery size $pkg_names
		;;
97
	slackpkg)
98
		docmd /usr/sbin/slackpkg info $pkg_names
99
		;;
100 101 102
	ipkg)
		docmd ipkg info $pkg_names
		;;
103 104 105
	pkgng)
		docmd pkg info $pkg_names
		;;
106 107 108
	xbps)
		docmd xbps-query --show $pkg_names
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
109 110 111
	homebrew)
		docmd brew info $pkg_names
		;;
112 113 114
	aptcyg)
		docmd apt-cyg show $pkg_names
		;;
115
	*)
116
		fatal "Have no suitable command for $PMTYPE"
117 118 119 120
		;;
esac

}