From 6fbabfd825e5c741c5afe4645254c67684eb8c5a Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Thu, 7 Jul 2022 21:50:10 -0700 Subject: [PATCH] implement DNF_CONTENTDIR swap as post-install action before reboot/login --- tests/_do_install_and_reboot.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/_do_install_and_reboot.pm b/tests/_do_install_and_reboot.pm index 03105f65..9d8be2e0 100644 --- a/tests/_do_install_and_reboot.pm +++ b/tests/_do_install_and_reboot.pm @@ -140,6 +140,7 @@ sub run { push (@actions, 'consoletty0') if (get_var("ARCH") eq "aarch64"); push (@actions, 'abrt') if (get_var("ABRT", '') eq "system"); push (@actions, 'rootpw') if (get_var("INSTALLER_NO_ROOT")); + push (@actions, 'stagingrepos') if (get_var("DNF_CONTENTDIR")); # memcheck test doesn't need to reboot at all. Rebooting from GUI # for lives is unreliable. And if we're already doing something # else at a console, we may as well reboot from there too @@ -187,6 +188,20 @@ sub run { my $root_password = get_var("ROOT_PASSWORD") || "weakpassword"; assert_script_run "echo 'root:$root_password' | chpasswd -R $mount"; } + if (grep {$_ eq 'stagingrepos'} @actions) { + if (get_version_major() < 9) { + assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . $mount . '/etc/yum.repos.d/Rocky-BaseOS.repo'; + assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . $mount . '/etc/yum.repos.d/Rocky-AppStream.repo'; + assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . $mount . '/etc/yum.repos.d/Rocky-Extras.repo'; + assert_script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s,^#\(baseurl=http[s]*://\),\1,g" ' . $mount . '/etc/yum.repos.d/Rocky-Devel.repo'; + } else { + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/etc/yum.repos.d/rocky.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/etc/yum.repos.d/rocky-addons.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/etc/yum.repos.d/rocky-devel.repo'; + script_run 'sed -i -e "s/^mirrorlist/#mirrorlist/g;s/^#baseurl/baseurl/g" ' . $mount . '/etc/yum.repos.d/rocky-extras.repo'; + } + assert_script_run 'printf "stg/rocky\n" > ' . $mount . '/etc/dnf/vars/contentdir'; + } type_string "reboot\n" if (grep {$_ eq 'reboot'} @actions); }