NBash

Форк
0
/
epm-release_upgrade 
636 строк · 24.5 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2013, 2016, 2017, 2019, 2020, 2021  Etersoft
4
# Copyright (C) 2013, 2016, 2017, 2019, 2020, 2021  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-query
21
load_helper epm-repofix
22
load_helper epm-reposave
23

24
assure_safe_run()
25
{
26
    if [ "$TERM" = "linux" ] ; then
27
        echo "You have the best choise to run the '# epm release-upgrade' from text console."
28
        return
29
    fi
30
    if [ "$TERM" != "screen" ] ; then
31
        if [ -n "$force" ] ; then
32
            echo "You force me running not under screen (TERM=$TERM now)! You can lost your system!"
33
            return
34
        else
35
            warning "It is very dangerous to upgrade to next release from a GUI (your TERM=$TERM)."
36
            if is_installed screen ; then
37
                warning "You have 'screen' already installed, just run upgrade via screen (check https://losst.ru/komanda-screen-linux if needed)."
38
            else
39
                warning "It is recommended install 'screen' and run upgrade via screen (check https://losst.ru/komanda-screen-linux if needed)."
40
            fi
41
            fatal "or run me with --force if you understand the risk."
42
        fi
43
    fi
44

45
    # run under screen, check if systemd will not kill our processes
46
    local res
47
    if ! is_active_systemd ; then
48
        return
49
    fi
50

51
    res="$(busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager KillUserProcesses)"
52
    if [ "$res" = "b false" ] ; then
53
        echo "Good news: systemd-logind will not kill your screen processes (KillUserProcesses=false)"
54
        return
55
    else
56
        if [ -n "$force" ] ; then
57
            warning "You force runnning even if systemd-logind kills screen on disconnect"
58
        else
59
            if ! epm installed systemd-settings-disable-kill-user-processes ; then
60
                docmd epm install systemd-settings-disable-kill-user-processes || fatal "Can't install the package above. Fix it or run with --force."
61
            fi
62
            # commented, will kick off the user from the system (ALT issue 50580)
63
            #docmd serv systemd-logind restart || fatal "Can't restart systemd-logind service. Fix it or run with --force."
64
            fatal "Now you need relogin to the system. In this session your screen still will be killed."
65
        fi
66
    fi
67

68
    # check too: KillExcludeUsers
69

70
    # can continue
71
    return 0
72
}
73

74
__wcount()
75
{
76
    echo "$*" | wc -w
77
}
78

79
# TODO: remove it or move to distro_info
80
__detect_alt_release_by_repo()
81
{
82
    local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list \
83
        | grep -v "^#" \
84
        | grep -E "[tpc][5-9]\.?[0-9]?/branch/" \
85
        | sed -e "s|.*\([tpc][5-9]\.\?[0-9]\?\)/branch.*|\1|g" \
86
        | sort -u )
87
    if [ "$(__wcount $BRD)" = "1" ] ; then
88
        echo "$BRD"
89
        return
90
    fi
91

92
    local BRD=$(cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list \
93
        | grep -v "^#" \
94
        | grep "Sisyphus/" \
95
        | sed -e "s|.*\(Sisyphus\).*|\1|g" \
96
        | sort -u )
97
    if [ "$(__wcount $BRD)" = "1" ] ; then
98
        echo "$BRD"
99
        return
100
    fi
101

102
    return 1
103
}
104

105

106
__get_conflict_release_pkg()
107
{
108
    epm qf --quiet --short /etc/fedora-release | head -n1
109
}
110

