Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion brew-pkg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def with_deps?

# cribbed Homebrew module code from brew-unpack.rb
module Homebrew extend self
include Utils::Output::Mixin
def pkg
unpack_usage = <<-EOS
Usage: brew pkg [--identifier-prefix] [--with-deps] [--without-kegs] formula
Expand Down Expand Up @@ -57,7 +58,7 @@ def pkg
FileUtils.mkdir_p staging_root


pkgs = [f]
pkgs = [ARGV.last]

# Add deps if we specified --with-deps
pkgs += f.recursive_dependencies if ARGV.include? '--with-deps'
Expand Down Expand Up @@ -85,10 +86,22 @@ def pkg

safe_system "mkdir", "-p", "#{staging_root}/Cellar/#{formula.name}/"
safe_system "rsync", "-a", "#{HOMEBREW_CELLAR}/#{formula.name}/#{dep_version}", "#{staging_root}/Cellar/#{formula.name}/"
safe_system "mkdir", "-p", "#{staging_root}/opt"
safe_system "ln", "-s", "../Cellar/#{formula.name}/#{dep_version}", "#{staging_root}/opt/#{formula.name}"
end

end

# Stage etc/ files for this formula (e.g. openssl@3 CA certs, config files)
# These live outside the Cellar at HOMEBREW_PREFIX/etc/<formula_name>/
# and are typically created during `brew postinstall`.
etc_dir = File.join(HOMEBREW_PREFIX, "etc", formula.name)
if File.exist?(etc_dir)
ohai "Staging etc directory #{etc_dir}"
safe_system "mkdir", "-p", "#{staging_root}/etc/"
safe_system "rsync", "-a", "#{etc_dir}", "#{staging_root}/etc/"
end

# Write out a LaunchDaemon plist if we have one
if formula.service?
ohai "Plist found at #{formula.plist_name}, staging for /Library/LaunchDaemons/#{formula.plist_name}.plist"
Expand Down