From e6b5f9f6baf2b4e6aba1db2a8f3adafab6ce165e Mon Sep 17 00:00:00 2001 From: Razvan-Liviu Varzaru Date: Fri, 18 Oct 2024 10:36:43 +0300 Subject: [PATCH] Trust mariadb key after setting up the repo --- scripts/bash_lib.sh | 4 +++- scripts/rpm-upgrade.sh | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/bash_lib.sh b/scripts/bash_lib.sh index fd9ed283..5e3403eb 100644 --- a/scripts/bash_lib.sh +++ b/scripts/bash_lib.sh @@ -215,7 +215,6 @@ rpm_repoquery() { set +u # return full package list from repository if [[ $ID_LIKE =~ ^suse* ]]; then - sudo zypper --gpg-auto-import-keys packages -r "${repo_name}">/dev/null zypper packages -r "${repo_name}" | grep "MariaDB" | awk '{print $4}' #After cache is made, no need for sudo else repoquery --disablerepo=* --enablerepo="${repo_name}" -a -q | @@ -315,6 +314,9 @@ module_hotfixes = 1 gpgkey=https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF + if [[ $ID_LIKE =~ ^suse* ]]; then + sudo zypper --gpg-auto-import-keys refresh mariadb + fi set +u } diff --git a/scripts/rpm-upgrade.sh b/scripts/rpm-upgrade.sh index 0c66d582..0460a4d1 100755 --- a/scripts/rpm-upgrade.sh +++ b/scripts/rpm-upgrade.sh @@ -150,14 +150,14 @@ bb_log_info "Package_list: $package_list" # /etc/zypp/repos.d/SUSE_Linux_Enterprise_Server_12_SP3_x86_64:SLES12-SP3-Pool.repo if [[ $ID_LIKE =~ ^suse* ]]; then sudo "$pkg_cmd" clean --all - pkg_cmd_nonint="-n" + pkg_cmd_options="-n" else sudo "$pkg_cmd" clean all - pkg_cmd_nonint="-y" + pkg_cmd_options="-y" fi # Install previous release -echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_nonint" install || +echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" install || bb_log_err "installation of a previous release failed, see the output above" #fi @@ -252,7 +252,7 @@ fi if [[ $test_type == "major" ]]; then bb_log_info "remove old packages for major upgrade" packages_to_remove=$(rpm -qa | grep 'MariaDB-' | awk -F'-' '{print $1"-"$2}') - echo "$packages_to_remove" | xargs sudo "$pkg_cmd" "$pkg_cmd_nonint" remove + echo "$packages_to_remove" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" remove rpm -qa | grep -iE 'maria|mysql' || true fi @@ -260,10 +260,10 @@ rpm_setup_bb_galera_artifacts_mirror rpm_setup_bb_artifacts_mirror if [[ $test_type == "major" ]]; then # major upgrade (remove then install) - echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_nonint" install + echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" install else # minor upgrade (upgrade works) - echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_nonint" upgrade + echo "$package_list" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" upgrade fi # set +e