class Omnibus::Packager::Makeself

Constants

SCRIPT_MAP

@return [Hash]

Public Instance Methods

create_makeself_package() click to toggle source

Run the actual makeself command, publishing the generated package.

@return [void]

# File lib/omnibus/packagers/makeself.rb, line 111
    def create_makeself_package
      log.info(log_key) { "Creating makeself package" }

      Dir.chdir(staging_dir) do
        shellout! <<-EOH.gsub(/^ {10}/, "")
          #{makeself} \\
            --header "#{makeself_header}" \\
            --gzip \\
            "#{staging_dir}" \\
            "#{package_name}" \\
            "#{project.description}" \\
            "./makeselfinst"
        EOH
      end

      FileSyncer.glob("#{staging_dir}/*.sh").each do |makeself|
        copy_file(makeself, Config.package_dir)
      end
    end
makeself() click to toggle source

The path to the makeself script - the default should almost always be fine!

@return [String]

# File lib/omnibus/packagers/makeself.rb, line 57
def makeself
  resource_path("makeself.sh")
end
makeself_header() click to toggle source

The path to the makeself-header script - the default should almost always be fine!

@return [String]

# File lib/omnibus/packagers/makeself.rb, line 67
def makeself_header
  resource_path("makeself-header.sh")
end
package_name() click to toggle source

@see Base#package_name

# File lib/omnibus/packagers/makeself.rb, line 47
def package_name
  "#{project.package_name}-#{project.build_version}_#{project.build_iteration}.#{safe_architecture}.sh"
end
safe_architecture() click to toggle source

The architecture for this makeself package.

@return [String]

# File lib/omnibus/packagers/makeself.rb, line 136
def safe_architecture
  Ohai["kernel"]["machine"]
end
write_makeselfinst() click to toggle source

Render a makeselfinst in the staging directory using the supplied ERB template. This file will be used to move the contents of the self- extracting archive into place following extraction.

@return [void]

# File lib/omnibus/packagers/makeself.rb, line 78
def write_makeselfinst
  makeselfinst_staging_path = File.join(staging_dir, "makeselfinst")
  render_template(resource_path("makeselfinst.erb"),
    destination: makeselfinst_staging_path,
    variables: {
      install_dir: project.install_dir,
    })
  FileUtils.chmod(0755, makeselfinst_staging_path)
end
write_scripts() click to toggle source

Copy all scripts in {Project#package_scripts_path} to the staging directory.

@return [void]

# File lib/omnibus/packagers/makeself.rb, line 94
def write_scripts
  SCRIPT_MAP.each do |source, destination|
    source_path = File.join(project.package_scripts_path, source.to_s)

    if File.file?(source_path)
      destination_path = File.join(staging_dir, destination)
      log.debug(log_key) { "Adding script `#{source}' to `#{destination_path}'" }
      copy_file(source_path, destination_path)
    end
  end
end