Module: ChefApply::TargetHost::MacOS
- Defined in:
- lib/chef_apply/target_host/macos.rb
Instance Method Summary collapse
- #chown(path, owner) ⇒ Object
- #del_dir(path) ⇒ Object
- #del_file(path) ⇒ Object
- #install_package(remote_path) ⇒ Object
- #make_temp_dir ⇒ Object
- #mkdir(path) ⇒ Object
- #omnibus_manifest_path ⇒ Object
- #ws_cache_path ⇒ Object
Instance Method Details
#chown(path, owner) ⇒ Object
32 33 34 35 36 |
# File 'lib/chef_apply/target_host/macos.rb', line 32 def chown(path, owner) owner ||= user run_command!("chown #{owner} '#{path}'") nil end |
#del_dir(path) ⇒ Object
52 53 54 |
# File 'lib/chef_apply/target_host/macos.rb', line 52 def del_dir(path) del_file(path) end |
#del_file(path) ⇒ Object
48 49 50 |
# File 'lib/chef_apply/target_host/macos.rb', line 48 def del_file(path) run_command!("rm -rf #{path}") end |
#install_package(remote_path) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/chef_apply/target_host/macos.rb', line 38 def install_package(remote_path) install_cmd = <<-EOS hdiutil detach "/Volumes/chef_software" >/dev/null 2>&1 || true hdiutil attach #{remote_path} -mountpoint "/Volumes/chef_software" cd / && sudo /usr/sbin/installer -pkg `sudo find "/Volumes/chef_software" -name \\*.pkg` -target / EOS run_command!(install_cmd) nil end |
#make_temp_dir ⇒ Object
56 57 58 59 60 61 |
# File 'lib/chef_apply/target_host/macos.rb', line 56 def make_temp_dir installer_dir = "/tmp/chef-installer" run_command!("mkdir -p #{installer_dir}") run_command!("chmod 777 #{installer_dir}") installer_dir end |
#mkdir(path) ⇒ Object
28 29 30 |
# File 'lib/chef_apply/target_host/macos.rb', line 28 def mkdir(path) run_command!("mkdir -p #{path}") end |
#omnibus_manifest_path ⇒ Object
21 22 23 24 25 26 |
# File 'lib/chef_apply/target_host/macos.rb', line 21 def omnibus_manifest_path # TODO - if habitat install on target, this won't work # Note that we can't use File::Join, because that will render for the # CURRENT platform - not the platform of the target. "/opt/chef/version-manifest.json" end |
#ws_cache_path ⇒ Object
63 64 65 |
# File 'lib/chef_apply/target_host/macos.rb', line 63 def ws_cache_path "/var/chef-workstation" end |