36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/danarchy_deploy/system.rb', line 36
def self.prep_operating_system(deployment, options)
(installer, updater, cleaner) = nil
os = deployment[:os]
if deployment[:system]
if deployment[:system][:archives]
puts " > Deploying system archives"
DanarchyDeploy::Archiver.new(deployment[:system][:archives], options)
end
if deployment[:system][:templates]
puts "\n > Configuring system templates for #{deployment[:os]}"
DanarchyDeploy::Templater.new(deployment[:system][:templates], options)
deployment[:system][:templates].each do |t|
if t[:target] == '/etc/fstab'
t[:variables].each do |v|
if !Dir.exist?(v[:mountpoint])
puts "Creating mountpoint: #{v[:mountpoint]}"
FileUtils.mkdir_p(v[:mountpoint]) if !options[:pretend]
end
end
end
end
end
end
puts "\n > Mounting Filesystems"
if !options[:pretend]
mount_result = DanarchyDeploy::Helpers.run_command('mount -a', options)
abort(' |! Failed to mount filesystems!') if mount_result[:stderr]
end
if os.downcase == 'gentoo'
(installer, updater, cleaner) = DanarchyDeploy::System::Gentoo.new(deployment, options)
elsif %w[debian ubuntu].include?(os.downcase)
(installer, updater, cleaner) = DanarchyDeploy::System::Debian.new(deployment, options)
elsif os.downcase == 'opensuse'
puts 'OpenSUSE is not fully supported yet!'
(installer, updater, cleaner) = DanarchyDeploy::System::OpenSUSE.new(deployment, options)
elsif %w[centos redhat].include?(os.downcase)
puts 'CentOS/RedHat is not fully supported yet!'
(installer, updater, cleaner) = DanarchyDeploy::System::CentOS.new(deployment, options)
end
[installer, updater, cleaner]
end
|