Module: Yum

Defined in:
lib/deprec/centostrano.rb

Instance Method Summary collapse

Instance Method Details

#enable_repository(name) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/deprec/centostrano.rb', line 7

def enable_repository(name)
  case name
  when :rpmforge
    rpm_install("http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.`uname -i`.rpm")
  when :epel
    sudo "sudo test -f /etc/yum.repos.d/epel.repo || sudo rpm -U http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm"
  end
end

#install_from_src(src_package, src_dir) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/deprec/centostrano.rb', line 24

def install_from_src(src_package, src_dir)
  package_dir = File.join(src_dir, src_package[:dir])
  deprec2.unpack_src(src_package, src_dir)
  enable_repository :rpmforge
  enable_repository :epel
  rpm_install("http://www.asic-linux.com.mx/~izto/checkinstall/files/rpm/checkinstall-1.6.1-1.i386.rpm") 
  apt.install( {:base => %w(gcc gcc-c++ make patch rpm-build which)}, :stable )
  # XXX replace with invoke_command
  sudo <<-SUDO
  sh -c '
  cd #{package_dir};
  #{src_package[:configure]}
  #{src_package[:make]}
  sudo /usr/local/sbin/checkinstall -y -R --install --pkgversion=#{src_package[:version]}  --pkgrelease=#{src_package[:release]} #{src_package[:install]}
  #{src_package[:post_install]}
  '
  SUDO
  #/usr/local/sbin/checkinstall --fstrans=no -y -R #{src_package[:install]}
end

#rpm_install(packages, options = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/deprec/centostrano.rb', line 16

def rpm_install(packages, options={})
  send(run_method, "wget -Ncq #{[*packages].join(' ')}", options)
  files=[*packages].collect { |package| File.basename(package) }
  # TODO hmm... This should me replaces with something more smart, like check if package is already installed
  send(run_method, "rpm -U --force  #{files.join(' ')}", options)
  send(run_method, "rm #{files.join(' ')}", options)
end