# install package
#download
- tmp_location = File.join(@tmp_path,Utils.create_uniq_name)
- filepath = download(pkg_name, os, false, tmp_location)
- if filepath.nil? or filepath[0].nil? then
- return false
- end
+ tmp_location = nil
+ begin
+ tmp_location = File.join(@tmp_path,Utils.create_uniq_name)
+ filepath = download(pkg_name, os, false, tmp_location)
+ if filepath.nil? or filepath[0].nil? then
+ return false
+ end
- #install
- ret = FileInstaller.install(pkg_name, filepath[0], type, @location, @log)
+ #install
+ ret = FileInstaller.install(pkg_name, filepath[0], type, @location, @log)
+ ensure
+ #remove garbage
+ FileUtils.rm_rf tmp_location if not tmp_location.nil? and File.exist? tmp_location
+ end
- #remove garbage
- FileUtils.rm_rf tmp_location
return ret
end