Class: Omnibus::Packager::Solaris

Inherits:
Base
  • Object
show all
Defined in:
lib/omnibus/packagers/solaris.rb

Constant Summary

Constants included from Util

Util::SHELLOUT_OPTIONS

Constants included from NullArgumentable

NullArgumentable::NULL

Instance Attribute Summary

Attributes inherited from Base

#project

Instance Method Summary collapse

Methods inherited from Base

build, #exclusions, id, #id, #initialize, #install_dir, #package_path, #resource_path, #resources_path, #run!, setup, #staging_dir

Methods included from Util

#copy_file, #create_directory, #create_file, #create_link, included, #remove_directory, #remove_file, #shellout, #shellout!, #windows_safe_path

Methods included from Templating

included, #render_template

Methods included from NullArgumentable

included, #null?

Methods included from Logging

included

Methods included from Digestable

#digest, #digest_directory

Constructor Details

This class inherits a constructor from Omnibus::Packager::Base

Instance Method Details

#install_basenameObject


58
59
60
# File 'lib/omnibus/packagers/solaris.rb', line 58

def install_basename
  File.basename(project.install_dir)
end

#install_dirnameObject


54
55
56
# File 'lib/omnibus/packagers/solaris.rb', line 54

def install_dirname
  File.dirname(project.install_dir)
end

#package_nameObject

See Also:


46
47
48
# File 'lib/omnibus/packagers/solaris.rb', line 46

def package_name
  "#{project.package_name}-#{pkgmk_version}.#{Ohai['kernel']['machine']}.solaris"
end

#pkgmk_versionObject


50
51
52
# File 'lib/omnibus/packagers/solaris.rb', line 50

def pkgmk_version
  "#{project.build_version}-#{project.build_iteration}"
end

#write_pkginfo_contentObject

Generate a pkginfo file for solaris build


89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/omnibus/packagers/solaris.rb', line 89

def write_pkginfo_content
  pkginfo_content = "CLASSES=none\nTZ=PST\nPATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin\nBASEDIR=\#{install_dirname}\nPKG=\#{project.package_name}\nNAME=\#{project.package_name}\nARCH=\#{`uname -p`.chomp}\nVERSION=\#{pkgmk_version}\nCATEGORY=application\nDESC=\#{project.description}\nVENDOR=\#{project.maintainer}\nEMAIL=\#{project.maintainer}\nPSTAMP=\#{`hostname`.chomp + Time.now.utc.iso8601}\n".gsub(/^ {8}/, '')
  File.open '/tmp/pkgmk/pkginfo', 'w+' do |f|
    f.write pkginfo_content
  end
end

#write_prototype_contentObject

Generate a Prototype file for solaris build


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/omnibus/packagers/solaris.rb', line 65

def write_prototype_content
  prototype_content = "i pkginfo\ni postinstall\ni postremove\n".gsub(/^ {8}/, '')

  # generate list of control files
  File.open '/tmp/pkgmk/Prototype', 'w+' do |f|
    f.write prototype_content
  end

  Dir.chdir(staging_dir) do
    # generate the prototype's file list
    shellout! "cd #{install_dirname} && pkgproto < /tmp/pkgmk/files > /tmp/pkgmk/Prototype.files"

    # fix up the user and group in the file list to root
    shellout! "awk '{ $5 = \"root\"; $6 = \"root\"; print }' < /tmp/pkgmk/Prototype.files >> /tmp/pkgmk/Prototype"
  end
end