111
get_fix_release_pkg()
112
{
113
    local TOINSTALL=''
114

115
    local FORCE=''
116
    if [ "$1" = "--force" ] ; then
117
        FORCE="$1"
118
        shift
119
    fi
120

121
    local TO="$1"
122

123
    if [ "$TO" = "Sisyphus" ] ; then
124
        TO="sisyphus"
125
        echo "apt-conf-$TO"
126
        # apt-conf-sisyphus and apt-conf-branch conflicts
127
        epm installed apt-conf-branch && echo "apt-conf-branch-"
128
        #for i in apt apt-rsync libapt libpackagekit-glib librpm7 packagekit rpm synaptic realmd libldap2 ; do
129
        #    epm installed $i && echo "$i"
130
        #done
131

132
    else
133
        epm installed apt-conf-branch && echo "apt-conf-branch" && epm installed apt-conf-sisyphus && echo "apt-conf-sisyphus-"
134
    fi
135

136
    if [ "$FORCE" = "--force" ] ; then
137
        # assure we have set needed release
138
        TOINSTALL="altlinux-release-$TO"
139
    else
140
        # just assure we have /etc/altlinux-release and switched from sisyphus
141
        if [ ! -s /etc/altlinux-release ] || epm qf /etc/altlinux-release | grep -q sisyphus ; then
142
            TOINSTALL="altlinux-release-$TO"
143
        fi
144
    fi
145

146
    #local AR="$(epm --short qf /etc/altlinux-release)"
147
    #if [ -n "$AR" ] && [ "$AR" != "$TOINSTALL" ] ; then
148
    #    echo "$AR-"
149
    #fi
150

151
    # TODO: add bug?
152
    # workaround against obsoleted altlinux-release-sisyphus package from 2008 year
153
    [ "$TOINSTALL" = "altlinux-release-sisyphus" ] && TOINSTALL="branding-alt-sisyphus-release"
154

155
    if epm installed etersoft-gpgkeys ; then
156
        # TODO: we don't support LINUX@Etersoft for now
157
        # leave etersoft-gpgkeys only if we have LINUX@Etersoft repo
158
        #epm repo list | grep -q "LINUX@Etersoft" && echo "etersoft-gpgkeys" || echo "alt-gpgkeys"
159
        epm --quiet repo comment "LINUX@Etersoft"
160
        echo "alt-gpgkeys"
161
    else
162
        # update if installed (just print package name here to include in the install list)
163
        epm query --short alt-gpgkeys 2>/dev/null
164
    fi
165

166
    if [ -n "$TOINSTALL" ] ; then
167
        echo "$TOINSTALL"
168

169
        # workaround against
170
        #    file /etc/fedora-release from install of altlinux-release-p8-20160414-alt1 conflicts with file from package branding-simply-linux-release-8.2.0-alt1
171
        # problem
172
        local AR="$(__get_conflict_release_pkg)"
173
        if [ -n "$AR" ] && [ "$TOINSTALL" != "$AR" ] ; then
174
            #echo $AR-
175
            # remove conflicts package right here to workaround against asking 'Yes, do as I say!' later
176
            epm remove --nodeps $AR >/dev/null
177
        fi
178
    fi
179
}
180

181
__check_system()
182
{
183
    local TO="$1"
184
    shift
185

186
    # sure we have systemd if systemd is running
187
    if is_active_systemd ; then
188
        docmd epm --skip-installed install systemd || fatal
189
    fi
190

191
    if [ "$TO" != "Sisyphus" ] ; then
192
        # note: we get --base-version directy to get new version
193
        if [ "$(DISTRVENDOR --base-version)" != "$TO" ] || epm installed altlinux-release-sisyphus >/dev/null ; then
194
            warning "Current distro still is not $TO, or altlinux-release-sisyphus package is installed."
195
            warning "Trying to fix with altlinux-release-$TO"
196
            docmd epm install altlinux-release-$TO
197
        fi
198
    fi
199

200
    # switch from prefdm: https://bugzilla.altlinux.org/show_bug.cgi?id=26405#c47
201
    if is_active_systemd ; then
202
        if serv display-manager exists || serv prefdm exists ; then
203
            # don't stop running X server!
204
            # docmd serv dm off
205
            docmd serv disable prefdm
206
            docmd serv disable display-manager
207
            docmd serv enable display-manager
208

209
# $ epm sf dm.service
210
# xinitrc: /lib/systemd/system/dm.service
211
# gdm: /lib/systemd/system/gdm.service
212
# lightdm: /lib/systemd/system/lightdm.service
213
# lxde-lxdm: /lib/systemd/system/lxdm.service
214
# xinitrc: /lib/systemd/system/prefdm.service
215
# sddm: /lib/systemd/system/sddm.service
216
            # enable first available DM
217
            for i in lightdm sddm lxde-lxdm gdm ; do
218
                serv $i exists && docmd serv enable $i && break
219
            done
220
        fi
221
    fi
222

223
}
224

