summaryrefslogtreecommitdiffstats
path: root/perl-install/bootlook.pm
blob: 080c89a6b55bbf76c29c74e69e1dcaed54aca42e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
169
170
171
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
219
220
221
222
223
224
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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
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
498
499
500
501
502
503
504
505
506
#!/usr/bin/perl -w

# Control-center

# Copyright (C) 2001 MandrakeSoft
# Yves Duret <yduret at mandrakesoft.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


use MDK::Common;
use Gtk;
use Gtk::Gdk::Pixbuf;
use Config;
init Gtk;
use POSIX;
use lib qw(/usr/lib/libDrakX);
use interactive;
use standalone;
use any;
use bootloader;
use fs;
use my_gtk qw(:helpers :wrappers :ask);
use ugtk qw(:helpers :wrappers);
if ($::isEmbedded) {
  print "EMBED\n";
  print "XID : $::XID\n";
  print "CCPID :  $::CCPID\n";
}

my $in = 'interactive'->vnew('su', 'default');
local $_ = join '', @ARGV;

/-h/ and die _("no help implemented yet.\n");
/-version/ and die 'version: $Id$'."\n";

my @winm;
my @usernames;
parse_etc_passwd();

my $x_mode = isXlaunched();
my $a_mode = (-e "/etc/aurora/Monitor") ? 1 : 0;
my $l_mode = isAutologin();
my %auto_mode = get_autologin("");
my $inmain = 0;
my $lilogrub = chomp_(`detectloader -q`);

my $window = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window ("toplevel");
$window->signal_connect(delete_event => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0) });
$window->set_title(_("Boot Style Configuration"));
$window->border_width(2);
#$window->realize;

# drakX mode
my ($t_pixmap, $t_mask) = gtkcreate_png("tradi.png");
my ($h_pixmap, $h_mask) = gtkcreate_png("hori.png");
my ($v_pixmap, $v_mask) = gtkcreate_png("verti.png");
my ($g_pixmap, $g_mask) = gtkcreate_png("gmon.png");
my ($c_pixmap, $c_mask) = gtkcreate_png("categ.png");

# a pixmap widget to contain the pixmap
my $pixmap = new Gtk::Pixmap($h_pixmap, $h_mask);

### menus definition
# the menus are not shown
# but they provides shiny shortcut like C-q
my @menu_items = ( { path => _("/_File"), type => '<Branch>' },
		   { path => _("/File/_Quit"), accelerator => _("<control>Q"), callback    => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0) } },
		 );
my $menubar = get_main_menu($window);
######### menus end

my $user_combo = new Gtk::Combo;
$user_combo->set_popdown_strings(@usernames);
$user_combo->entry->set_text($auto_mode{autologin}) if ($auto_mode{autologin});
my $desktop_combo =new Gtk::Combo;
$desktop_combo->set_popdown_strings(get_wm());
$desktop_combo->entry->set_text($auto_mode{desktop}) if ($auto_mode{desktop});
my $a_c_button = new Gtk::RadioButton (_("NewStyle Categorizing Monitor"));
my $a_h_button = new Gtk::RadioButton _("NewStyle Monitor"), $a_c_button;
my $a_v_button = new Gtk::RadioButton _("Traditional Monitor"), $a_c_button;
my $a_g_button = new Gtk::RadioButton _("Traditional Gtk+ Monitor"),$a_c_button ;
my $a_button = new Gtk::CheckButton(_("Launch Aurora at boot time"));
my $a_box = new Gtk::VBox(0, 0);
my $x_box = new Gtk::VBox(0, 0);
my $disp_mode = arch() =~ /ppc/ ? _("Yaboot mode") : _("Lilo/grub mode");

my %themes = 	('path'=>'/usr/share/bootsplash/themes/',
		 'default'=>'Mandrake',
		 'def_thmb'=>'/usr/share/libDrakX/pixmaps/nosplash_thumb.png',
		 'lilo'=>{'file'=>'/lilo/message',
			  'thumb'=>'/lilo/thumb.png'} ,
		 'boot'=>{'path'=>'/images/',
		 	#'thumb'=>'/images/thumb.png',
			},
		 );
