Class: KiwiConfig

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

Overview

Copyright © 2013-2015 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

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
# 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_existance_of_extraced_files

  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

#xmlObject

Returns the value of attribute xml.



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

def xml
  @xml
end

Instance Method Details

#export_nameObject



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

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

#write(output_location) ⇒ Object



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

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.to_xml)
  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