Class: Yast::KickstartClass

Inherits:
Module
  • Object
show all
Defined in:
../../src/modules/Kickstart.rb

Instance Method Summary (collapse)

Instance Method Details

- (Array) Authentication

KS Authentication

Returns:

  • (Array)


502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File '../../src/modules/Kickstart.rb', line 502

def Authentication
  auth = Ops.get_map(@ksConfig, "auth", {})

  # NIS
  nis = {}
  security = {}
  ldap = {}


  if Ops.get_integer(auth, "enablenis", 0) == 1
    Ops.set(nis, "start_nis", true)
    if Builtins.haskey(auth, "nisdomain")
      Ops.set(nis, "nis_domain", Ops.get_string(auth, "nisdomain", ""))
    end
    if Builtins.haskey(auth, "nisserver")
      nisserver = [Ops.get_string(auth, "nisserver", "")]
      Ops.set(nis, "nis_servers", nisserver)
    end
  end

  if Ops.get_string(auth, "enablemd5", "0") == "1"
    Ops.set(security, "encryption", "md5")
  end


  if Ops.get_string(auth, "enableldapauth", "0") == "1"
    Ops.set(ldap, "start_ldap", true)
    if Builtins.haskey(auth, "nisdomain")
      Ops.set(ldap, "ldap_domain", Ops.get_string(auth, "ldapbasedn", ""))
    end
    if Builtins.haskey(auth, "ldapserver")
      Ops.set(ldap, "ldap_server", Ops.get_string(auth, "ldapserver", ""))
    end
    if Ops.get_integer(auth, "enableldaptls", 0) == 1
      Ops.set(ldap, "ldap_tls", true)
    end
  end

  [nis, ldap, security]
end

- (Hash) Bootloader

KS Bootloader

Returns:

  • (Hash)


545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# File '../../src/modules/Kickstart.rb', line 545

def Bootloader
  bl = Ops.get_map(@ksConfig, "bootloader", {})
  bootloader = {}
  if Ops.get_string(bl, "location", "") != "none"
    Ops.set(bootloader, "location", Ops.get_string(bl, "location", ""))
  else
    Ops.set(bootloader, "write_bootloader", false)
  end

  Ops.set(bootloader, "kernel_parameters", Ops.get_string(bl, "append", ""))
  if Builtins.haskey(bl, "linear") || Builtins.haskey(bl, "nolinear")
    Ops.set(
      bootloader,
      "linear",
      Ops.get_integer(bl, "linear", 0) == 1 ||
        Ops.get_integer(bl, "nolinear", 0) != 1
    )
  end
  # FIXME
  Ops.set(bootloader, "lba_support", Ops.get_integer(bl, "lba32", 0) == 1)
  deep_copy(bootloader)
end

- (Hash) General

KS General

Returns:

  • (Hash)

    general configuration



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File '../../src/modules/Kickstart.rb', line 119

def General
  general = {}

  # Language
  Ops.set(general, "language", Ops.get_string(@ksConfig, "language", ""))

  # Keyboard
  keyboard = {}
  if Builtins.haskey(@ksConfig, "keyboard")
    Yast.import "Keyboard"
    keyboards = Keyboard.keymap2yast
    Ops.set(
      keyboard,
      "keymap",
      Ops.get_string(
        keyboards,
        Ops.get_string(@ksConfig, "keyboard", ""),
        ""
      )
    )
  end

  Ops.set(general, "keyboard", keyboard)

  # Clock
  clock = {}
  if Builtins.haskey(@ksConfig, "timezone")
    ks_clock = Ops.get_map(@ksConfig, "timezone", {})
    Ops.set(clock, "timezone", Ops.get_string(ks_clock, "timezone", ""))
    Ops.set(
      clock,
      "hwclock",
      Ops.get_string(ks_clock, "utc", "") == "1" ? "GMT" : "localtime"
    )
  end
  Ops.set(general, "clock", clock)


  # Mode
  mode = {}
  Ops.set(
    mode,
    "confirm",
    Ops.get_integer(@ksConfig, "interactive", 0) == 1
  )
  Ops.set(general, "mode", mode)


  deep_copy(general)
end

- (Object) Kickstart

Constructor



32
33
34
# File '../../src/modules/Kickstart.rb', line 32

def Kickstart
  nil
end

- (Hash) KS2AY

Kickstart to AutoYaST main

Returns:

  • (Hash)


771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
# File '../../src/modules/Kickstart.rb', line 771