my ($cur_res) = cat_('/etc/lilo.conf') =~ /vga=(.*)/;

#- verify that current resolution is ok
if ( member( $cur_res, qw( 785 788 791 794) ) ) {
	($cur_res) = $bootloader::vga_modes{$cur_res} =~ /^([0-9x]+).*?$/;
} else {
	$no_bootsplash = 1;  #- we can't select any theme we're not in Framebuffer mode :-/
}

#- and check that lilo is the correct loader
$no_bootsplash ||= chomp_(`detectloader -q`) ne 'LILO';

my @thms;
my @lilo_thms = ($themes{'default'})?():qw(default);
my @boot_thms = ($themes{'default'})?():qw(default);
chdir($themes{'path'}); #- we must change directory for correct @thms assignement
foreach (all('.')) {
    if (-d $themes{'path'} . $_ && m/^[^.]/) {
	push @thms, $_;
	-f $themes{'path'} . $_ . $themes{'lilo'}{'file'} and push @lilo_thms, $_;
	-f $themes{'path'} . $_ . $themes{'boot'}{'path'} . "bootsplash-$cur_res.jpg" and push @boot_thms, $_;
    }
#       $_ eq $themes{'defaut'} and $default = $themes{'defaut'};
}
my %combo = ('thms'=> '','lilo'=> '','boot'=> '');
foreach (keys (%combo)) {
    $combo{$_} = new Gtk::Combo;
    $combo{$_}->set_value_in_list(1, 0);
}

$combo{'thms'}->set_popdown_strings(@thms);
$combo{'lilo'}->set_popdown_strings(@lilo_thms);
$combo{'boot'}->set_popdown_strings(@boot_thms);
my $lilo_pixbuf;
my $lilo_pic = gtkpng($themes{'def_thmb'});

my $boot_pixbuf ;
my $boot_pic = gtkpng($themes{'def_thmb'});

my $thm_button = new Gtk::Button(_("Install themes"));
my $logo_thm = new Gtk::CheckButton(_("Display theme under console"));
my $B_create = new Gtk::Button(_("Create new theme"));
my $keep_logo = 1;
$logo_thm->set_active(1);
$logo_thm->signal_connect(clicked => sub { invbool(\$keep_logo) });
$B_create->signal_connect(clicked => sub{
    $::isEmbedded ? (kill('USR1', $::CCPID) and system('/usr/sbin/draksplash ')) : system('/usr/sbin/draksplash ') ;
    });
#- ******** action to take on changing combos values

$combo{'thms'}->entry->signal_connect(changed => sub {
    my $thm_txt = $combo{'thms'}->entry->get_text();
    $combo{'lilo'}->entry->set_text(member($thm_txt, @lilo_thms) ? $thm_txt : ($themes{'default'} || 'default'));
    $combo{'boot'}->entry->set_text(member($thm_txt, @boot_thms) ? $thm_txt : ($themes{'default'} || 'default'));
    
});

$combo{'lilo'}->entry->signal_connect(changed => sub {
    my $new_file = $themes{'path'} . $combo{'lilo'}->entry->get_text() . $themes{'lilo'}{'thumb'};
    undef($lilo_pixbuf);
    $lilo_pixbuf = gtkcreate_png_pixbuf(-r $new_file ? $new_file : $themes{'def_thmb'});
    $lilo_pic->set($lilo_pixbuf->render_pixmap_and_mask(0),'');
});

$combo{'boot'}->entry->signal_connect( changed => sub {
    local $img_file = $themes{'path'}.$combo{'boot'}->entry->get_text().$themes{'boot'}{'path'}."bootsplash-$cur_res.jpg";
    undef($boot_pixmap);
    $boot_pixmap = gtkcreate_png_pixbuf( $img_file);
    $boot_pixmap = $boot_pixmap->scale_simple(159,119,0);
    $boot_pic->set($boot_pixmap->render_pixmap_and_mask(0),'');
});

$combo{'thms'}->entry->set_text($themes{'default'});

