NBash

Форк
0
/
epm-full_upgrade 
133 строки · 4.4 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2019, 2022  Etersoft
4
# Copyright (C) 2019, 2022  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_full_upgrade_help()
21
{
22
            get_help HELPCMD $SHAREDIR/epm-full_upgrade
23
    cat <<EOF
24
You can run with --interactive if you can skip some steps interactivelyю
25
Also you can comment out full_upgrade parts in /etc/eepm/eepm.conf config.
26
Examples:
27
  epm full-upgrade [--interactive]
28
  epm full-upgrade --no-flatpack
29
EOF
30
}
31

32

33
epm_full_upgrade()
34
{
35

36
    while [ -n "$1" ] ; do
37
        case "$1" in
38
            "-h"|"--help"|"help")      # HELPCMD: help
39
                epm_full_upgrade_help
40
                return
41
                ;;
42
            "--interactive")           # HELPCMD: ask before every step
43
                ;;
44
            "--no-epm-play")           # HELPCMD: skip epm play during full upgrade
45
                full_upgrade_no_epm_play=1
46
                ;;
47
            "--no-flatpack")           # HELPCMD: skip flatpack update during full upgrade
48
                full_upgrade_no_flatpack=1
49
                ;;
50
            "--no-snap")           # HELPCMD: skip snap update during full upgrade
51
                full_upgrade_no_snap=1
52
                ;;
53
            "--no-kernel-update")  # HELPCMD: skip kernel update during full upgrade
54
                full_upgrade_no_kernel_update=1
55
                ;;
56
            "--no-clean")          # HELPCMD: no clean after upgrade
57
                full_upgrade_no_clean=1
58
                ;;
59
        esac
60
        shift
61
    done
62

63
confirm_action()
64
{
65
    [ -n "$interactive" ] || return 0
66
    local response
67
    # call with a prompt string or use a default
68
    read -r -p "${1:-Are you sure? [Y/n]} " response
69
    case $response in
70
        [yY][eE][sS]|[yY]|"")
71
            true
72
            ;;
73
        *)
74
            false
75
            ;;
76
    esac
77
}
78

79
    confirm_action "Update repository info? [Y/n]" || full_upgrade_no_update=1
80
    if [ -z "$full_upgrade_no_update" ] ; then
81
        [ -n "$quiet" ] || echo
82
        docmd epm update || fatal "repository updating is failed."
83
    fi
84

85

86
    confirm_action "Do upgrade installed packages? [Y/n]" || full_upgrade_no_upgrade=1
87
    if [ -z "$full_upgrade_no_upgrade" ] ; then
88
        [ -n "$quiet" ] || echo
89
        docmd epm $dryrun upgrade || fatal "upgrading of the system is failed."
90
    fi
91

92

93
    confirm_action "Upgrade kernel and kernel modules? [Y/n]" || full_upgrade_no_kernel_update=1
94
    if [ -z "$full_upgrade_no_kernel_update" ] ; then
95
        [ -n "$quiet" ] || echo
96
        docmd epm $dryrun update-kernel || fatal "updating of the kernel is failed."
97
    fi
98

99
    # disable epm play --update for non ALT Systems
100
    [ "$BASEDISTRNAME" = "alt" ] || full_upgrade_no_epm_play=1
101

102

103
    confirm_action "Upgrade packages installed via epm play? [Y/n]" || full_upgrade_no_epm_play=1
104
    if [ -z "$full_upgrade_no_epm_play" ] ; then
105
        [ -n "$quiet" ] || echo
106
        docmd epm $dryrun play --update all || fatal "updating of applications installed via epm play is failed."
107
    fi
108

109

110
    if is_command flatpak ; then
111
        confirm_action "Upgrade installed flatpak packages? [Y/n]" || full_upgrade_no_flatpak=1
112
        if [ -z "$full_upgrade_no_flatpak" ] ; then
113
            [ -n "$quiet" ] || echo
114
            docmd flatpak update $(subst_option non_interactive --assumeyes) $(subst_option dryrun --no-deploy)
115
        fi
116
    fi
117

118

119
    if is_command snap && serv snapd exists && serv snapd status >/dev/null ; then
120
        confirm_action "Upgrade installed snap packages? [Y/n]" || full_upgrade_no_snap=1
121
        if [ -z "$full_upgrade_no_snap" ] ; then
122
            [ -n "$quiet" ] || echo
123
            sudocmd snap refresh $(subst_option dryrun --list)
124
        fi
125
    fi
126

127

128
    confirm_action "Do epm clean? [Y/n]" || full_upgrade_no_clean=1
129
    if [ -z "$full_upgrade_no_clean" ] ; then
130
        [ -n "$quiet" ] || echo
131
        docmd epm $dryrun clean
132
    fi
133
}
134

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

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

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

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