def KS2AY
  profile = {}

  # Scripts
  Ops.set(profile, "scripts", Scripts())
  Ops.set(profile, "networking", Ops.get_map(Network(), 0, {}))
  Ops.set(profile, "nis", Ops.get_map(Authentication(), 0, {}))
  Ops.set(profile, "ldap", Ops.get_map(Authentication(), 1, {}))
  Ops.set(profile, "security", Ops.get_map(Authentication(), 2, {}))
  Ops.set(profile, "users", Users())

  Ops.set(profile, "init", Ops.get_map(Network(), 1, {}))
  Ops.set(profile, "software", Software())
  Ops.set(profile, "partitioning", Partitioning())
  Ops.set(profile, "raid", Raid())
  Ops.set(profile, "bootloader", Bootloader())
  Ops.set(profile, "general", General())

  Profile.changed = true

  Builtins.y2debug("Profile : %1", profile)
  deep_copy(profile)
end

- (Object) main



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File '../../src/modules/Kickstart.rb', line 13

def main
  textdomain "autoinst"
  Yast.import "AutoinstConfig"
  Yast.import "AutoinstStorage"
  Yast.import "Popup"
  Yast.import "Profile"
  Yast.import "Y2ModuleConfig"
  Yast.import "FileSystems"

  Yast.include self, "autoinstall/xml.rb"


  @ksConfig = {}

  @ksfile = ""
  Kickstart()
end

- (Array) Network

KS Network

Returns:

  • (Array)


404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
# File '../../src/modules/Kickstart.rb', line 404

def Network
  Yast.import "IP"
  init = {}
  networking = {}
  dns = {}

  nameserver = []
  gateway = ""

  routing = {}
  rawNet = Ops.get_map(@ksConfig, "networking", {})
  interfaces = Builtins.maplist(rawNet) do |iface, data|
    interface = {}
    if Ops.get_string(data, "bootproto", "") == "dhcp"
      Ops.set(interface, "bootproto", "dhcp")
      Ops.set(interface, "device", iface)
      Ops.set(interface, "startmode", "onboot")
      Ops.set(init, "usedhcp", true)
    else
      Ops.set(interface, "device", iface)
      Ops.set(interface, "bootproto", "static")
      Ops.set(
        interface,
        "network",
        IP.ComputeNetwork(
          Ops.get_string(data, "ip", ""),
          Ops.get_string(data, "netmask", "")
        )
      )
      Ops.set(interface, "ipaddr", Ops.get_string(data, "ip", ""))
      Ops.set(interface, "netmask", Ops.get_string(data, "netmask", ""))
      Ops.set(interface, "startmode", "onboot")
      Ops.set(
        interface,
        "broadcast",
        IP.ComputeBroadcast(
          Ops.get_string(data, "ip", ""),
          Ops.get_string(data, "netmask", "")
        )
      )

      Ops.set(init, "ip", Ops.get_string(data, "ip", ""))
      Ops.set(init, "nameserver", Ops.get_string(data, "nameserver", ""))
      Ops.set(init, "netmask", Ops.get_string(data, "netmask", ""))
      Ops.set(init, "gateway", Ops.get_string(data, "gateway", ""))
      Ops.set(init, "netdevice", Ops.get_string(data, "device", ""))
      nameserver = [Ops.get_string(data, "nameserver", "")]
      gateway = Ops.get_string(data, "gateway", "")
    end
    deep_copy(interface)
  end

  searchlist = []

  hostname = ""
  domain = ""

  Ops.set(dns, "hostname", hostname)
  Ops.set(dns, "domain", domain)
  Ops.set(dns, "searchlist", searchlist)
  Ops.set(dns, "nameservers", nameserver)

  routes = []
  route = {}

  if gateway != ""
    Ops.set(route, "destination", "default")
    Ops.set(route, "device", "-")
    Ops.set(route, "gateway", gateway)
    Ops.set(route, "netmask", "-")
    routes = Builtins.add(routes, route)
  end
  routing = Builtins.add(routing, "routes", routes)
  routing = Builtins.add(routing, "ip_forwarding", false)

  Ops.set(networking, "interfaces", interfaces)
  Ops.set(networking, "dns", dns)
  Ops.set(networking, "routing", routing)


  # init
  if Builtins.haskey(@ksConfig, "nfs")
    nfs = Ops.get_map(@ksConfig, "nfs", {})
    Ops.set(init, "instmode", "nfs")
    Ops.set(init, "server", Ops.get_string(nfs, "server", ""))
    Ops.set(init, "serverdir", Ops.get_string(nfs, "dir", ""))
  end

  if Ops.get_integer(@ksConfig, "textmode", 0) == 1
    Ops.set(init, "textmode", true)
  end

  [networking, init]