$thm_button->signal_connect('clicked',

sub {
        my $error = 0;
        my $boot_conf_file = '/etc/sysconfig/bootsplash';
	my $lilomsg = '/boot/lilo-graphic/message';
        #lilo installation
        if (-f $themes{'path'}.$combo{'lilo'}->entry->get_text() . $themes{'lilo'}{'file'}) {
	    use File::Copy;
	    ( copy($lilomsg,"/boot/lilo-graphic/message.old") 
	      and standalone::explanations(_("Backup %s to %s.old",$lilomsg,$lilomsg)) ) 
	      or $in->ask_warn(_("Error"), _("unable to backup lilo message"));
	    ( copy($themes{'path'} . $combo{'lilo'}->entry->get_text() . $themes{'lilo'}{'file'}, $lilomsg) 
	      and standalone::explanations(_("Copy %s to %s",$themes{'path'} . $combo{'lilo'}->entry->get_text() . $themes{'lilo'}{'file'},$lilomsg)) )
	      or $in->ask_warn(_("Error"), _("can't change lilo message"));
	} else {
            $error = 1;
            $in->ask_warn(_("Error"), _("Lilo message not found"));
        }
        #bootsplash install
        if ( -f $themes{'path'} . $combo{'boot'}->entry->get_text() . $themes{'boot'}{'path'} . "bootsplash-$cur_res.jpg") {
                $bootsplash_cont = "# -*- Mode: shell-script -*-
# Specify here if you want add the splash logo to initrd when
# generating an initrd. You can specify :
#
# SPLASH=no to don't have a splash screen
#
# SPLASH=auto to make autodetect the splash screen
#
# SPLASH=INT When Integer could be 800x600 1024x768 1280x1024
#
SPLASH=$cur_res
# Choose the themes. The should be based in
# /usr/share/bootsplash/themes/
THEME=" . $combo{'boot'}->entry->get_text() . "
# Say yes here if you want to leave the logo on the console.
# Three options :
#
# LOGO_CONSOLE=no don't display logo under console.
#
# LOGO_CONSOLE=yes display logo under console.
#
# LOGO_CONSOLE=theme leave the theme to decide.
#
LOGO_CONSOLE=" . ($keep_logo ? 'yes' : 'no') . "\n";
                if (-f $boot_conf_file) {
                        eval { output($boot_conf_file, $bootsplash_cont) };
			$@ and $in->ask_warn(_("Error"), _("Can't write /etc/sysconfig/bootsplash.")) or standalone::explanations(_("Write %s",$boot_conf_file));
                } else {
                    $in->ask_warn(_("Error"), _("Can't write /etc/sysconfig/bootsplash\nFile not found."));
                    $error = 1;
                }
        } else {
                $in->ask_warn("Error","BootSplash screen not found");
        }
        #here is mkinitrd time
        if (!$error) {
            foreach (map { if_(m|^initrd-(.*)\.img|, $1) } all('/boot')){
                if ( system("mkinitrd -f /boot/initrd-$_.img $_" ) ) {
                    $in->ask_warn(_("Error"),
				  _("Can't launch mkinitrd -f /boot/initrd-%s.img %s.", $_,$_));
                    $error = 1;
                } else { 
		  standalone::explanations(_("Make initrd 'mkinitrd -f /boot/initrd-%s.img %s'.", $_,$_));
		}
            }
        }
        if (system('lilo')) {
            $in->ask_warn(_("Error"),
_("Can't relaunch LiLo!
Launch \"lilo\" as root in command line to complete LiLo theme installation."));
            $error = 1;
        } else {
		standalone::explanations(_("Relaunch 'lilo'"));
	}
	$in->ask_warn(_(($error)?"Error":"Notice"),
		      _($error?"Theme installation failed!":"LiLo and Bootsplash themes installation successfull"));
    }
);