225
__epm_ru_update()
226
{
227
    docmd epm update && return
228
    # TODO: there can be errors due obsoleted alt-gpgkeys
229
    epm update 2>&1 | grep "E: Unknown vendor ID" || return
230
    info "Drop vendor signs"
231
    __alt_replace_sign_name ""
232
    docmd epm update
233
}
234

235
__switch_repo_to()
236
{
237
    epm_reposwitch "$@"
238
    __epm_ru_update || fatal
239
}
240

241
get_next_release()
242
{
243
    local FROM="$1"
244
    case "$FROM" in
245
    "p6")
246
        echo "p7" ;;
247
    "p7")
248
        echo "p8" ;;
249
    "p8")
250
        echo "p9" ;;
251
    "p9")
252
        echo "p10" ;;
253
    "c6")
254
        echo "c7" ;;
255
    "c7")
256
        echo "c8" ;;
257
#    "c8")
258
#        echo "c8.1" ;;
259
    "c8.1")
260
        echo "c8.2" ;;
261
    "c8")
262
        echo "c9f2" ;;
263
    "c9f1")
264
        echo "c9f2" ;;
265
    *)
266
        echo "$FROM" ;;
267
    esac
268
}
269

270
__do_upgrade()
271
{
272
    docmd epm $non_interactive $force_yes upgrade || fatal "Check the errors and run '# $0' again"
273
}
274

275
# TODO: install new conf without signs?
276
__switch_alt_to_distro()
277
{
278
    local TO="$2"
279
    local FROM="$1"
280
    info
281

282
    try_change_alt_repo
283

284
    case "$*" in
285
        "p6"|"p6 p7"|"t6 p7"|"c6 c7")
286
            confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
287
            docmd epm install rpm apt $(get_fix_release_pkg "$FROM") || fatal
288
            __switch_repo_to $TO
289
            docmd epm install rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
290
            end_change_alt_repo
291
            __do_upgrade
292
            docmd epm update-kernel
293
            info "Run epm release-upgrade again for update to p8"
294
            ;;
295
        "p7"|"p7 p8"|"t7 p8"|"c7 c8")
296
            confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
297
            docmd epm install rpm apt $(get_fix_release_pkg "$FROM") || fatal
298
            __switch_repo_to $TO
299
            docmd epm install rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
300
            end_change_alt_repo
301
            __do_upgrade
302
            __check_system "$TO"
303
            docmd epm update-kernel || fatal
304
            info "Run epm release-upgrade again for update to p9"
305
            ;;
306
        "c8"|"c8.1"|"c8.2"|"c8 c8.1"|"c8.1 c8.2"|"c8 c8.2")
307
            confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
308
            docmd epm install rpm apt $(get_fix_release_pkg "$FROM") || fatal
309
            __switch_repo_to $TO
310
            docmd epm install rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
311
            end_change_alt_repo
312
            __do_upgrade
313
            __check_system "$TO"
314
            docmd epm update-kernel || fatal
315
            ;;
316
        "p8 c8"|"p8 c8.1"|"p8 c8.2")
317
            confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
318
            docmd epm install rpm apt $(get_fix_release_pkg "$FROM") || fatal
