diff --git a/tool/run/load/tftp b/tool/run/load/tftp index 5e18cb2013..6bce565cdb 100644 --- a/tool/run/load/tftp +++ b/tool/run/load/tftp @@ -56,24 +56,29 @@ proc generate_tftp_config { } { if {[string length $tftp_base_dir] > 0 && [string length $tftp_offset_dir] > 0} { - # if the link target exists as directory this leads to bad behavior - if {[file exists $tftp_base_dir$tftp_offset_dir] && - [string compare [file type $tftp_base_dir$tftp_offset_dir] "directory"] == 0} { - - puts stderr "Error: TFTP symlink target $tftp_base_dir$tftp_offset_dir is a directory" - exit -1 - } - exec ln -nfs "[pwd]" "$tftp_base_dir$tftp_offset_dir" - set tftp_base "" if {[load_tftp_use_absolute]} { set tftp_base $tftp_base_dir } - set fh [open "$tftp_base_dir$tftp_offset_dir/config-00-00-00-00-00-00" "WRONLY CREAT TRUNC"] - puts $fh " root $tftp_base$tftp_offset_dir/[run_dir]" - puts $fh " config config-52-54-00-12-34-56" - close $fh + if {[load_tftp_copy_files]} { + exec cp -r --dereference "[pwd]/[run_dir]/." $tftp_base_dir$tftp_offset_dir/. + } else { + # if the link target exists as directory this leads to bad behavior + if {[file exists $tftp_base_dir$tftp_offset_dir] && + [string compare [file type $tftp_base_dir$tftp_offset_dir] "directory"] == 0} { + + puts stderr "Error: TFTP symlink target $tftp_base_dir$tftp_offset_dir is a directory" + exit -1 + } + + exec ln -nfs "[pwd]" "$tftp_base_dir$tftp_offset_dir" + + set fh [open "$tftp_base_dir$tftp_offset_dir/config-00-00-00-00-00-00" "WRONLY CREAT TRUNC"] + puts $fh " root $tftp_base$tftp_offset_dir/[run_dir]" + puts $fh " config config-52-54-00-12-34-56" + close $fh + } } else { puts "Warning, TFTP base directory or TFTP offset directory not set." }