Class: KnifeSolo::Bootstraps::FreeBSD

Inherits:
Base
  • Object
show all
Defined in:
lib/knife-solo/bootstraps/freebsd.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #run_pre_bootstrap_checks

Methods included from InstallCommands

#bootstrap!, #gem_install, #gem_options, #gem_packages, #http_client_get_url, #install_ohai_hints, #omnibus_install, #omnibus_options

Methods included from Delegates

#chef_version, #prepare, #run_command, #stream_command, #ui

Constructor Details

This class inherits a constructor from KnifeSolo::Bootstraps::Base

Instance Method Details

#distroObject



43
44
45
46
47
48
49
50
51
# File 'lib/knife-solo/bootstraps/freebsd.rb', line 43

def distro
  return @distro if @distro
  case issue
  when %r{FreeBSD 9\.[01]}
    {:type => 'freebsd_port'}
  else
    raise "#{issue} not supported"
  end
end

#freebsd_port_installObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/knife-solo/bootstraps/freebsd.rb', line 14

def freebsd_port_install
  ui.msg "Updating ports tree..."

  if Dir["/usr/ports/*"].empty?
    run_command("portsnap fetch extract")
  else
    run_command("portsnap update")
  end

  prepare_make_conf

  ui.msg "Installing required ports..."
  packages = %w(net/rsync ftp/curl lang/ruby19 devel/ruby-gems
                converters/ruby-iconv devel/rubygem-rake
                shells/bash)

  packages.each do |p|
    ui.msg "Installing #{p}..."
    result = run_command <<-SH
      cd /usr/ports/#{p} && make -DBATCH -DFORCE_PKG_REGISTER install clean
    SH
    raise "Couldn't install #{p} from ports." unless result.success?
  end

  ui.msg "...done installing ports."

  gem_install # chef
end

#issueObject



3
4
5
# File 'lib/knife-solo/bootstraps/freebsd.rb', line 3

def issue
  run_command("uname -sr").stdout.strip
end

#prepare_make_confObject



7
8
9
10
11
12
# File 'lib/knife-solo/bootstraps/freebsd.rb', line 7

def prepare_make_conf
  ui.msg "Preparing make.conf"
  run_command <<-EOF
    echo 'RUBY_DEFAULT_VER=1.9' >> /etc/make.conf
  EOF
end