319
            __switch_repo_to $TO
320
            docmd epm install rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
321
            if epm installed libcrypt ; then
322
                # glibc-core coflicts libcrypt
323
                docmd epm downgrade apt pam pam0_passwdqc glibc-core libcrypt- || fatal
324
            fi
325
            docmd epm $non_interactive $force_yes downgrade || fatal
326
            end_change_alt_repo
327
            __do_upgrade
328
            __check_system "$TO"
329
            docmd epm update-kernel || fatal
330
            ;;
331
        "p8"|"p8 p9"|"t8 p9"|"c8 c9"|"c8 p9"|"c8.1 p9"|"c8.2 p9"|"p9 p9"|"p9 c9f2")
332
            confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
333
            docmd epm install rpm apt $(get_fix_release_pkg "$FROM") || fatal
334
            info "Workaround for https://bugzilla.altlinux.org/show_bug.cgi?id=35492 ..."
335
            if epm installed gdb >/dev/null ; then
336
                docmd epm remove gdb || fatal
337
            fi
338
            __switch_repo_to $TO
339
            end_change_alt_repo
340
            __do_upgrade
341
            docmd epm install rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
342
            __check_system "$TO"
343
            docmd epm update-kernel || fatal
344
            info "Run epm release-upgrade again for update to p10"
345
            ;;
346
        "p9"|"p9 p10"|"p10 p10")
347
            info "Upgrade all packages to current $FROM repository"
348
            __do_upgrade
349
            confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
350
            docmd epm install rpm apt $(get_fix_release_pkg "$FROM") || fatal
351
            __switch_repo_to $TO
352
            end_change_alt_repo
353
            __do_upgrade
354
            docmd epm install rpm apt $(get_fix_release_pkg "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
355
            __check_system "$TO"
356
            docmd epm update-kernel -t std-def || fatal
357
            ;;
358
        "p9 p8"|"c8.1 c8"|"c8.1 p8"|"p8 p8")
359
            confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
360
            docmd epm install $(get_fix_release_pkg "$FROM")
361
            __switch_repo_to $TO
362
            docmd epm downgrade rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
363
            if epm installed libcrypt >/dev/null ; then
364
                # glibc-core coflicts libcrypt
365
                docmd epm downgrade apt rpm pam pam0_passwdqc glibc-core libcrypt- || fatal
366
            fi
367
            docmd epm $force_yes $non_interactive downgrade || fatal "Check the error and run '# epm downgrade'"
368
            end_change_alt_repo
369
            __check_system "$TO"
370
            docmd epm upgrade || fatal
371
            ;;
372
        "p9 c8"|"p9 c8.1"|"p9 c8.2")
373
            confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
374
            docmd epm install $(get_fix_release_pkg "$FROM")
375
            __switch_repo_to $TO
376
            docmd epm downgrade rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
377
            #if epm installed libcrypt >/dev/null ; then
378
            #    # glibc-core coflicts libcrypt
379
            #    docmd epm downgrade apt rpm pam pam0_passwdqc glibc-core libcrypt- || fatal
380
            #fi
381
            docmd epm $force_yes $non_interactive downgrade || fatal "Check the error and run '# epm downgrade'"
382
            end_change_alt_repo
383
            __check_system "$TO"
384
            docmd epm upgrade || fatal
385
            ;;
386
        "p10 p9")
387
            confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
388
            docmd epm install $(get_fix_release_pkg "$FROM")
389
            __switch_repo_to $TO
390
            docmd epm downgrade rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
391
            docmd epm $force_yes $non_interactive downgrade || fatal "Check the error and run '# epm downgrade'"
392
            end_change_alt_repo
393
            __check_system "$TO"
394
            docmd epm upgrade || fatal
395
            ;;
396
        "Sisyphus p8"|"Sisyphus p9"|"Sisyphus p10"|"Sisyphus c8"|"Sisyphus c8.1"|"Sisyphus c9f2")
