Class: DanarchyDeploy::System::Debian

Inherits:
Object
  • Object
show all
Defined in:
lib/danarchy_deploy/system/debian.rb

Class Method Summary collapse

Class Method Details

.new(deployment, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/danarchy_deploy/system/debian.rb', line 6

def self.new(deployment, options)
  puts "\n" + self.name
  puts "#{deployment[:os].capitalize} detected! Using apt."

  set_hostname(deployment[:hostname]) if !options[:pretend]
  if deployment[:apt]
    if deployment[:apt][:templates]
      puts "\nChecking Apt configs."
      DanarchyDeploy::Templater.new(deployment[:apt][:templates], options)
    end

    if deployment[:apt][:gpgkeys]
      puts "\nInstalling Apt GPG Keys."
      install_gpgkeys(deployment[:apt][:gpgkeys], options)
    end
  end

  nonint = 'export DEBIAN_FRONTEND=noninteractive ; '
  installer  = nonint + 'apt-get install -y '
  installer += '--dry-run ' if options[:pretend]
  updater = nonint + 'apt-get upgrade -y '
  cleaner = nonint + 'apt-get autoclean -y '

  puts "\nUpdating Apt repos..."
  DanarchyDeploy::Helpers.run_command(nonint + 'apt-get update', options)

  [installer, updater, cleaner]
end