epm-release_upgrade 19.2 KB
Newer Older
1 2
#!/bin/sh
#
3 4
# Copyright (C) 2013, 2016, 2017, 2019, 2020, 2021  Etersoft
# Copyright (C) 2013, 2016, 2017, 2019, 2020, 2021  Vitaly Lipatov <lav@etersoft.ru>
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

20
load_helper epm-query
21
load_helper epm-repofix
22
load_helper epm-reposave
23

24 25 26 27 28 29 30 31 32 33 34 35
assure_safe_run()
{
	if [ "$TERM" = "linux" ] ; then
		echo "You have the best choise to run the '# epm release-upgrade' from text console."
		return
	fi
	if [ "$TERM" != "screen" ] ; then
		if [ -n "$force" ] ; then
			echo "You force me running not under screen (TERM=$TERM now)! You can lost your system!"
			return
		else
			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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
			fatal "or run me with --force if you understand the risk."
		fi
	fi

	# run under screen, check if systemd will not kill our processes
	local res
	if ! is_active_systemd systemd ; then
		return
	fi

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

	# check too: KillExcludeUsers

	# can continue
	return 0
}

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

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

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

	return 1
}

105

106 107
__get_conflict_release_pkg()
{
Vitaly Lipatov's avatar
Vitaly Lipatov committed
108
	epm qf --quiet --short /etc/fedora-release | head -n1
109 110
}

111 112
get_fix_release_pkg()
{
113 114 115 116 117 118 119 120 121 122 123 124 125 126
	local TOINSTALL=''

	local FORCE=''
	if [ "$1" == "--force" ] ; then
		FORCE="$1"
		shift
	fi

	local TO="$1"

	if [ "$TO" = "Sisyphus" ] ; then
		TO="sisyphus"
		echo "apt-conf-$TO"
	else
127
		epm installed apt-conf-branch && echo "apt-conf-branch"
128
	fi
129 130 131 132 133 134

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

140 141 142 143 144 145
	#local AR="$(epm --short qf /etc/altlinux-release)"
	#if [ -n "$AR" ] && [ "$AR" != "$TOINSTALL" ] ; then
	#	echo "$AR-"
	#fi

	# TODO: add bug?
146 147 148
	# workaround against obsoleted altlinux-release-sisyphus package from 2008 year
	[ "$TOINSTALL" = "altlinux-release-sisyphus" ] && TOINSTALL="branding-alt-sisyphus-release"

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

160 161 162 163 164 165
	if [ -n "$TOINSTALL" ] ; then
		echo "$TOINSTALL"

		# workaround against
		#    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
		# problem
166 167
		local AR="$(__get_conflict_release_pkg)"
		if [ -n "$AR" ] && [ "$TOINSTALL" != "$AR" ] ; then
168 169 170
			#echo $AR-
			# remove conflicts package right here to workaround against asking 'Yes, do as I say!' later
			epm remove --nodeps $AR >/dev/null
171
		fi
172
	fi
173 174
}

175 176
__check_system()
{
177 178 179
	local TO="$1"
	shift

180
	# sure we have systemd if systemd is running
181 182
	if is_active_systemd systemd ; then
		docmd epm --skip-installed install systemd || fatal
183
	fi
184

185
	if [ "$TO" != "Sisyphus" ] ; then
186 187
		# we could miss DISTRVENDOR script during downgrade, reread
		set_distro_info
188
		if [ "$($DISTRVENDOR -v)" != "$TO" ] || epm installed altlinux-release-sisyphus >/dev/null ; then
189 190
			warning "Current distro still is not $TO, or altlinux-release-sisyphus package is installed."
			warning "Trying to fix with altlinux-release-$TO"
191 192 193 194
			docmd epm install altlinux-release-$TO
		fi
	fi

195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
	# switch from prefdm: https://bugzilla.altlinux.org/show_bug.cgi?id=26405#c47
	if is_active_systemd systemd ; then
		if serv display-manager exists || serv prefdm exists ; then
			# don't stop running X server!
			# docmd serv dm off
			docmd serv disable prefdm
			docmd serv disable display-manager
			docmd serv enable display-manager

# $ epm sf dm.service
# xinitrc: /lib/systemd/system/dm.service
# gdm: /lib/systemd/system/gdm.service
# lightdm: /lib/systemd/system/lightdm.service
# lxde-lxdm: /lib/systemd/system/lxdm.service
# xinitrc: /lib/systemd/system/prefdm.service
# sddm: /lib/systemd/system/sddm.service
			# enable first available DM
			for i in lightdm sddm lxde-lxdm gdm ; do
				serv $i exists && docmd serv enable $i && break
			done
		fi
216 217
	fi

218
}
219

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

230 231 232 233 234 235
__switch_repo_to()
{
    epm_reposwitch "$@"
    __epm_ru_update || fatal
}

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

265 266 267 268 269
__do_upgrade()
{
	docmd epm $non_interactive $force_yes upgrade || fatal "Check the errors and run '# $0' again"
}

270 271
# TODO: install new conf without signs?
__switch_alt_to_distro()
272
{
273
	local TO="$2"
274
	local FROM="$1"
275
	info
276

277
	try_change_alt_repo
278

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

436 437
epm_release_upgrade()
{
438
	assure_root
439
	assure_safe_run
440
	info "Starting upgrade/switch whole system to other release"
441
	info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
442

443
	cd / || fatal
444 445 446
	# TODO: it is possible eatmydata does not do his work
	export EPMNOEATMYDATA=1

447
	case $DISTRNAME in
448
	ALTLinux|ALTServer)
449
		__epm_ru_update || fatal
450

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

462 463 464 465 466 467 468 469
		TARGET=""
		[ -n "$3" ] && fatal "Too many args: $*"
		if [ -n "$2" ] ; then
			DISTRVERSION="$1"
			info "Force current distro version as $DISTRVERSION"
			TARGET="$2"
		elif [ -n "$1" ] ; then
			TARGET="$1"
470 471
		fi

472 473
		[ -n "$TARGET" ] || TARGET="$(get_next_release $DISTRVERSION)"

474 475
		__alt_repofix

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

		return 0
479 480 481 482 483 484 485
		;;
	*)
		;;
	esac

	case $PMTYPE in
	apt-rpm)
