From 53b5abee1210a87a0004573a9dd7d7e3dfbe05ea Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 22 Jan 2001 12:19:45 +0000 Subject: $::beginner is deprecated, replaced by !$::expert --- perl-install/Xconfigurator.pm | 2 +- perl-install/any.pm | 12 +++++---- perl-install/install2.pm | 26 ++++++++----------- perl-install/install_any.pm | 2 +- perl-install/install_interactive.pm | 6 ++--- perl-install/install_steps_interactive.pm | 42 ++++++++++++------------------- perl-install/my_gtk.pm | 5 ++-- perl-install/network.pm | 4 +-- perl-install/partition_table.pm | 2 +- perl-install/printerdrake.pm | 10 ++++---- 10 files changed, 48 insertions(+), 63 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 783aa010b..d2a2bd612 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -237,7 +237,7 @@ sub cardConfiguration(;$$$) { _("Your card can have 3D hardware acceleration support but only with XFree %s. Your card is supported by XFree %s which may have a better support in 2D.", $xf3_ver, $xf4_ver) : _("Your card can have 3D hardware acceleration support with XFree %s.", $xf3_ver)) . "\n\n\n" . $msg; - $::beginner and @choices = (); #- keep it by default here as it is the only choice available. + $::expert or @choices = (); #- keep it by default here as it is the only choice available. unshift @choices, { text => _("XFree %s with 3D hardware acceleration", $xf3_ver), code => sub { $card->{use_xf4} = ''; log::l("Using XFree $xf3_ver with 3D hardware acceleration") } }; diff --git a/perl-install/any.pm b/perl-install/any.pm index a74476345..0bb1a6dd3 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -89,7 +89,9 @@ sub setupBootloader { $more++ if $b->{bootUnsafe}; - if ($::beginner && $more >= 1) { + if (!$::expert && $more < 1) { + #- automatic + } elsif (!$::expert) { my @l = (__("First sector of drive (MBR)"), __("First sector of boot partition")); $in->set_help('setupBootloaderBeginner') unless $::isStandalone; @@ -105,7 +107,7 @@ sub setupBootloader { \@l, $l[!$onmbr]) eq $l[0] ? $boot : fsedit::get_root($fstab, 'boot')->{device}); } - } elsif ($more || !$::beginner) { + } else { $in->set_help(arch() =~ /sparc/ ? "setupSILOGeneral" : "setupBootloaderGeneral") unless $::isStandalone; #- TO MERGE ? if ($::expert) { @@ -129,7 +131,7 @@ arch() =~ /sparc/ ? ( { label => _("Boot device"), val => \$b->{boot}, list => [ map { "/dev/$_" } (map { $_->{device} } (@$hds, grep { !isFat($_) } @$fstab)), detect_devices::floppies() ], not_edit => !$::expert }, { label => _("LBA (doesn't work on old BIOSes)"), val => \$b->{lba32}, type => "bool", text => "lba" }, { label => _("Compact"), val => \$b->{compact}, type => "bool", text => _("compact") }, -{ label => _("Video mode"), val => \$b->{vga}, list => [ keys %bootloader::vga_modes ], not_edit => $::beginner }, +{ label => _("Video mode"), val => \$b->{vga}, list => [ keys %bootloader::vga_modes ], not_edit => !$::expert }, ), { label => _("Delay before booting default image"), val => \$b->{timeout} }, $security < 4 ? () : ( @@ -153,7 +155,7 @@ $security < 4 ? () : ( $b->{vga} = $bootloader::vga_modes{$b->{vga}} || $b->{vga}; } - until ($::beginner && $more <= 1) { + while ($::expert || $more > 1) { $in->set_help(arch() =~ /sparc/ ? 'setupSILOAddEntry' : 'setupBootloaderAddEntry') unless $::isStandalone; my $c = $in->ask_from_listf([''], _("Here are the different entries. @@ -563,7 +565,7 @@ sub wait_load_module { #-PO: the second is the vendor+model name $in->wait_message('', [ _("Installing driver for %s card %s", $type, $text), - $::beginner ? () : _("(module %s)", $module) + if_($::expert, _("(module %s)", $module)) ]); } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 4e25ef958..07e66909b 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -43,10 +43,10 @@ my (%installSteps, @orderedInstallSteps); setupSCSI => [ __("Hard drive detection"), 1, 0, '' ], selectMouse => [ __("Configure mouse"), 1, 1, '', "selectInstallClass" ], selectKeyboard => [ __("Choose your keyboard"), 1, 1, '', "selectInstallClass" ], - miscellaneous => [ __("Miscellaneous"), 1, 1, '$::beginner' ], + miscellaneous => [ __("Miscellaneous"), 1, 1, '!$::expert' ], doPartitionDisks => [ __("Setup filesystems"), 1, 0, '', "selectInstallClass" ], formatPartitions => [ __("Format partitions"), 1, -1, '', "doPartitionDisks" ], - choosePackages => [ __("Choose packages to install"), 1, -2, '$::beginner', "formatPartitions" ], + choosePackages => [ __("Choose packages to install"), 1, -2, '!$::expert', "formatPartitions" ], installPackages => [ __("Install system"), 1, -1, '', ["formatPartitions", "selectInstallClass"] ], configureNetwork => [ __("Configure networking"), 1, 1, '', "formatPartitions" ], #- installCrypto => [ __("Cryptographic"), 1, 1, '!$::expert', "configureNetwork" ], @@ -63,7 +63,7 @@ arch() !~ /alpha/ ? ( arch() !~ /alpha/ ? ( generateAutoInstFloppy => [ __("Auto install floppy"), 1, 1, '!$::expert || $o->{lnx4win}', "installPackages" ], ) : (), - exitInstall => [ __("Exit install"), 0, 0, '$::beginner && !$::live' ], + exitInstall => [ __("Exit install"), 0, 0, '!$::expert && !$::live' ], ); for (my $i = 0; $i < @installSteps; $i += 2) { my %h; @h{@installStepsFields} = @{ $installSteps[$i + 1] }; @@ -225,7 +225,7 @@ sub selectMouse { #------------------------------------------------------------------------------ sub setupSCSI { my ($clicked) = @_; - $o->{autoSCSI} ||= $::beginner; + $o->{autoSCSI} ||= !$::expert; $o->setupSCSI($o->{autoSCSI} && !$clicked, $clicked); } @@ -238,7 +238,7 @@ sub selectKeyboard { my $keyboard = keyboard::read($o->{prefix}); $keyboard and $o->{keyboard} = $keyboard; } - return if $::beginner && !$clicked; + return if !$::expert && !$clicked; $o->selectKeyboard; @@ -344,7 +344,7 @@ sub miscellaneous { addToBeDone { setVarsInSh("$o->{prefix}/etc/sysconfig/system", { CLEAN_TMP => $o->{miscellaneous}{CLEAN_TMP}, - CLASS => $::expert && "expert" || $::beginner && "beginner" || "medium", + CLASS => $::expert && 'expert' || 'beginner', TYPE => $o->{installClass}, SECURITY => $o->{security}, META_CLASS => $o->{meta_class} || 'PowerPack', @@ -384,7 +384,7 @@ sub configureTimezone { add2hash($o->{timezone}, { timezone::read($f) }); } $o->{timezone}{timezone} ||= timezone::bestTimezone(lang::lang2text($o->{lang})); - $o->{timezone}{UTC} = !$::beginner && !grep { isFat($_) || isNT($_) } @{$o->{fstab}} unless exists $o->{timezone}{UTC}; + $o->{timezone}{UTC} = $::expert && !grep { isFat($_) || isNT($_) } @{$o->{fstab}} unless exists $o->{timezone}{UTC}; $o->configureTimezone($f, $clicked); } #------------------------------------------------------------------------------ @@ -456,7 +456,7 @@ sub main { $ENV{PERL_BADLANG} = 1; $::isInstall = 1; - $::beginner = $::expert = $::g_auto_install = 0; + $::expert = $::g_auto_install = 0; #- c::unlimit_core() unless $::testing; @@ -476,8 +476,6 @@ sub main { } } $cmdline{$opt} = 1 if $opt; - $::beginner = 1; - map_each { my ($n, $v) = @_; my $f = ${{ @@ -489,8 +487,7 @@ sub main { vga16 => sub { $o->{vga16} = $v }, vga => sub { $o->{vga} = $v }, step => sub { $o->{steps}{first} = $v }, - expert => sub { $::expert = 1; $::beginner = 0 }, - beginner => sub { $::beginner = $v }, + expert => sub { $::expert = $v }, class => sub { $o->{installClass} = $v }, fclass => sub { $o->{installClass} = $v; push @auto, 'selectInstallClass' }, desktop => sub { $o->{meta_class} = 'desktop' }, @@ -546,10 +543,7 @@ sub main { $o->{prefix} = $::testing ? "/tmp/test-perl-install" : $::live ? "" : "/mnt"; $o->{root} = $::testing ? "/tmp/root-perl-install" : "/"; - if ($::live) { - $o->{isUpgrade} = 1; - #$::beginner = 0; #- use custom by default. - } + $o->{isUpgrade} = 1 if $::live; mkdir $o->{prefix}, 0755; mkdir $o->{root}, 0755; devices::make("/dev/zero"); #- needed by ddcxinfos diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index b4fcd68a6..78314fd34 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -236,7 +236,7 @@ sub spawnShell { sub fsck_option { my ($o) = @_; - my $y = $o->{security} < 3 && $::beginner ? "-y " : ""; + my $y = $o->{security} < 3 && !$::expert && "-y "; substInFile { s/^(\s*fsckoptions="?)(-y )?/$1$y/ } "$o->{prefix}/etc/rc.d/rc.sysinit"; } diff --git a/perl-install/install_interactive.pm b/perl-install/install_interactive.pm index 5e281e4fd..fe28f109a 100644 --- a/perl-install/install_interactive.pm +++ b/perl-install/install_interactive.pm @@ -43,7 +43,7 @@ For this, create a partition (or click on an existing one). Then choose action ``Mount point'' and set it to `/'"), 1) or return; } if (!grep { isSwap($_) } @fstab) { - $o->ask_warn('', _("You must have a swap partition")), $ok=0 if $::beginner; + $o->ask_warn('', _("You must have a swap partition")), $ok=0 if !$::expert; $ok &&= $::expert || $o->ask_okcancel('', _("You don't have a swap partition\n\nContinue anyway?")); } } until $ok; @@ -162,7 +162,7 @@ When sure, press Ok.")) or return; } if (!$readonly && ref($o) =~ /gtk/) { #- diskdrake only available in gtk for now - $solutions{diskdrake} = [ 0, ($::beginner ? _("Expert mode") : _("Use diskdrake")), sub { partition_with_diskdrake($o, $hds, 'nowizard') } ]; + $solutions{diskdrake} = [ 0, _("Custom disk partitioning"), sub { partition_with_diskdrake($o, $hds, 'nowizard') } ]; } $solutions{fdisk} = @@ -201,7 +201,7 @@ sub partitionWizard { my @solutions = sort { $b->[0] <=> $a->[0] } values %solutions; - my $level = $::beginner ? 0 : $::expert ? -9999 : -10; + my $level = $::expert ? -9999 : 0; my @sol = grep { $_->[0] >= $level } @solutions; log::l("solutions found: " . join('', map {$_->[1]} @sol) . " (all solutions found: " . join('', map {$_->[1]} @solutions) . ")"); diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 8743e689c..2fd5f5b88 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -189,27 +189,17 @@ sub selectInstallClass { _("Recommended") => "beginner", ), if_($o->{meta_class} ne 'desktop', - _("Customized") => "specific", + _("Expert") => "expert", ), ); %c = @c = (_("Expert") => "expert") if $::expert && !$clicked; $o->set_help('selectInstallClassCorpo') if $::corporate; - my $verifInstallClass = sub { - $::beginner = $c{$_[0]} eq "beginner"; - $::expert = $c{$_[0]} eq "expert" && - $o->ask_from_list_('', -_("Are you sure you are an expert? -You will be allowed to make powerful but dangerous things here. - -You will be asked questions such as: ``Use shadow file for passwords?'', -are you ready to answer that kind of questions?"), - [ _("Customized"), _("Expert") ]) ne "Customized"; - }; + my $verifInstallClass = sub { $::expert = $c{$_[0]} eq "expert" }; $o->{isUpgrade} = $o->selectInstallClass1($verifInstallClass, - first(list2kv(@c)), ${{reverse %c}}{$::beginner ? "beginner" : $::expert ? "expert" : "specific"}, + first(list2kv(@c)), ${{reverse %c}}{$::expert ? "expert" : "beginner"}, [ __("Install"), __("Update") ], $o->{isUpgrade} ? "Update" : "Install") eq "Update"; if ($::corporate || !$::expert) { @@ -356,12 +346,12 @@ sub choosePartitionsToFormat { $o->SUPER::choosePartitionsToFormat($fstab); - my @l = grep { !$_->{isMounted} && !$_->{isFormatted} && $_->{mntpoint} && !($::beginner && isSwap($_)) && + my @l = grep { !$_->{isMounted} && !$_->{isFormatted} && $_->{mntpoint} && !(isSwap($_) && !$::expert) && (!isOtherAvailableFS($_) || $::expert || $_->{toFormat}) } @$fstab; - $_->{toFormat} = 1 foreach grep { $::beginner && isSwap($_) } @$fstab; + $_->{toFormat} = 1 foreach grep { isSwap($_) && !$::expert } @$fstab; - return if @l == 0 || $::beginner && 0 == grep { ! $_->{toFormat} } @l; + return if @l == 0 || !$::expert && 0 == grep { ! $_->{toFormat} } @l; my $name2label = sub { sprintf("%s %s", isSwap($_) ? type2name($_->{type}) : $_->{mntpoint}, @@ -432,7 +422,7 @@ sub choosePackages { my $min_size = pkgs::selectedSize($packages); $min_size < $availableC or die _("Your system has not enough space left for installation or upgrade (%d > %d)", $min_size, $availableC); - my $min_mark = $::beginner ? 2 : 1; + my $min_mark = $::expert ? 1 : 2; my $def_mark = 4; #-TODO: was 59, 59 is for packages that need gl hw acceleration. my $b = pkgs::saveSelected($packages); @@ -442,12 +432,12 @@ sub choosePackages { my $max_size = pkgs::selectedSize($packages) + 1; #- avoid division by zero. pkgs::restoreSelected($b); - $o->chooseGroups($packages, $compssUsers, $min_mark, \$individual, $max_size) unless $::beginner || $::corporate; + $o->chooseGroups($packages, $compssUsers, $min_mark, \$individual, $max_size) if $::expert && !$::corporate; my $size2install = min($availableC, do { my $max = round_up(min($max_size, $availableC) / sqr(1024), 100); - if ($::beginner) { + if (!$::expert) { if ($o->{isUpgrade}) { min($def_size, $max); } else { @@ -546,7 +536,7 @@ sub chooseCD { #- if no other medium available or a poor beginner, we are choosing for him! #- note first CD is always selected and should not be unselected! - return if scalar(@mediums) == 0 || $::beginner; + return if @mediums == () || !$::expert; #- build mediumDescr according to mediums, this avoid asking multiple times #- all the medium grouped together on only one CD. @@ -706,7 +696,7 @@ sub configurePrinter { require printer; require printerdrake; - if ($::beginner && !$clicked) { + if (!$::expert && !$clicked) { printerdrake::auto_detect($o) or return; } @@ -748,7 +738,7 @@ sub setRootPassword { $o->set_help("setRootPassword", if_($o->{installClass} =~ "server" || $::expert, "setRootPasswordMd5"), - if_(!$::beginner, "setRootPasswordNIS")); + if_($::expert, "setRootPasswordNIS")); $o->ask_from_entries_refH_powered( { @@ -764,7 +754,7 @@ sub setRootPassword { } } }, [ { label => _("Password"), val => \$sup->{password}, hidden => 1 }, { label => _("Password (again)"), val => \$sup->{password2}, hidden => 1 }, - if_(!$::beginner, + if_($::expert, { label => _("Use NIS"), val => \$nis, type => 'bool', text => _("yellow pages") }, ), ]) or return; @@ -803,7 +793,7 @@ sub addUser { sub createBootdisk { my ($o, $first_time) = @_; - return if $first_time && $::beginner; + return if $first_time && !$::expert; if (arch() =~ /sparc/) { #- as probing floppies is a bit more different on sparc, assume always /dev/fd0. @@ -912,7 +902,7 @@ sub miscellaneous { add2hash_ $o, { useSupermount => $s < 4 && arch() !~ /^sparc/ }; $s = $l{$s} || $s; - !$::beginner || $clicked and $o->ask_from_entries_refH('', + $::expert || $clicked and $o->ask_from_entries_refH('', _("Miscellaneous questions"), [ { label => _("Use hard drive optimisations?"), val => \$u->{HDPARM}, type => 'bool', text => _("(may cause data corruption)") }, { label => _("Choose security level"), val => \$s, list => [ map { $l{$_} } ikeys %l ] }, @@ -957,7 +947,7 @@ sub configureX { require Xconfigurator; { local $::testing = 0; #- unset testing - local $::auto = $::beginner && !$clicked; + local $::auto = !$::expert && !$clicked; Xconfigurator::main($o->{prefix}, $o->{X}, $o, $o->{allowFB}, bool($o->{pcmcia}), sub { $o->pkg_install(@_); diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index a8cd90bff..60a96b56e 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -382,9 +382,8 @@ sub _create_window($$) { require install_gtk; install_gtk::create_big_help($::o); } elsif (chr($_[1]{keyval}) eq 'e' && $_[1]{state} & 8) { - log::l("Switching to " . ($::beginner ? "expert" : "beginner")); - $::expert = $::beginner; - $::beginner = !$::expert; + log::l("Switching to " . ($::expert ? "beginner" : "expert")); + $::expert = !$::expert; } elsif ($d) { #- previous field is created here :( my $s; foreach (reverse @{$::o->{orderedSteps}}) { diff --git a/perl-install/network.pm b/perl-install/network.pm index 6ed925406..de30096e2 100644 --- a/perl-install/network.pm +++ b/perl-install/network.pm @@ -254,7 +254,7 @@ sub configureNetwork { any::setup_thiskind($in, 'net', !$::expert, 1); my @l = detect_devices::getNet() or die _("no network card found"); - my $last; foreach ($::beginner ? $l[0] : @l) { + my $last; foreach ($::expert ? @l : $l[0]) { my $intf2 = findIntf($intf ||= {}, $_); add2hash($intf2, $last); add2hash($intf2, { NETMASK => '255.255.255.0' }); @@ -359,7 +359,7 @@ sub miscellaneousNetwork { my ($in, $clicked) = @_; my $u = $::o->{miscellaneous} ||= {}; $::isInstall and $in->set_help('configureNetworkProxy'); - !$::beginner || $clicked and $in->ask_from_entries_refH('', + $::expert || $clicked and $in->ask_from_entries_refH('', _("Proxies configuration"), [ { label => _("HTTP proxy"), val => \$u->{http_proxy} }, { label => _("FTP proxy"), val => \$u->{ftp_proxy} }, diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index 2bf49a649..c8a377bda 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -196,7 +196,7 @@ my %fs2type = reverse %type2fs; sub important_types { my @l = $::expert ? sort values %types : - (@important_types, $::beginner ? () : @important_types2); + (@important_types, if_($::expert, @important_types2)); difference2(\@l, \@bad_types); } diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index d78aed3bb..998b2eef4 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -338,7 +338,7 @@ sub main($$$;$) { my ($queue, $continue) = ('', 1); while ($continue) { - if ($::beginner || !(scalar keys %{$printer->{configured} || {}})) { + if (!$::expert || !(scalar keys %{$printer->{configured} || {}})) { $queue = $printer->{want} || $in->ask_yesorno(_("Printer"), _("Would you like to configure a printer?"), 0) ? 'lp' : 'Done'; } else { @@ -439,7 +439,7 @@ and optionally the port number."), [ $in->set_help('configurePrinterLocal') if $::isInstall; $in->ask_from_entries_refH_powered( { title => _("Select Printer Connection"), - cancel => $::beginner || !$printer->{configured}{$printer->{QUEUE}} ? '' : _("Remove queue"), + cancel => !$::expert || !$printer->{configured}{$printer->{QUEUE}} ? '' : _("Remove queue"), messages => _("Every printer need a name (for example lp). Other parameters such as the description of the printer or its location @@ -450,7 +450,7 @@ how is the printer connected?") }, [ { label => _("Location"), val => \$printer->{Location} }, ]) or printer::remove_queue($printer), $continue = 1, last; } else { - if ($::beginner) { + if (!$::expert) { $printer->{str_type} = $in->ask_from_list_(_("Select Printer Connection"), _("How is the printer connected?"), [ printer::printer_type($printer) ], @@ -460,7 +460,7 @@ how is the printer connected?") }, [ $in->set_help('configurePrinterLPR') if $::isInstall; $in->ask_from_entries_refH_powered( { title => _("Select Printer Connection"), - cancel => $::beginner ? '' : _("Remove queue"), + cancel => $::expert ? _("Remove queue") : '', messages => _("Every print queue (which print jobs are directed to) needs a name (often lp) and a spool directory associated with it. What @@ -493,7 +493,7 @@ name and directory should be used for this queue and how is the printer connecte if (!$continue && setup_gsdriver($printer, $in, $install, $printer->{TYPE} !~ /LOCAL/ && $upNetwork)) { delete $printer->{OLD_QUEUE} if $printer->{QUEUE} ne $printer->{OLD_QUEUE} && $printer->{configured}{$printer->{QUEUE}}; - $continue = !$::beginner; + $continue = $::expert; } else { $continue = 1; } -- cgit v1.2.1