def install_files(guestfs)
      @log.debug "Installing files specified in appliance definition file..."

      @appliance_config.files.each do |dir, files|

        @log.debug "Proceding files for '#{dir}' destination directory..."

        local_files = []

        # Create the directory if it doesn't exists
        guestfs.mkdir_p(dir) unless guestfs.exists(dir) != 0

        files.each do |f|
          if f.match(/^(http|ftp|https):\/\//)
            # Remote url provided
            @log.trace "Remote url detected: '#{f}'."

            # We have a remote file, try to download it using curl!
            guestfs.sh("cd #{dir} && curl -O -L #{f}")
          else
            @log.trace "Local path detected: '#{f}'."

            file_path = (f.match(/^\//) ? f : "#{File.dirname(@appliance_definition_file)}/#{f}")

            # TODO validate this earlier
            raise ValidationError, "File '#{f}' specified in files section of appliance definition file doesn't exists." unless File.exists?(file_path)

            local_files << f
          end
        end

        next if local_files.empty?

        @log.trace "Tarring files..."
        @exec_helper.execute("cd #{File.dirname(@appliance_definition_file)} && tar -cvf /tmp/bg_install_files.tar --wildcards #{local_files.join(' ')}")
        @log.trace "Files tarred."

        @log.trace "Uploading and unpacking..."
        guestfs.tar_in("/tmp/bg_install_files.tar", dir)
        @log.trace "Files uploaded."

      end
      @log.debug "Files installed."
    end
def install_files(guestfs)
      @log.debug "Installing files specified in appliance definition file..."

      @appliance_config.files.each do |dir, files|

        @log.debug "Proceding files for '#{dir}' destination directory..."

        local_files = []

        # Create the directory if it doesn't exists
        guestfs.mkdir_p(dir) unless guestfs.exists(dir) != 0

        files.each do |f|
          if f.match(/^(http|ftp|https):\/\//)
            # Remote url provided
            @log.trace "Remote url detected: '#{f}'."

            # We have a remote file, try to download it using curl!
            guestfs.sh("cd #{dir} && curl -O -L #{f}")
          else
            @log.trace "Local path detected: '#{f}'."

            file_path = (f.match(/^\//) ? f : "#{File.dirname(@appliance_definition_file)}/#{f}")

            # TODO validate this earlier
            raise ValidationError, "File '#{f}' specified in files section of appliance definition file doesn't exists." unless File.exists?(file_path)

            local_files << f
          end
        end

        next if local_files.empty?

        @log.trace "Tarring files..."
        @exec_helper.execute("cd #{File.dirname(@appliance_definition_file)} && tar -cvf /tmp/bg_install_files.tar --wildcards #{local_files.join(' ')}")
        @log.trace "Files tarred."

        @log.trace "Uploading and unpacking..."
        guestfs.tar_in("/tmp/bg_install_files.tar", dir)
        @log.trace "Files uploaded."

      end
      @log.debug "Files installed."
    end
Copies specified files into appliance.

 There are two types of paths:
 1. remote - starting with http:// or https:// or ftp://
 2. local - all other.

 Please use relative paths. Relative means relative to the appliance definition file.
 Using absolute paths will cause creating whole directory structure in appliance,
 which is most probably not exactly what you want.

 https://issues.jboss.org/browse/BGBUILD-276