lib/kiwi_config.rb in machinery-tool-1.16.4 vs lib/kiwi_config.rb in machinery-tool-1.17.0

- old
+ new

@@ -27,10 +27,11 @@ @system_description.assert_scopes( "repositories", "packages", "os" ) + check_exported_os check_existance_of_extracted_files check_repositories generate_config end @@ -99,11 +100,11 @@ next if !@system_description.scope_extracted?(scope) output_root_path = File.join(output_location, "root") FileUtils.mkdir_p(output_root_path) - @system_description[scope].files.each do |file| + @system_description[scope].each do |file| if file.deleted? @sh << "rm -rf '#{quote(file.name)}'\n" elsif file.directory? @sh << <<EOF chmod #{file.mode} '#{quote(file.name)}' @@ -170,27 +171,29 @@ ) ) end end + def check_exported_os + unless @system_description.os.is_a?(OsSuse) + raise Machinery::Errors::ExportFailed.new( + "Export is not possible because the operating system " \ + "'#{@system_description.os.display_name}' is not supported." + ) + end + end + def generate_config @sh = <<EOF test -f /.kconfig && . /.kconfig test -f /.profile && . /.profile baseMount suseSetupProduct suseImportBuildKey suseConfig EOF - unless @system_description.os.is_a?(OsSuse) - raise Machinery::Errors::ExportFailed.new( - "Export is not possible because the operating system " \ - "'#{@system_description.os.display_name}' is not supported." - ) - end - builder = Nokogiri::XML::Builder.new do |xml| xml.image(schemaversion: "5.8", name: @system_description.name) do xml.description(type: "system") do xml.author "Machinery" xml.contact "" @@ -290,21 +293,21 @@ if @system_description["services"] init_system = @system_description["services"].init_system case init_system when "sysvinit" - @system_description["services"].services.each do |service| + @system_description["services"].each do |service| if service.state == "on" @sh << "chkconfig #{service.name} on\n" else @sh << "chkconfig #{service.name} off\n" end end when "systemd" # possible systemd service states: # http://www.freedesktop.org/software/systemd/man/systemctl.html#Unit%20File%20Commands - @system_description["services"].services.each do |service| + @system_description["services"].each do |service| case service.state when "enabled" @sh << "systemctl enable #{service.name}\n" when "disabled" @sh << "systemctl disable #{service.name}\n"