Class: Machinery::KiwiConfig

Inherits:
Exporter show all
Defined in:
lib/kiwi_config.rb

Overview

Copyright © 2013-2016 SUSE LLC

This program is free software; you can redistribute it and/or modify it under the terms of version 3 of the GNU General Public License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, contact SUSE LLC.

To contact SUSE about this file by physical or electronic mail, you may find current contact information at www.suse.com

Instance Attribute Summary collapse

Attributes inherited from Exporter

#system_description

Instance Method Summary collapse

Methods inherited from Exporter

#quote

Constructor Details

#initialize(system_description, options = {}) ⇒ KiwiConfig

Returns a new instance of KiwiConfig.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/kiwi_config.rb', line 22

def initialize(system_description, options = {})
  @name = "kiwi"
  @system_description = system_description
  @options = options

  @system_description.assert_scopes(
    "repositories",
    "packages",
    "os"
  )
  check_exported_os
  check_existance_of_extracted_files
  check_repositories
  generate_config
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



20
21
22
# File 'lib/kiwi_config.rb', line 20

def name
  @name
end

#shObject

Returns the value of attribute sh.



19
20
21
# File 'lib/kiwi_config.rb', line 19

def sh
  @sh
end

#xml_textObject

Returns the value of attribute xml_text.



19
20
21
# File 'lib/kiwi_config.rb', line 19

def xml_text
  @xml_text
end

Instance Method Details

#export_nameObject



54
55
56
# File 'lib/kiwi_config.rb', line 54

def export_name
  "#{@system_description.name}-kiwi"
end

#write(output_location) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/kiwi_config.rb', line 38

def write(output_location)
  inject_users_and_groups(output_location)
  inject_extracted_files(output_location)

  @sh << "baseCleanMount\n"
  @sh << "exit 0\n"
  File.write(File.join(output_location, "config.xml"), xml_text)
  File.write(File.join(output_location, "config.sh"), @sh)
  FileUtils.cp(
     File.join(Machinery::ROOT, "export_helpers/kiwi_export_readme.md"),
     File.join(output_location, "README.md")
  )

  post_process_config(output_location)
end