lib/rbbt/util/pkg_software.rb in rbbt-util-1.2.1 vs lib/rbbt/util/pkg_software.rb in rbbt-util-2.0.1
- old
+ new
@@ -1,6 +1,7 @@
require 'rbbt/util/open'
+require 'rbbt/util/misc'
require 'rbbt/util/tsv'
require 'rbbt/util/log'
require 'rbbt/util/cmd'
require 'rake'
@@ -50,10 +51,23 @@
def get_pkg(pkg, path, get, sharedir)
Log.log "Getting software '#{ pkg }' into '#{ path }'. Get: #{get.to_s}"
FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
- if get.nil? or get.empty?
+ case
+ when get == :directory
+ FileUtils.mkdir_p File.dirname(path) unless File.exists? File.dirname(path)
+ subdir = Misc.path_relative_to File.dirname(path), opt_dir
+ source = File.join(sharedir, 'install/software', subdir, pkg)
+
+ FileUtils.cp_r File.join(sharedir, 'install/software', subdir, pkg), path
+ when get == :binary
+ FileUtils.mkdir_p File.dirname(path) unless File.exists? File.dirname(path)
+ subdir = Misc.path_relative_to File.dirname(path), opt_dir
+ source = File.join(sharedir, 'install/software', subdir, pkg)
+
+ FileUtils.cp File.join(sharedir, 'install/software', subdir, pkg), path
+ when (get.nil? or get.empty?)
CMD.cmd("#{File.join(sharedir, 'install', 'software', pkg)} #{File.join(Rbbt.rootdir, 'share/install/software/lib', 'install_helpers')} #{software_dir}", :stderr => Log::HIGH)
else
CMD.cmd("#{File.join(sharedir, 'install', 'software', get)} #{File.join(Rbbt.rootdir, 'share/install/software/lib', 'install_helpers')} #{software_dir}")
end
end