Sha256: 0d4d4adae7bb692daf4af703c8da93c49a983ed0b4ac1b6937042b7f417fe016
Contents?: true
Size: 1.62 KB
Versions: 9
Compression:
Stored size: 1.62 KB
Contents
# == PackageManager::DPKG # # The DPKG driver for the PackageManager provides a way to manage software # packages on Debian-style systems using <tt>dpkg</tt>. class AutomateIt::PackageManager::DPKG < AutomateIt::PackageManager::BaseDriver depends_on :programs => %w(dpkg) # See AutomateIt::PackageManager#installed? def installed?(*packages) return _installed_helper?(*packages) do |list, opts| ### data = `dpkg --status nomarch apache2 not_a_real_package 2>&1` cmd = "dpkg --status "+list.join(" ")+" 2>&1" log.debug(PEXEC+cmd) data = `#{cmd}` matches = data.scan(/^Package: (.+)$\s*^Status: (.+)$/) available = matches.inject([]) do |sum, match| package, status = match sum << package if status.match(/(?:^|\s)installed\b/) sum end available end end # See AutomateIt::PackageManager#not_installed? def not_installed?(*packages) return _not_installed_helper?(*packages) end # See AutomateIt::PackageManager#install def install(*packages) return _install_helper(*packages) do |list, opts| cmd = "export DEBIAN_FRONTEND=noninteractive; dpkg --install --skip-same-version "+list.join(" ")+" < /dev/null" cmd << " > /dev/null" if opts[:quiet] cmd << " 2>&1" interpreter.sh(cmd) end end # See AutomateIt::PackageManager#uninstall def uninstall(*packages) return _uninstall_helper(*packages) do |list, opts| cmd = "export DEBIAN_FRONTEND=noninteractive; dpkg --remove "+list.join(" ")+" < /dev/null" cmd << " > /dev/null" if opts[:quiet] cmd << " 2>&1" interpreter.sh(cmd) end end end
Version data entries
9 entries across 9 versions & 2 rubygems