From ba008cbe9a4f09061ad3ee0ec66fc91f64dd4bbc Mon Sep 17 00:00:00 2001 From: "jiil.hyoun" Date: Tue, 11 Dec 2012 20:10:59 +0900 Subject: [PATCH] [Title] installer bug fix when meta file install in windows system [Type] Bugfix [Module] Toolchain / [Priority] Major [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: I39e6d9a991345b7af1029475438841281642c604 --- src/pkg_server/installer.rb | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/pkg_server/installer.rb b/src/pkg_server/installer.rb index 1ec43eb..58febe9 100644 --- a/src/pkg_server/installer.rb +++ b/src/pkg_server/installer.rb @@ -310,22 +310,24 @@ class FileInstaller else FileUtils.cp pkginfo_path, config_path end if File.exist? data_path then - # if os is linux, use cpio. it is faster than cp - if Utils.is_linux_like_os( Utils::HOST_OS ) then - absolute_path = `readlink -f #{target_path}` - result = Utils.execute_shell_return("cd #{data_path}; find . -depth | cpio -pldm #{absolute_path}") - else - result = Utils.execute_shell_return("cp -r #{data_path}/* #{target_path}") - end - if result.nil? then - logger.error "Failed to move files" - logger.info " [from: #{source_path}]" - logger.info " [to: #{target_path}]" - return nil + if Dir.entries(data_path).count > 2 then + # if os is linux, use cpio. it is faster than cp + if Utils.is_linux_like_os( Utils::HOST_OS ) then + absolute_path = `readlink -f #{target_path}` + result = Utils.execute_shell_return("cd #{data_path}; find . -depth | cpio -pldm #{absolute_path}") + else + result = Utils.execute_shell_return("cp -r #{data_path}/* #{target_path}") + end + if result.nil? then + logger.error "Failed to move files" + logger.info " [from: #{source_path}]" + logger.info " [to: #{target_path}]" + return nil + end + logger.info "Moved files.. OK" + log = log + "[from: #{source_path}]\n" + log = log + "[to: #{target_path}]\n" end - logger.info "Moved files.. OK" - log = log + "[from: #{source_path}]\n" - log = log + "[to: #{target_path}]\n" else logger.warn "\"data\" directory does not exist." end return log -- 2.34.1