end

- (Array) Partitioning

KS Partitioning

Returns:

  • (Array)


225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File '../../src/modules/Kickstart.rb', line 225

def Partitioning
  Builtins.y2milestone(
    "KS Partitioning: %1",
    Ops.get_map(@ksConfig, "partitioning", {})
  )
  Yast.import "Partitions"

  drives = []
  part1 = Builtins.maplist(Ops.get_map(@ksConfig, "partitioning", {})) do |k, v|
    drive = {}
    if Builtins.haskey(v, "ondisk")
      Ops.set(
        drive,
        "device",
        Builtins.sformat("/dev/%1", Ops.get_string(v, "ondisk", ""))
      )
    end
    Ops.set(drive, "partitions", [])
    drives = Builtins.add(drives, drive)
  end

  # sort and make unique entries
  drives = Builtins.toset(drives)
  Builtins.y2debug("Drives: %1", drives)
  Builtins.foreach(Ops.get_map(@ksConfig, "partitioning", {})) do |k, v|
    partition = {}
    mountlist = Builtins.splitstring(k, "_")
    mount = Ops.get_string(mountlist, 0, "/data")
    order = Builtins.tointeger(Ops.get_string(mountlist, 1, "0"))
    fstype = mount == "swap" ? "swap" : Ops.get_string(v, "fstype", "")
    partition_id = Partitions.fsid_native
    raiddevice = 0
    if Builtins.regexpmatch(mount, "^raid..*")
      Builtins.y2milestone("device: %1", mount)
      partition_id = Partitions.fsid_raid
      Ops.set(partition, "partition_id", partition_id)
      raiddevice = Builtins.tointeger(Builtins.substring(mount, 5, 1))

      Ops.set(
        partition,
        "raid_name",
        Builtins.sformat("/dev/md%1", raiddevice)
      )
      Ops.set(partition, "format", false)
    else
      Ops.set(partition, "mount", mount)
      Ops.set(partition, "order", order)
      Ops.set(partition, "format", Ops.get_string(v, "noformat", "") == "")
      Ops.set(partition, "filesystem", FileSystems.FsToSymbol(fstype))
    end
    Ops.set(
      partition,
      "size",
      Builtins.sformat("%1mb", Ops.get_string(v, "size", ""))
    )
    # Remove those later
    if Ops.get_string(v, "maxsize", "") != ""
      Ops.set(
        partition,
        "maxsize",
        Builtins.sformat("%1mb", Ops.get_string(v, "maxsize", ""))
      )
    end
    Ops.set(partition, "grow", true) if Ops.get_string(v, "grow", "") == "1"
    drives = Builtins.maplist(drives) do |d|
      dev = Builtins.sformat("/dev/%1", Ops.get_string(v, "ondisk", ""))
      if dev == Ops.get_string(d, "device", "")
        part = Ops.get_list(d, "partitions", [])
        part = Builtins.add(part, partition)
        Ops.set(d, "partitions", Builtins.sort(part) do |x, y|
          Ops.less_than(
            Ops.get_integer(x, "order", -1),
            Ops.get_integer(y, "order", -1)
          )
        end)
      elsif Ops.get_string(d, "device", "") == ""
        part = Ops.get_list(d, "partitions", [])
        part = Builtins.add(part, partition)
        Ops.set(d, "partitions", Builtins.sort(part) do |x, y|
          Ops.less_than(
            Ops.get_integer(x, "order", -1),
            Ops.get_integer(y, "order", -1)
          )
        end)
      end
      Builtins.y2milestone("KS Drive: %1", d)
      deep_copy(d)
    end
  end

  newdrives = Builtins.maplist(drives) do |drive|
    numpart = Builtins.size(Ops.get_list(drive, "partitions", []))
    Builtins.y2milestone("partitions count: %1", numpart)
    ismax = false
    # clean up
    dp = Builtins.maplist(Ops.get_list(drive, "partitions", [])) do |p|
      p = Builtins.remove(p, "order")
      deep_copy(p)
    end
    clearpart = Ops.get_map(@ksConfig, "clearpart", {})
    d = Builtins.splitstring(Ops.get_string(drive, "device", ""), "/")
    devicetok = Ops.get(d, 1, "")
    if devicetok != "" && Ops.get_string(clearpart, "drives", "") != ""
      if Builtins.issubstring(
          Ops.get_string(clearpart, "drives", ""),
          devicetok
        )
        if Ops.get_integer(clearpart, "all", -1) == 1
          Ops.set(drive, "use", "all")
        elsif Ops.get_integer(clearpart, "linux", -1) == 1
          Ops.set(drive, "use", "linux")
        elsif Ops.get_integer(clearpart, "initlabel", -1) == 1
          Ops.set(drive, "initialize", true)
        end
      end
    elsif Ops.get_string(clearpart, "drives", "") == ""
      if Ops.get_integer(clearpart, "all", -1) == 1
        Ops.set(drive, "use", "all")
      elsif Ops.get_integer(clearpart, "linux", -1) == 1
        Ops.set(drive, "use", "linux")
      elsif Ops.get_integer(clearpart, "initlabel", -1) == 1
        Ops.set(drive, "initialize", true)
      end
    elsif devicetok == "" && Ops.get_string(clearpart, "drives", "") != ""
      alldrives = Builtins.splitstring(
        Ops.get_string(clearpart, "drives", ""),
        ","
      )
      if Builtins.size(alldrives) == 1
        Ops.set(
          drive,
          "device",
          Builtins.sformat("/dev/%1", Ops.get_string(alldrives, 0, ""))
        )
        if Ops.get_string(clearpart, "all", "") == "1"
          Ops.set(drive, "use", "all")
        elsif Ops.get_string(clearpart, "linux", "") == "1"
          Ops.set(drive, "use", "linux")
        elsif Ops.get_string(clearpart, "initlabel", "") == "1"
          Ops.set(drive, "initialize", true)
        end
      end
    end
    Ops.set(drive, "partitions", dp)
    deep_copy(drive)
  end
  Builtins.y2milestone("Drives: %1", newdrives)
  deep_copy(newdrives)
