-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switch to using pkgmk for solaris #72
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -381,7 +381,7 @@ def package_types | |
when 'aix' | ||
[ "bff" ] | ||
when 'solaris2' | ||
[ "solaris" ] | ||
[ "pkgmk" ] | ||
when 'windows' | ||
[ "msi" ] | ||
else | ||
|
@@ -461,6 +461,8 @@ def output_package(pkg_type) | |
"#{package_name}-#{build_version}-#{iteration}.msi" | ||
when "bff" | ||
"#{package_name}.#{bff_version}.bff" | ||
when "pkgmk" | ||
"#{package_name}-#{build_version}-#{iteration}.solaris" | ||
else # fpm | ||
require "fpm/package/#{pkg_type}" | ||
pkg = FPM::Package.types[pkg_type].new | ||
|
@@ -507,6 +509,11 @@ def bff_command | |
[bff_command.join(" "), {:returns => [0]}] | ||
end | ||
|
||
def pkgmk_command | ||
pkgmk_command = ["pkgmk -o -r / -d /tmp/pkgmk -f /tmp/pkgmk/Prototype"] | ||
[pkgmk_command.join(" "), {:returns => [0]}] | ||
end | ||
|
||
# The {https://github.com/jordansissel/fpm fpm} command to | ||
# generate a package for RedHat, Ubuntu, Solaris, etc. platforms. | ||
# | ||
|
@@ -537,15 +544,15 @@ def fpm_command(pkg_type) | |
end | ||
|
||
if File.exist?("#{package_scripts_path}/postinst") | ||
command_and_opts << "--post-install '#{package_scripts_path}/postinst'" | ||
command_and_opts << "--after-install '#{File.join(package_scripts_path, "postinst")}'" | ||
end | ||
# solaris packages don't support --pre-uninstall | ||
if File.exist?("#{package_scripts_path}/prerm") && pkg_type != "solaris" | ||
command_and_opts << "--pre-uninstall '#{package_scripts_path}/prerm'" | ||
if File.exist?("#{package_scripts_path}/prerm") | ||
command_and_opts << "--before-remove '#{File.join(package_scripts_path, "prerm")}'" | ||
end | ||
# solaris packages don't support --post-uninstall | ||
if File.exist?("#{package_scripts_path}/postrm") && pkg_type != "solaris" | ||
command_and_opts << "--post-uninstall '#{package_scripts_path}/postrm'" | ||
if File.exist?("#{package_scripts_path}/postrm") | ||
command_and_opts << "--after-remove '#{File.join(package_scripts_path, "postrm")}'" | ||
end | ||
|
||
@exclusions.each do |pattern| | ||
|
@@ -625,6 +632,50 @@ def run_bff | |
FileUtils.cp "/tmp/chef.#{bff_version}.bff", "/var/cache/omnibus/pkg/chef.#{bff_version}.bff" | ||
end | ||
|
||
def run_pkgmk | ||
system "sudo rm -rf /tmp/pkgmk" | ||
FileUtils.mkdir "/tmp/pkgmk" | ||
|
||
system "find #{install_path} -print > /tmp/pkgmk/files" | ||
|
||
File.open "/tmp/pkgmk/Prototype", "w+" do |f| | ||
f.write <<-EOF | ||
i pkginfo | ||
i postinstall | ||
i postremove | ||
EOF | ||
end | ||
|
||
system "pkgproto < /tmp/pkgmk/files >> /tmp/pkgmk/Prototype" | ||
|
||
File.open "/tmp/pkgmk/pkginfo", "w+" do |f| | ||
f.write <<-EOF | ||
CLASSES=none | ||
TZ=PST | ||
PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin | ||
BASEDIR=/ | ||
PKG=chef | ||
NAME=chef | ||
ARCH=sparc | ||
VERSION=11.8.0.alpha.0-166-g918ae91-1.solaris2.5.9 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. derp, that is still hardcoded... along with the PSTAMP later... |
||
CATEGORY=application | ||
DESC=The full stack of chef | ||
VENDOR=Opscode, Inc. | ||
EMAIL=Opscode, Inc. | ||
PSTAMP=build-oss-sol9-sparc20130913220319 | ||
EOF | ||
end | ||
|
||
FileUtils.cp "#{package_scripts_path}/postinst", "/tmp/pkgmk/postinstall" | ||
FileUtils.cp "#{package_scripts_path}/postrm", "/tmp/pkgmk/postremove" | ||
|
||
run_package_command(pkgmk_command) | ||
|
||
system "pkgchk -vd /tmp/pkgmk chef" | ||
|
||
system "pkgtrans /tmp/pkgmk /var/cache/omnibus/pkg/#{output_package("pkgmk")} chef" | ||
end | ||
|
||
# Runs the necessary command to make a package with fpm. As a side-effect, | ||
# sets `output_package` | ||
# @return void | ||
|
@@ -676,6 +727,8 @@ def render_tasks | |
run_msi | ||
elsif pkg_type == "bff" | ||
run_bff | ||
elsif pkg_type == "pkgmk" | ||
run_pkgmk | ||
else # pkg_type == "fpm" | ||
run_fpm(pkg_type) | ||
end | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I think this bit would be easier to read to store the heredoc value into a local variable and then write it out to file in a subsequent step. What's confusing is the f.write <<-EOF nested stuff.