397
            confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
398
            docmd epm install $(get_fix_release_pkg "$FROM")
399
            __switch_repo_to $TO
400
            docmd epm install rpm apt $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
401
            docmd epm $force_yes $non_interactive downgrade || fatal "Check the error and run '# epm downgrade'"
402
            end_change_alt_repo
403
            __check_system "$TO"
404
            docmd epm upgrade || fatal
405
            ;;
406
        "p8 Sisyphus"|"p9 Sisyphus"|"p10 Sisyphus"|"10 Sisyphus"|"Sisyphus Sisyphus")
407
            confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
408
            docmd epm install rpm apt $(get_fix_release_pkg "$FROM") || fatal
409
            docmd epm upgrade || fatal
410
            # TODO: epm_reposwitch??
411
            __replace_alt_version_in_repo "$FROM/branch/" "$TO/"
412
            __alt_repofix "alt"
413
            [ -s /etc/rpm/macros.d/p10 ] && rm -fv /etc/rpm/macros.d/p10
414
            __epm_ru_update || fatal
415
            docmd epm fix || fatal
416
            docmd epm install $(get_fix_release_pkg --force "$TO") || fatal "Check the errors and run '# epm release-upgrade' again"
417
            #local ADDPKG
418
            #ADDPKG=$(epm -q --short make-initrd sssd-ad 2>/dev/null)
419
            #docmd epm install librpm7 librpm rpm apt $ADDPKG $(get_fix_release_pkg --force "$TO") ConsoleKit2- || fatal "Check an error and run again"
420
            end_change_alt_repo
421
            docmd epm $force_yes $non_interactive upgrade || fatal "Check the error and run '# epm release-upgrade' again or just '# epm upgrade'"
422
            docmd epm $force_yes $non_interactive downgrade || fatal "Check the error and run '# epm downgrade'"
423
            __check_system "$TO"
424
            docmd epm update-kernel || fatal
425
            ;;
426
        *)
427
            if [ "$FROM" = "$TO" ] ; then
428
                info "It seems your system is already $DISTRNAME $TO"
429
            else
430
                warning "Unknown distro version. Have no idea how to switch from $DISTRNAME $FROM to $DISTRNAME $TO."
431
            fi
432
            end_change_alt_repo
433
            info "Try run f.i. '# epm release-upgrade p10' or '# epm release-downgrade p9' or '# epm release-upgrade Sisyphus'"
434
            info "Also possible you need install altlinux-release-p? package for correct distro version detecting"
435
            return 1
436
    esac
437
    docmd epm clean
438
    docmd epm update
439
}
440

441
epm_release_upgrade()
442
{
443
    assure_root
444
    assure_safe_run
445
    info "Starting upgrade/switch whole system to other release"
446
    info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
447

448
    cd / || fatal
449
    # TODO: it is possible eatmydata does not do his work
450
    export EPMNOEATMYDATA=1
451

452
    case $BASEDISTRNAME in
453
    "alt")
454
        __epm_ru_update || fatal
455

456
        # TODO: remove this hack (or move it to distro_info)
457
        # try to detect current release by repo
458
        if [ "$DISTRVERSION" = "Sisyphus" ] || [ -z "$DISTRVERSION" ] ; then
459
            local dv
460
            dv="$(__detect_alt_release_by_repo)"
461
            if [ -n "$dv" ] && [ "$dv" != "$DISTRVERSION" ] ; then
462
                DISTRVERSION="$dv"
463
                info "Detected running $DISTRNAME $DISTRVERSION (according to using repos)"
464
            fi
465
        fi
466

467
        TARGET=""
468
        [ -n "$3" ] && fatal "Too many args: $*"
469
        if [ -n "$2" ] ; then
470
            DISTRVERSION="$1"
471
            info "Force current distro version as $DISTRVERSION"
472
            TARGET="$2"