end

- (Array) Raid

KS RAID

Returns:

  • (Array)


377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File '../../src/modules/Kickstart.rb', line 377

def Raid
  raid = Builtins.maplist(Ops.get_map(@ksConfig, "raid", {})) do |d, data|
    r = {}
    Ops.set(r, "mount", d)
    Ops.set(
      r,
      "format",
      Ops.get_integer(data, "nofromat", 0) == 1 ? false : true
    )
    Ops.set(
      r,
      "name",
      Builtins.sformat("/dev/%1", Ops.get_string(data, "device", "md0"))
    )
    Ops.set(
      r,
      "raid_level",
      Builtins.sformat("raid%1", Ops.get_integer(data, "level", 0))
    )
    deep_copy(r)
  end
  deep_copy(raid)
end

- (Hash) Read

Read a Kickstart file

Returns:

  • (Hash)

    kickstart configuration.



38
39
40
41
42
43
44
45
46
# File '../../src/modules/Kickstart.rb', line 38

def Read
  @ksConfig = Convert.to_map(SCR.Read(path(".kickstart"), @ksfile))
  SCR.UnmountAgent(path(".kickstart"))

  Builtins.y2debug("Kickstart config raw: %1", @ksConfig)
  return {} if @ksConfig == {} || @ksConfig == nil

  nil
end

- (Hash) Scripts

KS Scripts

Returns:

  • (Hash)


172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File '../../src/modules/Kickstart.rb', line 172

def Scripts
  scripts = {}
  postscripts = []
  prescripts = []

  if Builtins.haskey(@ksConfig, "post-script")
    script = {}
    Ops.set(
      script,
      "source",
      Convert.to_string(
        SCR.Read(
          path(".target.string"),
          Ops.get_string(@ksConfig, "post-script", "")
        )
      )
    )
    post = Ops.get_map(@ksConfig, "post", {})
    Ops.set(
      script,
      "interpreter",
      Ops.get_string(post, "interpreter", "shell")
    )
    Ops.set(script, "filename", "kspost")
    postscripts = Builtins.add(postscripts, script)
  end
  Ops.set(scripts, "post-scripts", postscripts)
  if Builtins.haskey(@ksConfig, "pre-script")
    script = {}
    Ops.set(
      script,
      "source",
      Convert.to_string(
        SCR.Read(
          path(".target.string"),
          Ops.get_string(@ksConfig, "pre-script", "")
        )
      )
    )

    Ops.set(script, "interpreter", "/bin/sh")
    Ops.set(script, "filename", "kspre")
    prescripts = Builtins.add(prescripts, script)
  end
  Ops.set(scripts, "pre-scripts", prescripts)
  deep_copy(scripts)
