From d8f796ffcab7c74e29aa1ae52cc24e24d7cd5734 Mon Sep 17 00:00:00 2001 From: yangsong Date: Wed, 6 Mar 2019 14:56:29 +0800 Subject: [PATCH] fix issue modifies the permissions of source bin file #6049 (#6053) grant the sounce bin file correct permissions --- xCAT-server/lib/xcat/plugins/onie.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/onie.pm b/xCAT-server/lib/xcat/plugins/onie.pm index 65e49c6f8..2fb8921bc 100644 --- a/xCAT-server/lib/xcat/plugins/onie.pm +++ b/xCAT-server/lib/xcat/plugins/onie.pm @@ -18,6 +18,7 @@ use Getopt::Long; use Expect; use File::Path; use File::Basename; +use File::Copy "cp"; use xCAT::Utils; use xCAT::MsgUtils; @@ -183,11 +184,13 @@ sub copydata { #check if file exists if ( (-e "$defaultpath/$filename") && ($nooverwrite)){ + chmod 0755, "$defaultpath/$filename"; $callback->({ data => "$defaultpath/$filename is already exists, will not overwrite" }); } else { $callback->({ data => "Copying media to $defaultpath" }); mkpath ("$defaultpath"); - system("cp $file $defaultpath"); + cp "$file", "$defaultpath"; + chmod 0755, "$defaultpath/$filename"; $callback->({ data => "Media copy operation successful" }); }