Class: Yast::DesktopFinishClient

Inherits:
Installation::FinishClient
  • Object
show all
Defined in:
src/lib/installation/clients/desktop_finish.rb

Instance Method Summary collapse

Constructor Details

#initializeDesktopFinishClient

Returns a new instance of DesktopFinishClient



43
44
45
# File 'src/lib/installation/clients/desktop_finish.rb', line 43

def initialize
  textdomain "installation"
end

Instance Method Details

#modesObject



51
52
53
# File 'src/lib/installation/clients/desktop_finish.rb', line 51

def modes
  [:installation, :autoinst]
end

#titleObject



47
48
49
# File 'src/lib/installation/clients/desktop_finish.rb', line 47

def title
  _("Initializing default window manager...")
end

#writeObject



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
85
86
87
88
89
90
91
92
93
94
95
# File 'src/lib/installation/clients/desktop_finish.rb', line 55

def write
  selected_desktop = DefaultDesktop.Desktop
  log.info "Selected desktop: #{selected_desktop}"

  if selected_desktop.nil?
    log.info "no desktop set, skipping."
    return nil
  end

  desktop_map = DefaultDesktop.GetAllDesktopsMap[selected_desktop]
  raise "Selected desktop '#{selected_desktop}' missing in desktops map" unless desktop_map

  log.info "selected desktop #{desktop_map}"

  default_dm = desktop_map["logon"] || ""
  default_wm = desktop_map["desktop"] || ""
  default_cursor = desktop_map["cursor"] || ""

  SCR.Write(path(".sysconfig.windowmanager.DEFAULT_WM"), default_wm)
  SCR.Write(
    path(".sysconfig.windowmanager.X_MOUSE_CURSOR"),
    default_cursor
  )
  SCR.Write(path(".sysconfig.windowmanager"), nil)

  dpmng_file = "/etc/sysconfig/displaymanager"
  # Creates an empty sysconfig file if it doesn't exist
  if !FileUtils.Exists(dpmng_file) &&
      FileUtils.Exists("/usr/bin/touch")
    log.info "Creating file #{dpmng_file}"
    Yast::Execute.on_target("/usr/bin/touch", dpmng_file)
  end

  SCR.Write(
    path(".sysconfig.displaymanager.DISPLAYMANAGER"),
    default_dm
  )
  SCR.Write(path(".sysconfig.displaymanager"), nil)

  nil
end