From 6e50c18eabfd8dca319b1ebf45db81f30f31a9c9 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 7 Nov 2023 12:50:57 +0100 Subject: [PATCH] Fixing disabling of original repo files. --- snippets/tpl.100.clear_repos.sh | 5 ++++- snippets/tpl.280.dist-upgrade.sh | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/snippets/tpl.100.clear_repos.sh b/snippets/tpl.100.clear_repos.sh index a2ca60e..8f4162d 100644 --- a/snippets/tpl.100.clear_repos.sh +++ b/snippets/tpl.100.clear_repos.sh @@ -19,7 +19,10 @@ clear_all_repo_files() { continue fi echo " - $( basename "${repo_file}" )" - rm -fv "${repo_file}" + # Important: + # Don't remove repo files, only truncate them. + # Otherwise they are re-created on dist upgrade and may break the whole thing. + cp -v /dev/null "${repo_file}" done echo -e "\e[0Ksection_end:$( date +%s ):ks_clear_all_repo_files\r\e[0K" diff --git a/snippets/tpl.280.dist-upgrade.sh b/snippets/tpl.280.dist-upgrade.sh index 9c2ad99..e17a387 100644 --- a/snippets/tpl.280.dist-upgrade.sh +++ b/snippets/tpl.280.dist-upgrade.sh @@ -8,10 +8,15 @@ dist_upgrade() { echo echo "${HASH_LINE}" echo "Calling dist_upgrade() ..." + echo + + local repo_dir="/etc/yum.repos.d" + echo "Directory ${repo_dir} before dist upgrade:" + ls -ld "${repo_dir}"/* + echo log "Upgrading all packages ..." echo - if [[ -x /bin/dnf ]] ; then YUM=dnf else @@ -19,7 +24,10 @@ dist_upgrade() { fi if $YUM upgrade --assumeyes ; then - : + echo + echo "Directory ${repo_dir} after dist upgrade:" + ls -ld "${repo_dir}"/* + echo else echo "[$(date)]: Upgrading system not successful." | tee -a "${ERROR_POINTER}" fi -- 2.39.5