gtkadd($window,
       gtkpack__ (my $global_vbox = new Gtk::VBox(0,0),
		  gtkadd (new Gtk::Frame ("$disp_mode"),
#			  gtkpack__(new Gtk::VBox(0,0),
				    (gtkpack_(gtkset_border_width(new Gtk::HBox(0, 0),5),
					      1,_("You are currently using %s as your boot manager.
Click on Configure to launch the setup wizard.", $lilogrub),
					      0,gtksignal_connect(new Gtk::Button (_("Configure")), clicked => $::lilo_choice),
					     )),
#				    "" #we need some place under the button -- replaced by gtkset_border_width( for the moment
#				   )
				     
			 ),
                #Splash Selector
                gtkadd(my $thm_frame = new Gtk::Frame( _("Splash selection") ),
                       gtkpack__(gtkset_border_width(new Gtk::HBox(0,5),5),
                                 gtkpack__(new Gtk::VBox(0,5),
                                           _("Themes"),
                                           $combo{'thms'},
                                           _("\nSelect a theme for\nlilo and bootsplash,\nyou can choose\nthem separatly"),
                                           $logo_thm),
                                 gtkpack__(new Gtk::VBox(0,5),
                                           _("Lilo screen"),
                                           $combo{'lilo'},
                                           $lilo_pic,
					   $B_create),
                                 gtkpack__(new Gtk::VBox(0,5),
                                           _("Bootsplash"),
                                           $combo{'boot'},
                                           $boot_pic,
                                           $thm_button))
                      ),

		  # aurora
# 		  gtkadd (new Gtk::Frame (_("Boot mode")),
# 			  gtkpack__ (new Gtk::HBox(0,0),
# 				     gtkpack__ (new Gtk::VBox(0, 5),
# 						gtksignal_connect ($a_button, clicked => sub {
# 								       if ($inmain) {
# 									   $a_box->set_sensitive(!$a_mode);
# 									   $a_mode = !$a_mode;
# 									   if ($a_mode) {
# 									       $pixmap->set($c_pixmap, $c_mask) if $a_c_button->get_active();
# 									       $pixmap->set($h_pixmap, $h_mask) if $a_h_button->get_active();
# 									       $pixmap->set($v_pixmap, $v_mask) if $a_v_button->get_active();
# 									       $pixmap->set($g_pixmap, $g_mask) if $a_g_button->get_active();
# 									   } else {
# 									       $pixmap->set($t_pixmap, $t_mask);
# 									   }
# 										   }
# 								   }),
# 						gtkpack__ (gtkset_sensitive ($a_box, $a_mode),
# 							    gtksignal_connect ($a_c_button,clicked => sub{$pixmap->set($c_pixmap, $c_mask)}),
# 							    gtksignal_connect ($a_h_button,clicked => sub{$pixmap->set($h_pixmap, $h_mask)}),
# 							    gtksignal_connect ($a_v_button,clicked => sub{$pixmap->set($v_pixmap, $v_mask)}),
# 							    gtksignal_connect ($a_g_button,clicked => sub{$pixmap->set($g_pixmap, $g_mask)})
# 							  )
# 					      ),
# 				     gtkpack__ (new Gtk::HBox(0,0), $pixmap)
# 				    )
# 			 ),
		  # X
		  gtkadd (new Gtk::Frame (_("System mode")),
			  gtkpack__ (new Gtk::VBox(0, 5),
				     gtksignal_connect(gtkset_active(new Gtk::CheckButton (_("Launch the graphical environment when your system starts")), $x_mode), clicked => sub {
							   $x_box->set_sensitive(!$x_mode);
							   $x_mode = !$x_mode;
						       }),
				     gtkpack__ (gtkset_sensitive ($x_box, $x_mode),
						gtkset_active($x_no_button  = new Gtk::RadioButton (_("No, I don't want autologin")), !$l_mode),
						gtkpack__ (new Gtk::HBox(0, 10),
							   gtkset_active($x_yes_button = new Gtk::RadioButton((_("Yes, I want autologin with this (user, desktop)")), $x_no_button), $l_mode),
							   gtkpack__ (new Gtk::VBox(0, 10),
								      $user_combo,
								      $desktop_combo
								     )
							  )
					       )
				    )
			 ),
		 gtkadd (gtkset_layout(new Gtk::HButtonBox,-end),
			 gtksignal_connect(new Gtk::Button(_("OK")), clicked => sub{ updateInit(); updateAutologin(); updateAurora(); $::isEmbedded ? kill('USR1',$::CCPID) : Gtk->exit(0) }),
			 gtksignal_connect(new Gtk::Button(_("Cancel")), clicked => sub { $::isEmbedded ? kill('USR1', $::CCPID) : Gtk->exit(0) })
			)
	       )
      );

$a_button->set_active($a_mode); # up == false == "0"
if ($a_mode) {
    my $a = readlink "/etc/aurora/Monitor";
    $a =~ s#/lib/aurora/Monitors/##;
    if ($a eq "NewStyle-Categorizing-WsLib") { $a_c_button->set_active(1); $pixmap->set($c_pixmap, $c_mask) }
    if ($a eq "NewStyle-WsLib") { $a_h_button->set_active(1);  $pixmap->set($h_pixmap, $h_mask) }
    if ($a eq "Traditional-WsLib") { $a_v_button->set_active(1); $pixmap->set($v_pixmap, $v_mask) }  
    if ($a eq "Traditional-Gtk+") { $a_g_button->set_active(1); $pixmap->set($g_pixmap, $g_mask) }
} else {
    $pixmap->set($t_pixmap, $t_mask);
}

$window->show_all();
$no_bootsplash and $thm_frame->hide();
Gtk->main_iteration while Gtk->events_pending;
$::isEmbedded and kill 'USR2', $::CCPID;
$inmain=1;
Gtk->main;
Gtk->exit(0);

#-------------------------------------------------------------
# get user names to put in combo  
#-------------------------------------------------------------

sub parse_etc_passwd
{
    my ($uname, $uid);
    setpwent();
    do {
	@user_info = getpwent();
	($uname, $uid) = @user_info[0,2];
	push (@usernames, $uname) if ($uid > 500) and !($uname eq "nobody");
    } while (@user_info);
}

sub get_wm
{
    @winm = (split (' ', `/usr/sbin/chksession -l`));
}

#-------------------------------------------------------------
# menu callback functions
#-------------------------------------------------------------

sub print_hello {
  print("mcdtg !\n");
}

sub get_main_menu {
  my ($window) = @_;

  my $accel_group = new Gtk::AccelGroup();
  my $item_factory = new Gtk::ItemFactory('Gtk::MenuBar', '<main>', $accel_group);
  $item_factory->create_items(@menu_items);
  $window->add_accel_group($accel_group);
  return $item_factory->get_widget('<main>');
}

#-------------------------------------------------------------
# launch X functions
#-------------------------------------------------------------

sub isXlaunched {
    my $line;
    open INITTAB, "/etc/inittab" or die _("can not open /etc/inittab for reading: %s", $!);
    while (<INITTAB>) {
	if (/id:([1-6]):initdefault:/) { $line = $_; last }
    }
    close INITTAB;
    $line =~ s/id:([1-6]):initdefault:/$1/;
    return ($line-3);
}

sub updateInit {
    my $runlevel = ($x_mode) ? 5 : 3;
    substInFile { s/^id:\d:initdefault:\s*$/id:$runlevel:initdefault:\n/ } "/etc/inittab";
}

#-------------------------------------------------------------
# aurora functions
#-------------------------------------------------------------



sub updateAurora {
    if ($a_mode) {
        if ($a_c_button->get_active()) {
            symlinkf("/lib/aurora/Monitors/NewStyle-Categorizing-WsLib",    "/etc/aurora/Monitor");
            $in->do_pkgs->install(q(Aurora-Monitor-NewStyle-Categorizing-WsLib)) if !(-e "/lib/aurora/Monitors/NewStyle-Categorizing-WsLib");
        }
        if ($a_h_button->get_active()) {
            symlinkf("/lib/aurora/Monitors/NewStyle-WsLib",    "/etc/aurora/Monitor");
            $in->do_pkgs->install(q(Aurora-Monitor-NewStyle-WsLib)) if !(-e "/lib/aurora/Monitors/NewStyle-WsLib");
        }
        if ($a_v_button->get_active()) {
            symlinkf("/lib/aurora/Monitors/Traditional-WsLib", "/etc/aurora/Monitor");
            $in->do_pkgs->install(q(Aurora-Monitor-Traditional-WsLib)) if !(-e "/lib/aurora/Monitors/Traditional-WsLib");
        }
        if ($a_g_button->get_active()) {
            symlinkf("/lib/aurora/Monitors/Traditional-Gtk+",  "/etc/aurora/Monitor");
            $in->do_pkgs->install(q(Aurora-Monitor-Traditional-Gtk+)) if !(-e "/lib/aurora/Monitors/Traditional-Gtk+");
	}
    } else {
	unlink "/etc/aurora/Monitor";
    }
    
}

#-------------------------------------------------------------
# launch autologin functions
#-------------------------------------------------------------

sub isAutologin {
    my $line;
    open AUTOLOGIN, "/etc/sysconfig/autologin";
    while (<AUTOLOGIN>) {
	if (/AUTOLOGIN=(yes|no)/) { $line = $_; last }
    }
    close AUTOLOGIN;
    $line =~ s/AUTOLOGIN=(yes|no)/$1/;
    chomp ($line);
    $line =  ($line eq "yes");
    my %au = get_autologin('');
    return ($line && defined $au{autologin});
}

sub get_autologin {
    my ($prefix) = @_;
    my %o;
    my %l = getVarsFromSh("$prefix/etc/sysconfig/autologin");

    $o{autologin} = $l{USER};
    %l = getVarsFromSh("$prefix/etc/sysconfig/desktop");
    $o{desktop} = $l{DESKTOP};
    %o;
}

sub updateAutologin {
    my ($usern,$deskt)=($user_combo->entry->get_text(), $desktop_combo->entry->get_text());
    if ($x_yes_button->get_active()) {
	$in->do_pkgs->install('autologin') if $x_mode;
	set_autologin('',$usern,$deskt);
    } else {
	set_autologin('',undef) if ($x_no_button->get_active());
    }
}
 
sub set_autologin {
  my ($prefix, $user, $desktop) = @_;
  output "$prefix/etc/sysconfig/desktop", uc($desktop), "\n" if $user;
  setVarsInSh("$prefix/etc/sysconfig/autologin",
	      { USER => $user, AUTOLOGIN => bool2yesno($user), EXEC => "/usr/X11R6/bin/startx" });
  chmod 0600, "$prefix/etc/sysconfig/autologin";
#  log::l("cat $prefix/etc/sysconfig/autologin: ", cat_("$prefix/etc/sysconfig/autologin"));
}


opt">: Unicode is a new character encoding meant to cover all existing languages. However full support for it in GNU/Linux is still under development. For that reason, Mandriva Linux's use of UTF-8 will depend on the user's choices: * If you choose a language with a strong legacy encoding (latin1 languages, Russian, Japanese, Chinese, Korean, Thai, Greek, Turkish, most iso-8859-2 languages), the legacy encoding will be used by default; * Other languages will use unicode by default; * If two or more languages are required, and those languages are not using the same encoding, then unicode will be used for the whole system; * Finally, unicode can also be forced for use throughout the system at a user's request by selecting the \"%s\" option independently of which languages were been chosen. Note that you're not limited to choosing a single additional language. You may choose several, or even install them all by selecting the \"%s\" box. Selecting support for a language means translations, fonts, spell checkers, etc. will also be installed for that language. To switch between the various languages installed on your system, you can launch the \"localedrake\" command as \"root\" to change the language used by the entire system. Running the command as a regular user will only change the language settings for that particular user.", N("Advanced"), N("Espanol"), N("Use Unicode by default"), N("All languages")); } sub selectMouse() { N("Usually, DrakX has no problems detecting the number of buttons on your mouse. If it does, it assumes you have a two-button mouse and will configure it for third-button emulation. The third-button mouse button of a two-button mouse can be obtained by simultaneously clicking the left and right mouse buttons. DrakX will automatically know whether your mouse uses a PS/2, serial or USB interface. If you have a 3-button mouse without a wheel, you can choose a \"%s\" mouse. DrakX will then configure your mouse so that you can simulate the wheel with it: to do so, press the middle button and move your mouse pointer up and down. If for some reason you wish to specify a different type of mouse, select it from the list provided. You can select the \"%s\" entry to chose a ``generic'' mouse type which will work with nearly all mice. If you choose a mouse other than the default one, a test screen will be displayed. Use the buttons and wheel to verify that the settings are correct and that the mouse is working correctly. If the mouse is not working well, press the space bar or [Return] key to cancel the test and you will be returned to the mouse list. Occasionally wheel mice are not detected automatically, so you will need to select your mouse from a list. Be sure to select the one corresponding to the port that your mouse is attached to. After selecting a mouse and pressing the \"%s\" button, a mouse image will be displayed on-screen. Scroll the mouse wheel to ensure that it is activating correctly. As you scroll your mouse wheel, you will see the on-screen scroll wheel moving. Test the buttons and check that the mouse pointer moves on-screen as you move your mouse about.", N("with Wheel emulation"), N("Universal | Any PS/2 & USB mice"), N("Next")); } sub selectSerialPort() { N("Please select the correct port. For example, the \"COM1\" port under Windows is named \"ttyS0\" under GNU/Linux."); } sub setRootPassword() { N("This is the most crucial decision point for the security of your GNU/Linux system: you must enter the \"root\" password. \"Root\" is the system administrator and is the only user authorized to make updates, add users, change the overall system configuration, and so on. In short, \"root\" can do everything! That's why you must choose a password which is difficult to guess: DrakX will tell you if the password you chose is too simple. As you can see, you're not forced to enter a password, but we strongly advise against this. GNU/Linux is just as prone to operator error as any other operating system. Since \"root\" can overcome all limitations and unintentionally erase all data on partitions by carelessly accessing the partitions themselves, it is important that it be difficult to become \"root\". The password should be a mixture of alphanumeric characters and at least 8 characters long. Never write down the \"root\" password -- it makes it far too easy to compromise your system. One caveat: do not make the password too long or too complicated because you must be able to remember it! The password will not be displayed on screen as you type it. To reduce the chance of a blind typing error you'll need to enter the password twice. If you do happen to make the same typing error twice, you'll have to use this ``incorrect'' password the first time you'll try to connect as \"root\". If you want an authentication server to control access to your computer, click on the \"%s\" button. If your network uses either LDAP, NIS, or PDC Windows Domain authentication services, select the appropriate one for \"%s\". If you do not know which one to use, you should ask your network administrator. If you happen to have problems with remembering passwords, or if your computer will never be connected to the Internet and you absolutely trust everybody who uses your computer, you can choose to have \"%s\".", N("Advanced"), N("authentication"), N("No password")); } sub setupBootloaderBeginner() { N("A boot loader is a little program which is started by the computer at boot time. It's responsible for starting up the whole system. Normally, the boot loader installation is totally automated. DrakX will analyze the disk boot sector and act according to what it finds there: * if a Windows boot sector is found, it will replace it with a GRUB/LILO boot sector. This way you'll be able to load either GNU/Linux or any other OS installed on your machine. * if a GRUB or LILO boot sector is found, it'll replace it with a new one. If DrakX can not determine where to place the boot sector, it'll ask you where it should place it. Generally, the \"%s\" is the safest place. Choosing \"%s\" will not install any boot loader. Use this option only if you know what you're doing.", N("First sector of drive (MBR)"), N("Skip")); } sub setupDefaultSpooler() { N("Now, it's time to select a printing system for your computer. Other operating systems may offer you one, but Mandriva Linux offers two. Each of the printing systems is best suited to particular types of configuration. * \"%s\" -- which is an acronym for ``print, do not queue'', is the choice if you have a direct connection to your printer, you want to be able to panic out of printer jams, and you do not have networked printers. (\"%s\" will handle only very simple network cases and is somewhat slow when used within networks.) It's recommended that you use \"pdq\" if this is your first experience with GNU/Linux. * \"%s\" stands for `` Common Unix Printing System'' and is an excellent choice for printing to your local printer or to one halfway around the planet. It's simple to configure and can act as a server or a client for the ancient \"lpd\" printing system, so it's compatible with older