end

- (Hash) Software

KS Software

Returns:

  • (Hash)


572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
# File '../../src/modules/Kickstart.rb', line 572

def Software
  software = {}
  all = Ops.get_list(@ksConfig, "packages", [])


  rhsel = {
    "Core"                      => { "base" => "Minimal", "addon" => [] },
    "Base"                      => { "base" => "Minimal", "addon" => [] },
    "Printing Support"          => {
      "base"     => "Minimal",
      "addon"    => [],
      "packages" => [
        "a2ps",
        "ghostscript-mini",
        "hp-officeJet",
        "yast2-printer",
        "cups-client",
        "cups",
        "cups-libs",
        "cups-drivers"
      ]
    },
    "Cups"                      => {
      "base"     => "Minimal",
      "addon"    => [],
      "packages" => ["cups-client", "cups", "cups-libs", "cups-drivers"]
    },
    "X Window System"           => {
      "base"     => "Minimal+X11",
      "addon"    => [],
      "packages" => []
    },
    "Dialup Networking Support" => {
      "base"     => "Minimal",
      "addon"    => [],
      "packages" => [
        "ppp",
        "minicom",
        "wvdial",
        "i4l-base",
        "i4lfirm",
        "i4l-isdnlog"
      ]
    },
    "GNOME Desktop Environment" => {
      "base"     => "Minimal+X11",
      "addon"    => ["Gnome"],
      "packages" => []
    },
    "KDE Desktop Environment"   => {
      "base"     => "Minimal+X11",
      "addon"    => ["Kde-Desktop"],
      "packages" => []
    },
    "Graphical Internet"        => {
      "base"     => "Minimal+X11",
      "addon"    => ["Network"],
      "packages" => []
    },
    "Text-based Internet"       => {
      "base"     => "Minimal",
      "addon"    => ["Network"],
      "packages" => []
    },
    "Sound and Video"           => {
      "base"     => "Minimal+X11",
      "addon"    => ["Multimedia", "Basis-Sound"],
      "packages" => []
    },
    "Graphics"                  => {
      "base"     => "Minimal+X11",
      "addon"    => [],
      "packages" => [
        "ImageMagick",
        "xsane",
        "gimp",
        "netpbm",
        "dia",
        "gtkam"
      ]
    },
    "Office/Productivity"       => {
      "base"     => "Minimal+X11",
      "addon"    => ["Office"],
      "packages" => []
    },
    "Mail Server"               => {
      "base"     => "Minimal",
      "addon"    => [
        "postfix",
        "imap",
        "mailman",
        "spamassassin",
        "squirrelmail",
        "squirrelmail-plugins"
      ],
      "packages" => []
    },
    "Network Servers"           => {
      "base"     => "Minimal",
      "addon"    => ["Network"],
      "packages" => []
    },
    "News Server"               => {
      "base"     => "Minimal",
      "addon"    => ["Network"],
      "packages" => []
    },
    "Windows File Server"       => {
      "base"     => "Minimal",
      "addon"    => ["Network"],
      "packages" => []
    },
    "Web Server"                => {
      "base"     => "Minimal",
      "addon"    => ["LAMP"],
      "packages" => []
    },
    "Games and Entertainment"   => {
      "base"     => "Minimal",
      "addon"    => ["Games"],
      "packages" => []
    },
    "Development Tools"         => {
      "base"     => "Minimal",
      "addon"    => ["Basis-Devel"],
      "packages" => []
    },
    "Development Libraries"     => {
      "base"     => "Minimal",
      "addon"    => ["Advanced-Devel"],
      "packages" => []
    }
  }

  selections = Builtins.maplist(Builtins.filter(all) do |s|
    Builtins.issubstring(s, "@")
  end) do |s|
    sel1 = Builtins.substring(s, 1, Builtins.size(s))
    sel2 = Builtins.substring(
      sel1,
      Builtins.findfirstof(
        Builtins.tolower(sel1),
        "0123456789abcdefghijklmnopqrstuvwxyz"
      ),
      Builtins.size(sel1)
    )
    sel2
  end

  Builtins.y2milestone("RH Selections: %1", selections)
  bases = []
  addons = []
  selpacs = []
  Builtins.foreach(selections) do |sel|
    currentsel = Ops.get(rhsel, sel, {})
    Builtins.y2milestone("current sel: %1", currentsel)
    bases = Builtins.add(bases, Ops.get_string(currentsel, "base", ""))
    addons = Builtins.toset(
      Builtins.union(addons, Ops.get_list(currentsel, "addon", []))
    )
    selpacs = Builtins.toset(
      Builtins.union(selpacs, Ops.get_list(currentsel, "packages", []))
    )
  end

  Builtins.y2milestone(
    "bases: %1, addons: %2. pacakges: %3",
    bases,
    addons,
    selpacs
  )

  packages = Builtins.filter(all) { |s| !Builtins.issubstring(s, "@") }
  packages = Builtins.filter(packages) do |s|
    !Builtins.regexpmatch(s, "^-.*")
  end

  nopackages = Builtins.maplist(Builtins.filter(all) do |s|
    Builtins.regexpmatch(s, "^-.*")
  end) { |pac| Builtins.substring(pac, 1, Builtins.size(pac)) }

  Ops.set(software, "base", "Minimal")
  Ops.set(software, "addons", addons)
  Ops.set(
    software,
    "packages",
    Builtins.toset(Builtins.union(Builtins.filter(packages) { |pac| pac != "" }, selpacs))
  )
  Ops.set(software, "remove-packages", Builtins.filter(nopackages) do |pac|
    pac != ""
  end)


  deep_copy(software)
