Skip to content

Commit

Permalink
- moved system_has_windows? to Timezone module
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Sep 23, 2016
1 parent 9fba6b1 commit 29c8817
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
1 change: 1 addition & 0 deletions package/yast2-country.spec
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ BuildRequires: rubygem(rspec)
BuildRequires: yast2-core >= 3.1.12
# RSpec extensions for YaST
BuildRequires: yast2-ruby-bindings >= 3.1.26
BuildRequires: yast2-storage-ng

Requires: yast2-trans-stats yast2-perl-bindings timezone
# XVersion.ycp
Expand Down
21 changes: 2 additions & 19 deletions timezone/src/clients/inst_timezone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,28 @@
# Client for initial timezone setting (part of installation sequence)
# Author: Jiri Suchomel <jsuchome@suse.cz>

require "storage"
require "y2storage"

module Yast
class InstTimezoneClient < Client
def main
Yast.import "UI"
Yast.import "GetInstArgs"
Yast.import "Stage"
Yast.import "Wizard"
Yast.import "Timezone"

Yast.include self, "timezone/dialogs.rb"

@args = GetInstArgs.argmap
@args["first_run"] = "yes" unless @args["first_run"] == "no"

if Stage.initial && system_has_windows?
if Stage.initial && Timezone.system_has_windows?
Timezone.windows_partition = true
Builtins.y2milestone("windows partition found: assuming local time")
end

full_size_timezone_dialog
end

# Checks whether the system has Windows installed on a primary partition with NTFS
def system_has_windows?
storage = Y2Storage::StorageManager.instance
Storage::Ntfs::all(storage.probed).each do |ntfs|
ntfs.blk_devices.each do |blk_device|
if Storage::partition?(blk_device)
if Storage::to_partition(blk_device).type == Storage::PartitionType_PRIMARY
return true if ntfs.detect_content_info.windows?
end
end
end
end
false
end

# While the rest of the installation dialogs have enough room
# to have the title on the left (bnc#868859), this one needs the space
# for the world map.
Expand Down
23 changes: 21 additions & 2 deletions timezone/src/modules/Timezone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
# Summary: Timezone related stuff
# Authors: Klaus Kaempf <kkaempf@suse.de>
# Thomas Roelz <tom@suse.de>
#
# $Id$

require "storage"
require "y2storage"

require "yast"

module Yast
Expand Down Expand Up @@ -984,6 +986,23 @@ def Summary
HTML.List(ret)
end


# Checks whether the system has Windows installed on a primary partition with NTFS
def system_has_windows?
storage = Y2Storage::StorageManager.instance
Storage::Ntfs::all(storage.probed).each do |ntfs|
ntfs.blk_devices.each do |blk_device|
if Storage::partition?(blk_device)
if Storage::to_partition(blk_device).type == Storage::PartitionType_PRIMARY
return true if ntfs.detect_content_info.windows?
end
end
end
end
false
end


publish :variable => :timezone, :type => "string"
publish :variable => :hwclock, :type => "string"
publish :variable => :default_timezone, :type => "string"
Expand Down

0 comments on commit 29c8817

Please sign in to comment.