473
        elif [ -n "$1" ] ; then
474
            TARGET="$1"
475
        fi
476

477
        [ "$TARGET" = "Sisyphus" ] && info "Check also https://www.altlinux.org/Update/Sisyphus"
478

479
        [ -n "$TARGET" ] || TARGET="$(get_next_release $DISTRVERSION)"
480

481
        __alt_repofix
482

483
        __switch_alt_to_distro $DISTRVERSION $TARGET && info "Done. The system has been successfully upgraded to the next release '$TO'."
484

485
        return 0
486
        ;;
487
    *)
488
        ;;
489
    esac
490

491
    case $DISTRNAME in
492
    "Mageia")
493
        epm repo remove all
494
        sudocmd urpmi.addmedia --distrib --mirrorlist 'http://mirrors.mageia.org/api/mageia.8.$DISTRARCH.list'
495
        sudocmd urpmi --auto-update $non_interactive $force
496
        return
497
        ;;
498
    "ROSA")
499
        # TODO: move to distro related upgrade
500
        #epm repo remove all
501
        # FIXME: don't work:
502
        #epm repo add "http://mirror.rosalinux.ru/rosa/rosa2021.1/repository/$DISTRARCH"
503
        #showcmd urpmi.addmedia --distrib http://mirror.yandex.ru/mandriva/devel/2010.2/i586/
504
        #sudocmd urpmi --auto-update --replacefiles
505
        return
506
        ;;
507
    *)
508
        ;;
509
    esac
510

511
    case $PMTYPE in
512
    apt-rpm)
513
        #docmd epm update
514
        info "Have no idea how to upgrade $DISTRNAME. It is possible you need use 'release-downgrade'"
515
        ;;
516
    *-dpkg)
517
        assure_exists do-release-upgrade update-manager-core
518
        sudocmd do-release-upgrade
519
        ;;
520
    packagekit)
521
        docmd pkcon upgrade-system "$@"
522
        ;;
523
    yum-rpm)
524
        docmd epm install rpm yum
525
        sudocmd yum clean all
526
        info "Try do manually:"
527
        showcmd rpm -Uvh http://mirror.yandex.ru/fedora/linux/releases/16/Fedora/x86_64/os/Packages/fedora-release-16-1.noarch.rpm
528
        showcmd epm Upgrade
529
        ;;
530
    dnf-rpm)
531
        if [ "$DISTRNAME/$DISTRVERSION" = "CentOS/8" ] ; then
532
            if [ "$1" = "RockyLinux" ] ; then
533
                info "https://github.com/rocky-linux/rocky-tools/tree/main/migrate2rocky/"
534
                confirm_info "Switch to Rocky Linux 8.x"
535
                cd /tmp
536
                docmd epm install git
537
                sudocmd git clone https://github.com/rocky-linux/rocky-tools.git || fatal
538
                sudocmd bash rocky-tools/migrate2rocky/migrate2rocky.sh -r
539
                exit
540
            fi
541

542
            if [ "$1" = "OracleLinux" ] ; then
543
                info "Check https://t.me/srv_admin/1630"
544
                confirm_info "Switch to Oracle Linux 8.x"
545
                cd /tmp
546
                docmd epm install git
547
                sudocmd sed -i -r \
548
                    -e 's!^mirrorlist=!#mirrorlist=!' \
549
                    -e 's!^#?baseurl=http://(mirror|vault).centos.org/\$contentdir/\$releasever/!baseurl=https://dl.rockylinux.org/vault/centos/8.5.2111/!i' \
550
                        /etc/yum.repos.d/CentOS-*.repo
551
                sudocmd git clone https://github.com/oracle/centos2ol.git || fatal
552
                a= bash centos2ol/centos2ol.sh
553
                exit
554
            fi
555

556
            info "Check https://www.cyberciti.biz/howto/upgrade-migrate-from-centos-8-to-centos-stream-conversion/"
