NBash

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

20
load_helper epm-query
21

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

31
__epm_info_by_pkgtype()
32
{
33
    [ -n "$pkg_files" ] || return 1
34

35
    case $(get_package_type $pkg_files) in
36
        rpm)
37
            __epm_info_rpm_low && return
38
            ;;
39
        deb)
40
            docmd dpkg -I $pkg_files
41
            ;;
42
        *)
43
            return 1
44
            ;;
45
    esac
46
}
47

48
__epm_info_by_pmtype()
49
{
50
case $PMTYPE in
51
    apt-dpkg)
52
        if [ -n "$pkg_files" ] ; then
53
            docmd dpkg -I $pkg_files
54
        fi
55
        [ -z "$pkg_names" ] && return
56
        is_installed $pkg_names && docmd dpkg -p $pkg_names && return
57
        docmd apt-cache show $pkg_names
58
        ;;
59
    aptitude-dpkg)
60
        if [ -n "$pkg_files" ] ; then
61
            docmd dpkg -I $pkg_files
62
        fi
63
        [ -z "$pkg_names" ] && return
64
        docmd aptitude show $pkg_names
65
        ;;
66
    *-rpm)
67
        __epm_info_rpm_low && return
68
        case $PMTYPE in
69
            apt-rpm)
70
                docmd apt-cache show $pkg_names
71
                ;;
72
            packagekit)
73
                docmd pkcon get-details $pkg_names
74
                ;;
75
            yum-rpm)
76
                docmd yum info $pkg_names
77
                ;;
78
            urpmi-rpm)
79
                docmd urpmq -i $pkg_names
80
                ;;
81
            dnf-rpm)
82
                docmd dnf info $pkg_names
83
                ;;
84
            zypper-rpm)
85
                docmd zypper info $pkg_names
86
                ;;
87
            *)
88
                warning "Unknown command for $PMTYPE"
89
                ;;
90
        esac
91
        ;;
92
    packagekit)
93
        # TODO: get-details-local
94
        docmd pkcon get-details $pkg_names
95
        ;;
96
    pacman)
97
        is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
98
        docmd pacman -Si $pkg_names
99
        ;;
100
    aura)
101
        is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
102
        docmd aura -Ai $pkg_names
103
        ;;
104
    npackd)
105
        # FIXME: --version=
106
        docmd npackdcl info --package=$pkg_names
107
        ;;
108
    conary)
109
        is_installed $pkg_names && docmd conary query $pkg_names --info && return
110
        docmd conary repquery $pkg_names --info
111
        ;;
112
    emerge)
113
        assure_exists equery
114
        docmd equery meta $pkg_names
115
        docmd equery which $pkg_names
116
        docmd equery uses $pkg_names
117
        docmd equery size $pkg_names
118
        ;;
119
    slackpkg)
120
        docmd /usr/sbin/slackpkg info $pkg_names
121
        ;;
122
    opkg)
123
        docmd opkg info $pkg_names
124
        ;;
125
    apk)
126
        docmd apk info $pkg_names
127
        ;;
128
    pkgng)
129
        docmd pkg info $pkg_names
130
        ;;
131
    xbps)
132
        docmd xbps-query --show $pkg_names
133
        ;;
134
    homebrew)
135
        docmd brew info $pkg_names
136
        ;;
137
    aptcyg)
138
        docmd apt-cyg show $pkg_names
139
        ;;
140
    eopkg)
141
        docmd eopkg info $pkg_files $pkg_names
142
        ;;
143
    appget)
144
        docmd appget view $pkg_names
145
        ;;
146
    winget)
147
        docmd winget show $pkg_names
148
        ;;
149
    termux-pkg)
150
        docmd pkg show $pkg_names
151
        ;;
152
    *)
153
        fatal "Have no suitable command for $PMTYPE"
154
        ;;
155
esac
156
}
157

158

159
# TODO: separate to _files and _names parts
160
# implement _files part per package, not by PMTYPE (see filelist)
161
epm_info()
162
{
163

164
# if possible, it will put pkg_urls into pkg_files or pkg_names
165
if [ -n "$pkg_urls" ] ; then
166
    load_helper epm-download
167
    __handle_pkg_urls_to_checking
168
fi
169

170
[ -n "$pkg_filenames" ] || fatal "Info: package name is missed"
171

172
__epm_info_by_pkgtype || __epm_info_by_pmtype
173

174
local RETVAL=$?
175

176
return $RETVAL
177
}
178

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.