Sha256: 3f1e2a4f941c8942143e1046fe76186d1fdd11cecc1ec44c9e522f959ddad36b

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

module KnifeSolo::Bootstraps
  class FreeBSD < Base
    def issue
      run_command("uname -sr").stdout.strip
    end

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

    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

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
knife-solo-0.7.0 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.7.0.pre3 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.7.0.pre2 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.7.0.pre lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.6.0 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.4.3 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.5.1 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.5.0 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.4.2 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.4.1 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.4.0 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.3.0 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.3.0.pre5 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.3.0.pre4 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.3.0.pre3 lib/knife-solo/bootstraps/freebsd.rb
knife-solo-0.3.0.pre2 lib/knife-solo/bootstraps/freebsd.rb