2020-06-04 18:00:32 +00:00
|
|
|
use base "installedtest";
|
|
|
|
use strict;
|
|
|
|
use testapi;
|
|
|
|
use utils;
|
|
|
|
|
|
|
|
sub run {
|
|
|
|
|
|
|
|
my $self = shift;
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 3);
|
2020-06-04 18:00:32 +00:00
|
|
|
|
|
|
|
# list available branches
|
|
|
|
assert_script_run "ostree remote refs fedora-iot";
|
|
|
|
|
|
|
|
# check arch
|
|
|
|
my $arch = lc(get_var("ARCH"));
|
|
|
|
|
|
|
|
# set default for rawhide or devel
|
|
|
|
my $rebase = "stable";
|
|
|
|
|
|
|
|
# if testing the current release, rebase to devel
|
|
|
|
unless (script_run "rpm-ostree status -b | grep stable") {
|
2022-07-28 20:32:57 +00:00
|
|
|
$rebase = "devel";
|
2020-06-04 18:00:32 +00:00
|
|
|
}
|
2022-09-20 22:48:22 +00:00
|
|
|
|
|
|
|
# FIXME special cases for read-only transition from 36 to 37
|
|
|
|
# we can drop these (revert the whole relevant commit) once
|
|
|
|
# 37 is stable
|
|
|
|
my $orig;
|
|
|
|
if (get_var("CURRREL") eq "36") {
|
|
|
|
if (get_var("VERSION") eq "37") {
|
|
|
|
# rebase to rawhide
|
|
|
|
$rebase = "rawhide";
|
|
|
|
$orig = "devel";
|
|
|
|
}
|
|
|
|
elsif (get_var("VERSION") eq "38") {
|
|
|
|
# rebase to devel
|
|
|
|
$rebase = "devel";
|
|
|
|
$orig = "rawhide";
|
|
|
|
}
|
|
|
|
}
|
2020-06-04 18:00:32 +00:00
|
|
|
# rebase to the appropriate release, arch
|
|
|
|
validate_script_output "rpm-ostree rebase fedora/${rebase}/${arch}/iot", sub { m/systemctl reboot/ }, 300;
|
|
|
|
script_run "systemctl reboot", 0;
|
|
|
|
|
|
|
|
boot_to_login_screen;
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 3);
|
2020-06-04 18:00:32 +00:00
|
|
|
|
|
|
|
# check booted branch to make sure successful rebase
|
2022-09-20 22:48:22 +00:00
|
|
|
validate_script_output "rpm-ostree status -b", sub { m/$rebase/ }, 300;
|
2020-06-04 18:00:32 +00:00
|
|
|
|
|
|
|
# rollback and reboot
|
|
|
|
validate_script_output "rpm-ostree rollback", sub { m/systemctl reboot/ }, 300;
|
|
|
|
script_run "systemctl reboot", 0;
|
|
|
|
|
|
|
|
boot_to_login_screen;
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 3);
|
2020-06-04 18:00:32 +00:00
|
|
|
|
|
|
|
# check to make sure rollback successful, also account for branched (devel)
|
2022-09-20 22:48:22 +00:00
|
|
|
if ($orig) {
|
|
|
|
validate_script_output "rpm-ostree status -b", sub { m/$orig/ }, 300;
|
|
|
|
}
|
|
|
|
elsif ($rebase eq "devel") {
|
2020-06-04 18:00:32 +00:00
|
|
|
validate_script_output "rpm-ostree status -b", sub { m/stable/ }, 300;
|
|
|
|
}
|
2022-09-20 22:48:22 +00:00
|
|
|
elsif ($rebase eq "stable") {
|
2020-06-04 18:00:32 +00:00
|
|
|
validate_script_output "rpm-ostree status -b", sub { m/rawhide|devel/ }, 300;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub test_flags {
|
2022-07-28 20:32:57 +00:00
|
|
|
return {fatal => 1};
|
2020-06-04 18:00:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: set sw=4 et:
|