Class: Omnibus::Packager::Makeself
- Defined in:
- lib/omnibus/packagers/makeself.rb
Constant Summary collapse
- SCRIPT_MAP =
{ # Default Omnibus naming postinst: "postinst", }.freeze
Constants included from Util
Constants included from NullArgumentable
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create_makeself_package ⇒ void
Run the actual makeself command, publishing the generated package.
-
#makeself ⇒ String
The path to the makeself script - the default should almost always be fine!.
-
#makeself_header ⇒ String
The path to the makeself-header script - the default should almost always be fine!.
- #package_name ⇒ Object
-
#safe_architecture ⇒ String
The architecture for this makeself package.
-
#write_makeselfinst ⇒ void
Render a makeselfinst in the staging directory using the supplied ERB template.
-
#write_scripts ⇒ void
Copy all scripts in Omnibus::Project#package_scripts_path to the staging directory.
Methods inherited from Base
build, #exclusions, id, #id, #initialize, #install_dir, #package_path, #resource_path, #resources_path, #run!, setup, #skip_packager, #staging_dir, #staging_dir_path
Methods included from Util
#compiler_safe_path, #copy_file, #create_directory, #create_file, #create_link, included, #path_key, #remove_directory, #remove_file, #retry_block, #shellout, #shellout!, #windows_safe_path
Methods included from Templating
included, #render_template, #render_template_content
Methods included from Sugarable
Methods included from NullArgumentable
Methods included from Logging
Methods included from Instrumentation
Methods included from Digestable
#digest, #digest_directory, included
Constructor Details
This class inherits a constructor from Omnibus::Packager::Base
Instance Method Details
#create_makeself_package ⇒ void
This method returns an undefined value.
Run the actual makeself command, publishing the generated package.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# 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 ⇒ String
The path to the makeself script - the default should almost always be fine!
57 58 59 |
# File 'lib/omnibus/packagers/makeself.rb', line 57 def makeself resource_path("makeself.sh") end |
#makeself_header ⇒ String
The path to the makeself-header script - the default should almost always be fine!
67 68 69 |
# File 'lib/omnibus/packagers/makeself.rb', line 67 def makeself_header resource_path("makeself-header.sh") end |
#package_name ⇒ Object
47 48 49 |
# 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 ⇒ String
The architecture for this makeself package.
136 137 138 |
# File 'lib/omnibus/packagers/makeself.rb', line 136 def safe_architecture Ohai["kernel"]["machine"] end |
#write_makeselfinst ⇒ void
This method returns an undefined value.
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.
78 79 80 81 82 83 84 85 86 |
# 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 ⇒ void
This method returns an undefined value.
Copy all scripts in Omnibus::Project#package_scripts_path to the staging directory.
94 95 96 97 98 99 100 101 102 103 104 |
# 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 |