NBash

Форк
0
105 строк · 2.9 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2012,2014,2016,2017  Etersoft
4
# Copyright (C) 2012,2014,2016,2017  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-install
21
load_helper epm-sh-warmup
22

23
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
24
epm_reinstall_names()
25
{
26
    [ -n "$1" ] || return
27

28
    case $PMTYPE in
29
        apt-rpm|apt-dpkg)
30
            local APTOPTIONS="$(subst_option non_interactive -y)"
31
            sudocmd apt-get --reinstall $APTOPTIONS install $@
32
            return ;;
33
        aptitude-dpkg)
34
            sudocmd aptitude reinstall $@
35
            return ;;
36
        packagekit)
37
            warning "Please send me the correct command form for it"
38
            docmd pkcon install --allow-reinstall $@
39
            return ;;
40
        yum-rpm)
41
            sudocmd yum reinstall $@
42
            return ;;
43
        dnf-rpm)
44
            sudocmd dnf reinstall $@
45
            return ;;
46
        homebrew)
47
            sudocmd brew reinstall $@
48
            return ;;
49
        pkgng)
50
            sudocmd pkg install -f $@
51
            return ;;
52
        termux-pkg)
53
            sudocmd pkg reinstall $@
54
            return ;;
55
        opkg)
56
            sudocmd opkg --force-reinstall install $@
57
            return ;;
58
        eopkg)
59
            sudocmd eopkg --reinstall install $@
60
            return ;;
61
        slackpkg)
62
            sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
63
            return ;;
64
    esac
65

66
    # fallback to generic install
67
    epm_install_names $@
68
}
69

70
epm_reinstall_files()
71
{
72
    [ -z "$1" ] && return
73

74
    case $PMTYPE in
75
        apt-rpm)
76
            sudocmd rpm -Uvh --force $@ && return
77
            sudocmd apt-get --reinstall install $@
78
            return ;;
79
        apt-dpkg|aptitude-dpkg)
80
            sudocmd dpkg -i $@
81
            return ;;
82
        slackpkg)
83
            sudocmd_foreach "/sbin/installpkg" $@
84
            return ;;
85
    esac
86

87
    # other systems can install file package via ordinary command
88
    epm_reinstall_names $@
89
}
90

91

92
epm_reinstall()
93
{
94
    [ -n "$pkg_filenames" ] || fatal "Reinstall: package name is missed."
95

96
    warmup_lowbase
97

98
    # get package name for hi level package management command (with version if supported and if possible)
99
    pkg_names=$(__epm_get_hilevel_name $pkg_names)
100

101
    warmup_hibase
102

103
    epm_reinstall_names $pkg_names
104
    epm_reinstall_files $pkg_files
105
}
106

107

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

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

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

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