From ca7e906908cdfab545cbf29acda90a8ab485ea1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 19 Mar 2021 13:58:09 +0100 Subject: [PATCH] Code review fix --- src/clients/inst_kickoff.rb | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/clients/inst_kickoff.rb b/src/clients/inst_kickoff.rb index 40b95439..b362e782 100644 --- a/src/clients/inst_kickoff.rb +++ b/src/clients/inst_kickoff.rb @@ -46,18 +46,7 @@ def main ) end - # copy the zypp cache to the target system (only when running in inst-sys!) - if Stage.initial - # copy the credential files (libzypp loads them from target) - # and the repository cache to the target system - Pkg.SourceCacheCopyTo(Installation.destdir) - - # symlink the cache from inst-sys to save same space (RAM!) - cache_path = Pkg.ZConfig()["repo_cache_path"] || "/var/cache/zypp" - log.info("Zypp cache size: #{`du -h -s #{cache_path.shellescape}`}") - ::FileUtils.rm_rf(cache_path) - File.symlink(File.join(Installation.destdir, cache_path), cache_path) - end + copy_zypp_cache # installation, for instance... if !Mode.update @@ -142,6 +131,21 @@ def main :next end + # copy the zypp cache to the target system (only when running in inst-sys!) + def copy_zypp_cache + return unless Stage.initial + + # copy the credential files (libzypp loads them from target) + # and the repository cache to the target system + Pkg.SourceCacheCopyTo(Installation.destdir) + + # symlink the cache from inst-sys to save same space (RAM!) + cache_path = Pkg.ZConfig()["repo_cache_path"] || "/var/cache/zypp" + log.info("Zypp cache size: #{`du -h -s #{cache_path.shellescape}`}") + ::FileUtils.rm_rf(cache_path) + File.symlink(File.join(Installation.destdir, cache_path), cache_path) + end + # Handle the backup. def backup_stuff if Installation.update_backup_modified