557
            confirm_info "Switch to CentOS Stream?"
558
            sudocmd sed -i -r \
559
                    -e 's!^mirrorlist=!#mirrorlist=!' \
560
                    -e 's!^#?baseurl=http://(mirror|vault).centos.org/\$contentdir/\$releasever/!baseurl=https://dl.rockylinux.org/vault/centos/8.5.2111/!i' \
561
                        /etc/yum.repos.d/CentOS-*.repo
562
            docmd epm install centos-release-stream
563
            sudocmd dnf swap centos-{linux,stream}-repos
564
            sudocmd dnf distro-sync
565
            info "You can run '# epm autoorphans' to remove orphaned packages"
566
            exit
567
        fi
568

569
        if [ "$DISTRNAME" = "RockyLinux" ] ; then
570
            sudocmd dnf --refresh upgrade || fatal
571
            sudocmd dnf clean all
572
            info "Check https://www.centlinux.com/2022/07/upgrade-your-servers-from-rocky-linux-8-to-9.html"
573
            info "For upgrading your yum repositories from Rocky Linux 8 to 9 ..."
574
            epm install "https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-gpg-keys*.rpm" || fatal
575
            epm install "https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-repos*.rpm" "https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-release*.rpm" || fatal
576

577
            # hack (TODO)
578
            DV=$(echo "$DISTRVERSION" | sed -e "s|\..*||")
579
            local RELEASEVER="$1"
580
            [ -n "$RELEASEVER" ] || RELEASEVER=$(($DV + 1))
581
            confirm_info "Upgrade to $DISTRNAME/$RELEASEVER"
582

583
            sudocmd dnf -y --releasever=$RELEASEVER --allowerasing --setopt=deltarpm=false distro-sync
584
            sudocmd rpm --rebuilddb
585
            epm upgrade
586
            info "You can run '# epm autoorphans' to remove orphaned packages"
587
            info "Use # dnf module reset <module> to resolve 'nothing provides module' error"
588
            exit
589
        fi
590

591
        info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
592
        #docmd epm install epel-release yum-utils
593
        sudocmd dnf --refresh upgrade || fatal
594
        sudocmd dnf clean all
595
        assure_exists dnf-plugin-system-upgrade
596
        sudocmd dnf upgrade --refresh
597
        local RELEASEVER="$1"
598
        [ -n "$RELEASEVER" ] || RELEASEVER=$(($DISTRVERSION + 1))
599
        #[ -n "$RELEASEVER" ] || fatal "Run me with new version"
600
        confirm_info "Upgrade to $DISTRNAME/$RELEASEVER"
601
        sudocmd dnf system-upgrade download --refresh --releasever=$RELEASEVER
602
        # TODO: from docs:
603
        # dnf system-upgrade reboot
604
        # FIXME: download all packages again
605
        sudocmd dnf distro-sync --releasever=$RELEASEVER
606
        info "You can run '# epm autoorphans' to remove orphaned packages"
607
        ;;
608
    zypper-rpm)
609
        docmd epm repolist
610
        # TODO: move to distro related upgrade
611
        # sudocmd zypper rr <номер_репозитория>
612
        showcmd rr N
613
        showcmd epm ar http://mirror.yandex.ru/opensuse/distribution/11.1/repo/oss 11.1oss
614
        showcmd zypper ref
615
        docmd epm update
616
        docmd epm install rpm zypper
617
        docmd epm upgrade
618
        ;;
619
    pacman)
620
        docmd epm Upgrade
621
        ;;
622
    conary)
623
        docmd epm Upgrade
624
        ;;
625
    emerge)
626
        docmd epm Upgrade
627
        ;;
628
    guix)
629
        sudocmd guix pull --verbose
630
        ;;
631
    *)
632
        fatal "Have no suitable command for $PMTYPE"
633
        ;;
634
    esac
635

636
}
637

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

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

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

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