NBash

Форк
0
69 строк · 1.9 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2023  Etersoft
4
# Copyright (C) 2023  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-sh-altlinux
21
#load_helper epm-repolist
22

23
alt_LISTS='/etc/apt/sources.list /etc/apt/sources.list.d/*.list'
24

25

26
__epm_repodisable_alt()
27
{
28
    local rl
29
    # ^rpm means full string
30
    if rhas "$1" "\^rpm" ; then
31
        rl="$(echo "$1" | sed -e 's|\^||')"
32
    else
33
        rl="$( (epm --quiet repolist) 2>/dev/null | grep -F "$1" | head -n1 )"
34
        [ -z "$rl" ] && warning "Can't find '$1' entries in the repos (see '# epm repolist' output)" && return 1
35
    fi
36
    echo "$rl" | while read rp ; do
37
        [ -n "$dryrun" ] && echo "will comment $rp" && continue
38
        sed -i -e "s|^\($(sed_escape "$rl")\)|#\1|" $alt_LISTS
39
    done
40
}
41

42

43
epm_repodisable()
44
{
45

46
case $PMTYPE in
47
    apt-rpm)
48
        assure_root
49
        __epm_repodisable_alt "$@"
50
        ;;
51
    apt-dpkg|aptitude-dpkg)
52
        print_apt_sources_list
53
        ;;
54
    yum-rpm)
55
        docmd yum repolist $verbose
56
        [ -n "$verbose" ] || info "Use --verbose if you need detail information."
57
        ;;
58
    dnf-rpm)
59
        sudocmd dnf config-manager --enable $verbose "$@"
60
        ;;
61
    eoget)
62
        docmd eoget disable-repo "$@"
63
        ;;
64
    *)
65
        fatal "Have no suitable command for $PMTYPE"
66
        ;;
67
esac
68

69
}
70

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

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

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

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