summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2021-02-05 22:07:10 -0800
committerTim Smith <tsmith84@gmail.com>2021-02-05 22:07:10 -0800
commitd0ef29c959b1ac11132652a7a8cfe2cb7aa62e1f (patch)
tree3b3abe726a10cc23c1ae5e2ff20d635dcec60fb4
parentb47b36da6650b682153c81f7026ca7f899a25e21 (diff)
downloadchef-homebrew_install.tar.gz
Setup the git repo and use archive_filehomebrew_install
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/homebrew_install.rb29
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/chef/resource/homebrew_install.rb b/lib/chef/resource/homebrew_install.rb
index 9616973443..4b679d2223 100644
--- a/lib/chef/resource/homebrew_install.rb
+++ b/lib/chef/resource/homebrew_install.rb
@@ -94,6 +94,21 @@ class Chef
action :create
end
+ script "Initialize the homebrew git source" do
+ interpreter "bash"
+ cwd "/usr/local/Homebrew"
+ code <<-CODEBLOCK
+ git init -q
+ git config remote.origin.url https://github.com/Homebrew/homebrew-core
+ git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
+ git config core.autocrlf false
+ git fetch --force origin refs/heads/master:refs/remotes/origin/master
+ git remote set-head origin --auto >/dev/null
+ git reset --hard origin/master\
+ CODEBLOCK
+ user "root"
+ end
+
if new_resource.xcode_tools_url
dmg_package new_resource.xcode_tools_pkg_name do
source new_resource.xcode_tools_url
@@ -114,14 +129,12 @@ class Chef
action :create
end
- script "Download and unpack Homebrew" do
- interpreter "bash"
- cwd "/usr/local/Homebrew"
- code <<-CODEBLOCK
- git init -q
- unzip #{zip_file} -d /usr/local/Homebrew
- CODEBLOCK
- user new_resource.user
+
+ archive_file "Unpack the existing Homebrew files" do
+ path zip_file
+ destination "/usr/local/Homebrew"
+ action :extract
+ overwrite true
end
script "move files to their correct locations" do