Class: Babushka::AptHelper

Inherits:
PkgHelper show all
Defined in:
lib/babushka/pkg_helpers/apt_helper.rb

Class Method Summary collapse

Methods inherited from PkgHelper

all_manager_keys, bin_path, cmd_in_path?, handle_install!, has?, install!, prefix, present?, should_sudo?, update_pkg_lists

Methods included from ShellHelpers

cmd_dir, current_username, log_shell, login_shell, raw_shell, shell, shell!, shell?, shell_cmd, sudo, which

Methods included from LogHelpers

debug, deprecated!, log, log_block, log_error, log_ok, log_stderr, log_warn, removed!

Class Method Details

.manager_depObject



12
13
14
# File 'lib/babushka/pkg_helpers/apt_helper.rb', line 12

def manager_dep
  'apt'
end

.manager_keyObject



6
# File 'lib/babushka/pkg_helpers/apt_helper.rb', line 6

def manager_key; :apt end

.pkg_binaryObject



8
9
10
# File 'lib/babushka/pkg_helpers/apt_helper.rb', line 8

def pkg_binary
  @_cached_pkg_binary ||= which('aptitude') ? 'aptitude' : 'apt-get'
end

.pkg_cmdObject



5
# File 'lib/babushka/pkg_helpers/apt_helper.rb', line 5

def pkg_cmd; "env DEBCONF_TERSE='yes' DEBIAN_PRIORITY='critical' DEBIAN_FRONTEND='noninteractive' #{pkg_binary}" end

.pkg_typeObject



4
# File 'lib/babushka/pkg_helpers/apt_helper.rb', line 4

def pkg_type; :deb end

.source_for_systemObject



25
26
27
28
29
30
# File 'lib/babushka/pkg_helpers/apt_helper.rb', line 25

def source_for_system
  {
    :debian => 'http://ftp.debian.org/debian',
    :ubuntu => 'http://archive.ubuntu.com/ubuntu'
  }[Babushka.host.flavour]
end

.update_pkg_lists_if_requiredObject



16
17
18
19
20
21
22
23
# File 'lib/babushka/pkg_helpers/apt_helper.rb', line 16

def update_pkg_lists_if_required
  wait_for_dpkg
  if !File.exists? '/var/lib/apt/lists/lock'
    update_pkg_lists "Looks like apt hasn't been used on this system yet. Updating"
  else
    super
  end
end