NBash

Форк
0
103 строки · 2.8 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2012,2014,2016  Etersoft
4
# Copyright (C) 2012,2014,2016  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
__remove_alt_apt_cache_file()
21
{
22
    sudocmd rm -vf /var/cache/apt/*.bin
23
    sudocmd rm -vf /var/cache/apt/partial/*
24
    sudocmd rm -vf /var/lib/apt/lists/*pkglist*
25
    sudocmd rm -vf /var/lib/apt/lists/*release*
26
    return 0
27
}
28

29
__remove_deb_apt_cache_file()
30
{
31
    sudocmd rm -vf /var/cache/apt/*.bin
32
    sudocmd rm -vf /var/cache/apt/archives/partial/*
33
    sudocmd rm -vf /var/lib/apt/lists/*Packages*
34
    sudocmd rm -vf /var/lib/apt/lists/*Release*
35
    sudocmd rm -vf /var/lib/apt/lists/*Translation*
36
    return 0
37
}
38

39
epm_clean()
40
{
41

42
[ -z "$*" ] || fatal "No arguments are allowed here"
43

44

45
case $PMTYPE in
46
    apt-rpm)
47
        sudocmd apt-get clean $dryrun
48
        [ -n "$direct" ] && __remove_alt_apt_cache_file || info "Use epm clean --direct to remove all downloaded indexes."
49
        ;;
50
    apt-dpkg)
51
        sudocmd apt-get clean $dryrun
52
        [ -n "$direct" ] && __remove_deb_apt_cache_file || info "Use epm clean --direct to remove all downloaded indexes."
53
        ;;
54
    aptitude-dpkg)
55
        sudocmd aptitude clean
56
        [ -n "$direct" ] && __remove_deb_apt_cache_file || info "Use epm clean --direct to remove all downloaded indexes."
57
        ;;
58
    yum-rpm)
59
        sudocmd yum clean all
60
        #sudocmd yum makecache
61
        ;;
62
    dnf-rpm)
63
        sudocmd dnf clean all
64
        ;;
65
    urpm-rpm)
66
        sudocmd urpmi --clean
67
        ;;
68
    homebrew)
69
        sudocmd brew cleanup -s
70
        ;;
71
    pacman)
72
        sudocmd pacman -Sc --noconfirm
73
        ;;
74
    zypper-rpm)
75
        sudocmd zypper clean
76
        ;;
77
    nix)
78
        sudocmd nix-collect-garbage
79
        ;;
80
    slackpkg)
81
        ;;
82
    eopkg)
83
        sudocmd eopkg delete-cache
84
        ;;
85
    pkgng)
86
        sudocmd pkg clean -a
87
        ;;
88
    appget)
89
        sudocmd appget clean
90
        ;;
91
    xbps)
92
        sudocmd xbps-remove -O
93
        ;;
94
    termux-pkg)
95
        sudocmd pkg clean
96
        ;;
97
    *)
98
        fatal "Have no suitable command for $PMTYPE"
99
        ;;
100
esac
101
    info "Note: Also you can try (with CAUTION) '# epm autoremove' and '# epm autoorphans' commands to remove obsoleted and unused packages."
102

103
}
104

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

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

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

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