end

- (Array) Users

Users() Read KS Users (root)

Returns:

  • (Array)

    user list



51
52
53
54
55
56
57
58
59
60
61
# File '../../src/modules/Kickstart.rb', line 51

def Users
  ks_user = Ops.get_map(@ksConfig, "users", {})
  users = []
  root = {}
  Ops.set(root, "username", "root")
  Ops.set(root, "user_password", Ops.get_string(ks_user, "password", ""))
  Ops.set(root, "encrypted", Ops.get_integer(ks_user, "iscrypted", 0) == 1)

  users = Builtins.add(users, root)
  deep_copy(users)
end

- (Hash) X11

X11 Read KS X11

Returns:

  • (Hash)

    x11 configuration



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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File '../../src/modules/Kickstart.rb', line 66

def X11
  if Ops.get_integer(@ksConfig, "skipx", 0) != 1 &&
      Builtins.haskey(@ksConfig, "xconfig")
    x11 = {}
    ks_x = Ops.get_map(@ksConfig, "xconfig", {})

    if Builtins.haskey(ks_x, "depth")
      Ops.set(x11, "color_depth", Ops.get_integer(ks_x, "depth", 0))
    end

    if Builtins.haskey(ks_x, "resolution")
      Ops.set(x11, "resolution", Ops.get_string(ks_x, "resolution", ""))
    end

    if Builtins.haskey(ks_x, "startxonboot")
      Ops.set(x11, "startxonboot", Ops.get_string(ks_x, "startxonboot", ""))
    end

    if Builtins.haskey(ks_x, "defaultdesktop")
      Ops.set(
        x11,
        "default_desktop",
        Ops.get_string(ks_x, "defaultdesktop", "")
      )
    end

    monitor = {}
    if Builtins.haskey(ks_x, "vsync") ||
        Ops.get_string(ks_x, "monitor", "") != ""
      display = {}
      hsync = Builtins.splitstring(Ops.get_string(ks_x, "hsync", ""), "-")
      vsync = Builtins.splitstring(Ops.get_string(ks_x, "vsync", ""), "-")
      Ops.set(display, "min_hsync", Ops.get_string(hsync, 0, ""))
      Ops.set(display, "min_vsync", Ops.get_string(vsync, 0, ""))
      Ops.set(display, "max_hsync", Ops.get_string(hsync, 1, ""))
      Ops.set(display, "max_vsync", Ops.get_string(vsync, 1, ""))
      m = Builtins.splitstring(Ops.get_string(ks_x, "monitor", ""), " ")
      Ops.set(monitor, "monitor_vendor", Ops.get(m, 0, ""))
      Ops.set(monitor, "monitor_device", Ops.get(m, 1, ""))
      Ops.set(monitor, "display", display)
    end
    if Ops.greater_than(Builtins.size(monitor), 0)
      Ops.set(x11, "monitor", monitor)
    end
    Ops.set(x11, "configure_x11", true)
    return deep_copy(x11)
  else
    return {}
  end
end