Class: Plat4m::Sniffer::Linux::Apt
- Inherits:
-
NixManager
- Object
- PkgManager
- NixManager
- Plat4m::Sniffer::Linux::Apt
- Defined in:
- lib/plat4m/sniff/linux.rb
Instance Method Summary collapse
Methods inherited from NixManager
#initialize, #make_install_command, #make_uninstall_command
Methods inherited from PkgManager
#has_sudo?, #initialize, #install, #is_root?, #make_install_command, #make_uninstall_command, #select_available, #select_uninstalled, #uninstall
Constructor Details
This class inherits a constructor from Plat4m::Sniffer::Linux::NixManager
Instance Method Details
#available?(pkg) ⇒ Boolean
141 142 143 |
# File 'lib/plat4m/sniff/linux.rb', line 141 def available?(pkg) apt_cache.include?(pkg) end |
#installed?(pkg) ⇒ Boolean
134 135 136 137 138 139 |
# File 'lib/plat4m/sniff/linux.rb', line 134 def installed?(pkg) # get architecture system("dpkg-query -s \"#{pkg}:#{pkg_arch}\" >/dev/null 2>&1") || system("dpkg-query -s \"#{pkg}:all\" >/dev/null 2>&1") || (`dpkg-query -s \"#{pkg}\" 2>/dev/null`.strip =~ /Architecture: (#{pkg_arch}|all)/) end |