Skip to content

Commit

Permalink
Add class homebrew to install Homebrew itself.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernalbers committed Aug 23, 2012
1 parent 42cca80 commit 3ae9742
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
20 changes: 20 additions & 0 deletions manifests/compiler.pp
@@ -0,0 +1,20 @@
class homebrew::compiler {
if $has_compiler == 'true' {
$package = [ ]
}
elsif versioncmp($macosx_productversion_major, '10.7') < 0 {
warn('Please install the Command Line Tools bundled with XCode manually!')
$package = [ ]
}
else {
notice('Installing Command Line Tools.')
$package = $homebrew::command_line_tools_package
$source = $homebrew::command_line_tools_source
}

package { $package:
ensure => present,
provider => pkgdmg,
source => $source,
}
}
7 changes: 7 additions & 0 deletions manifests/init.pp
@@ -0,0 +1,7 @@
class homebrew(
$command_line_tools_package = $homebrew::params::command_line_tools_package,
$command_line_tools_source = $homebrew::params::command_line_tools_source,
$user = $homebrew::params::user
) inherits homebrew::params {
include homebrew::compiler, homebrew::install
}
42 changes: 42 additions & 0 deletions manifests/install.pp
@@ -0,0 +1,42 @@
class homebrew::install {
$directories = [ '/usr/local',
'/usr/local/bin',
'/usr/local/etc',
'/usr/local/include',
'/usr/local/lib',
'/usr/local/lib/pkgconfig',
'/usr/local/Library',
'/usr/local/sbin',
'/usr/local/share',
'/usr/local/var',
'/usr/local/var/log',
'/usr/local/share/locale',
'/usr/local/share/man',
'/usr/local/share/man/man1',
'/usr/local/share/man/man2',
'/usr/local/share/man/man3',
'/usr/local/share/man/man4',
'/usr/local/share/man/man5',
'/usr/local/share/man/man6',
'/usr/local/share/man/man7',
'/usr/local/share/man/man8',
'/usr/local/share/info',
'/usr/local/share/doc',
'/usr/local/share/aclocal' ]

file { $directories:
ensure => directory,
owner => $homebrew::user,
group => 'admin',
mode => 0775,
}

exec { 'install-homebrew':
cwd => '/usr/local',
command => "/usr/bin/su ${homebrew::user} -c '/bin/bash -o pipefail -c \"/usr/bin/curl -skSfL https://github.com/mxcl/homebrew/tarball/master | /usr/bin/tar xz -m --strip 1\"'",
creates => '/usr/local/bin/brew',
logoutput => on_failure,
timeout => 0,
require => File[$directories],
}
}
10 changes: 10 additions & 0 deletions manifests/params.pp
@@ -0,0 +1,10 @@
class homebrew::params {
if $operatingsystem != 'Darwin' {
err('This Module works on Mac OS X only!')
fail('Exit')
}

$command_line_tools_package = 'command_line_tools_for_xcode_os_x_lion_aug_2013.dmg'
$command_line_tools_source = 'http://puppet/command_line_tools_for_xcode_os_x_lion_aug_2013.dmg'
$user = 'root'
}

0 comments on commit 3ae9742

Please sign in to comment.