486
		#docmd epm update
487
		info "Have no idea how to upgrade $DISTRNAME. It is possible you need use 'release-downgrade'"
488
		;;
Vitaly Lipatov's avatar
Vitaly Lipatov committed
489
	*-dpkg)
490
		assure_exists do-release-upgrade update-manager-core
Vitaly Lipatov's avatar
Vitaly Lipatov committed
491
		sudocmd do-release-upgrade
492
		;;
493
	packagekit)
494
		docmd pkcon upgrade-system "$@"
495
		;;
496 497 498 499 500
	yum-rpm)
		docmd epm install rpm yum
		sudocmd yum clean all
		# TODO
		showcmd rpm -Uvh http://mirror.yandex.ru/fedora/linux/releases/16/Fedora/x86_64/os/Packages/fedora-release-16-1.noarch.rpm
Vitaly Lipatov's avatar
Vitaly Lipatov committed
501
		showcmd epm Upgrade
502
		;;
503
	dnf-rpm)
504 505
		if [ "$DISTRNAME/$DISTRVERSION" = "CentOS/8" ] ; then
			if [ "$1" = "RockyLinux" ] ; then
506
				info "https://github.com/rocky-linux/rocky-tools/tree/main/migrate2rocky/"
507 508
				confirm_info "Switch to Rocky Linux 8.x"
				cd /tmp
509 510 511
				showcmd epm install git
				sudocmd git clone https://github.com/rocky-linux/rocky-tools.git || fatal
				sudocmd bash rocky-tools/migrate2rocky/migrate2rocky.sh -r
512 513
				exit
			fi
514 515 516 517 518 519

			if [ "$1" = "OracleLinux" ] ; then
				info "Check https://t.me/srv_admin/1630"
				confirm_info "Switch to Oracle Linux 8.x"
				cd /tmp
				showcmd epm install git
520 521 522 523
				sudocmd sed -i -r \
					-e 's!^mirrorlist=!#mirrorlist=!' \
					-e 's!^#?baseurl=http://(mirror|vault).centos.org/\$contentdir/\$releasever/!baseurl=https://dl.rockylinux.org/vault/centos/8.5.2111/!i' \
						/etc/yum.repos.d/CentOS-*.repo
524 525 526 527 528
				sudocmd git clone https://github.com/oracle/centos2ol.git || fatal
				a= bash centos2ol/centos2ol.sh
				exit
			fi

529 530
			info "Check https://www.cyberciti.biz/howto/upgrade-migrate-from-centos-8-to-centos-stream-conversion/"
			confirm_info "Switch to CentOS Stream?"
531 532 533 534
			sudocmd sed -i -r \
					-e 's!^mirrorlist=!#mirrorlist=!' \
					-e 's!^#?baseurl=http://(mirror|vault).centos.org/\$contentdir/\$releasever/!baseurl=https://dl.rockylinux.org/vault/centos/8.5.2111/!i' \
						/etc/yum.repos.d/CentOS-*.repo
535 536 537 538 539 540 541
			docmd epm install centos-release-stream
			sudocmd dnf swap centos-{linux,stream}-repos
			sudocmd dnf distro-sync
			info "You can run '# epm autoorphans' to remove orphaned packages"
			exit
		fi
		info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
Vitaly Lipatov's avatar
Vitaly Lipatov committed
542
		#docmd epm install epel-release yum-utils
543
		sudocmd dnf --refresh upgrade || fatal
544 545
		sudocmd dnf clean all
		assure_exists dnf-plugin-system-upgrade
546
		sudocmd dnf upgrade --refresh
547
		local RELEASEVER="$1"
548 549
		[ -n "$RELEASEVER" ] || RELEASEVER=$(($DISTRVERSION + 1))
		#[ -n "$RELEASEVER" ] || fatal "Run me with new version"
550
		confirm_info "Upgrade to $DISTRNAME/$RELEASEVER"
551
		sudocmd dnf system-upgrade download --refresh --releasever=$RELEASEVER
552 553 554
		# TODO: from docs:
		# dnf system-upgrade reboot
		# FIXME: download all packages again
555
		sudocmd dnf distro-sync --releasever=$RELEASEVER
556
		info "You can run '# epm autoorphans' to remove orphaned packages"
557
		;;
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
	urpm-rpm)
		sudocmd urpmi.removemedia -av
		# TODO
		showcmd urpmi.addmedia --distrib http://mirror.yandex.ru/mandriva/devel/2010.2/i586/
		sudocmd urpmi --auto-update --replacefiles
		;;
	zypper-rpm)
		docmd epm repolist
		# TODO
		# sudocmd zypper rr <номер_репозитория>
		showcmd rr N
		showcmd epm ar http://mirror.yandex.ru/opensuse/distribution/11.1/repo/oss 11.1oss
		showcmd zypper ref
		docmd epm update
		docmd epm install rpm zypper
		docmd epm upgrade
		;;
	pacman)
576
		epm Upgrade
577
		;;
578 579 580
	conary)
		epm Upgrade
		;;
581 582 583 584 585 586
	emerge)
		epm Upgrade
		;;
	guix)
		sudocmd guix pull --verbose
		;;
587
	*)
588
		fatal "Have no suitable command for $PMTYPE"
589 590 591 592
		;;
	esac

}