epm-policy 1.51 KB
Newer Older
1 2
#!/bin/sh
#
3 4
# Copyright (C) 2015, 2017, 2019  Etersoft
# Copyright (C) 2015, 2017, 2019  Vitaly Lipatov <lav@etersoft.ru>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#
# 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
# (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
# GNU Affero General Public License for more details.
#
# 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/>.
#

20
load_helper epm-query
21
load_helper epm-sh-warmup
22

23 24 25
epm_policy()
{

Vitaly Lipatov's avatar
Vitaly Lipatov committed
26
[ -n "$pkg_names" ] || fatal "Info: package name is missed"
27

28 29
warmup_bases

30 31 32
# get package name for hi level package management command (with version if supported and if possible)
pkg_names=$(__epm_get_hilevel_name $pkg_names)

33
case $PMTYPE in
34
    apt-*)
Vitaly Lipatov's avatar
Vitaly Lipatov committed
35
        # FIXME: returns TRUE ever on missed package
36 37
        docmd apt-cache policy $pkg_names
        ;;
38
    dnf-*|dnf5-*)
39 40
        docmd dnf info $pkg_names
        ;;
41 42 43
    yum-*)
        fatal "policy command is not implemented for yum"
        ;;
44 45 46
    packagekit)
        docmd pkcon resolve $pkg_names
        ;;
47 48 49
    apk)
        docmd apk policy $pkg_names
        ;;
50
    *)
51
        fatal 'Have no suitable command for $PMTYPE'
52
        ;;
53 54 55
esac

}