Skip to content

Commit

Permalink
Customize ownership as an option passed through to pkgbuild
Browse files Browse the repository at this point in the history
Reverts back to the previous default behavior and add custom ownership
as an option
  • Loading branch information
garnierclement committed Jul 28, 2014
1 parent e7c20c6 commit 5b630de
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion brew-pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,35 @@ def pkg
end
end

# Custom ownership
found_ownership = false
if ARGV.include? '--ownership'
custom_ownership = ARGV.next
if ['recommended', 'preserve', 'preserve-other'].include? custom_ownership
found_ownership = true
ohai "Setting pkgbuild option --ownership with value #{custom_ownership}"
else
opoo "#{custom_ownership} is not a valid value for pkgbuild --ownership option, ignoring"
end
end

# Build it
pkgfile = "#{name}-#{version}.pkg"
ohai "Building package #{pkgfile}"
args = [
"--quiet",
"--root", "#{pkg_root}",
"--identifier", identifier,
"--ownership", "preserve",
"--version", version
]
if found_scripts
args << "--scripts"
args << scripts_path
end
if found_ownership
args << "--ownership"
args << custom_ownership
end
args << "#{pkgfile}"
safe_system "pkgbuild", *args

Expand Down

0 comments on commit 5b630de

Please sign in to comment.