NBash

Форк
0
/
epm-install-apt-dpkg 
86 строк · 2.5 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2012-2020  Etersoft
4
# Copyright (C) 2012-2020  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
epm_install_files_apt_dpkg()
21
{
22
    local files="$*"
23
    [ -z "$files" ] && return
24

25
    # the new version of the conf. file is installed with a .dpkg-dist suffix
26
    if [ -n "$non_interactive" ] ; then
27
        DPKGOPTIONS="--force-confdef --force-confold"
28
    fi
29

30
    if __epm_repack_if_needed $files ; then
31
        [ -n "$repacked_pkgs" ] || fatal "Can't convert $files"
32
        files="$repacked_pkgs"
33
    fi
34

35
    if [ -n "$save_only" ] ; then
36
        echo
37
        cp -v $files "$EPMCURDIR"
38
        return
39
    fi
40

41
    if [ -n "$put_to_repo" ] ; then
42
        load_helper epm-repopkg
43
        epm_put_to_repo $files
44
        return
45
    fi
46

47

48
    # TODO: if dpkg can't install due missed deps, trying with apt (as for now, --refuse-depends, --refuse-breaks don't help me)
49

50
    if [ -n "$nodeps" ] ; then
51
        sudocmd dpkg $DPKGOPTIONS -i $files
52
        return
53
    fi
54

55
    # for too old apt-get
56
    # TODO: check apt-get version?
57
    apt_can_install_files='1'
58
    if [ "$DISTRNAME" = "Ubuntu" ] ; then
59
        [ "$DISTRVERSION" = "14.04" ] && apt_can_install_files=''
60
        [ "$DISTRVERSION" = "12.04" ] && apt_can_install_files=''
61
    fi
62

63
    if [ -n "$apt_can_install_files" ] ; then
64
        # TODO: don't resolve fuzzy dependencies ()
65
        # are there apt that don't support dpkg files to install?
66
        epm_install_names $(make_filepath $files)
67
        return
68
    fi
69

70
    # old way:
71

72
    sudocmd dpkg $DPKGOPTIONS -i $files
73
    local RES=$?
74

75
    # return OK if all is OK
76
    [ "$RES" = "0" ] && return $RES
77

78
    # TODO: workaround with epm-check needed only for very old apt
79

80
    # run apt -f install if there are were some errors during install
81
    load_helper epm-check
82
    epm_check
83

84
    # repeat install for get correct status
85
    sudocmd dpkg $DPKGOPTIONS -i $files
86
}
87

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

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

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

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