From 152b0b998e117a4a79dd77d401df8cfc234574a5 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Sat, 6 Nov 1999 09:10:11 +0000 Subject: *** empty log message *** --- perl-install/Makefile | 4 +-- perl-install/common.pm | 14 +++++---- perl-install/detect_devices.pm | 8 +++++ perl-install/install2.pm | 6 ++++ perl-install/install_any.pm | 20 +++++++++++++ perl-install/install_steps.pm | 18 +++++++++++ perl-install/install_steps_interactive.pm | 50 +++++++++++++++++++++++++++++++ perl-install/my_gtk.pm | 5 ++++ perl-install/printer.pm | 23 ++------------ perl-install/share/list | 1 + 10 files changed, 121 insertions(+), 28 deletions(-) diff --git a/perl-install/Makefile b/perl-install/Makefile index b968863c7..a6cae4b8e 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -11,7 +11,7 @@ BASE = $(ROOTDEST)/Mandrake/base DESTREP4PMS = $(DEST)$(REP4PMS) STAGE2TMP = /tmp/stage2_tmp PERL = perl -LOCALFILES = mouseconfig ddcxinfos +LOCALFILES = pnp_serial mouseconfig ddcxinfos DIRS = c po pci_probing resize_fat EXCLUDE = $(LOCALFILES) boot.img keymaps consolefonts install RPMS = $(wildcard $(ROOTDEST)/Mandrake/RPMS/*.rpm) @@ -138,7 +138,7 @@ get_needed_files: $(DIRS) cp -a keymaps $(DEST)/usr/share cp -a consolefonts $(DEST)/usr/share - cp modparm.lst MonitorsDB $(DEST)/usr/share + cp kppprc.in modparm.lst MonitorsDB $(DEST)/usr/share cp logo-mandrake.xpm $(DEST)/usr/share cp -a themes $(DEST)/usr/share/gtk cp compss compssUsers compssList $(ROOTDEST)/Mandrake/base diff --git a/perl-install/common.pm b/perl-install/common.pm index b32f9ff11..59e32bd61 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -239,11 +239,15 @@ sub translate { my ($s) = @_; my ($lang) = substr($ENV{LC_ALL} || $ENV{LANGUAGE} || $ENV{LC_MESSAGES} || $ENV{LANG} || '', 0, 2); - require 'lang.pm'; - lang::load_po ($lang) unless defined $po::I18N::{$lang}; #- the space if needed to mislead perl2fcalls (as lang is not included here) - $po::I18N::{$lang} or return $s; - my $l = *{$po::I18N::{$lang}}; - $l->{$s} || $s; + if ($lang) { + require 'lang.pm'; + lang::load_po ($lang) unless defined $po::I18N::{$lang}; #- the space if needed to mislead perl2fcalls (as lang is not included here) + $po::I18N::{$lang} or return $s; + my $l = *{$po::I18N::{$lang}}; + $l->{$s} || $s; + } else { + $s; #- should avoid some strange behaviour if no lang defined. + } } sub untranslate($@) { diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 7119fbd84..d932b4922 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -210,6 +210,14 @@ sub whatPrinterPort() { grep { tryWrite($_)} qw(/dev/lp0 /dev/lp1 /dev/lp2); } +sub hasModem($) { + my ($device) = @_; + my %probe; + local *F; open F, "pnp_serial $device |"; + foreach () { $probe{$1} = $2 if /^\s+(.*?)\s*:\s*\"(.*)\"\s*$/ } + $probe{CLASS} =~ /Modem/i && $probe{DESCRIPTION}; +} + #-###################################################################################### #- Wonderful perl :( #-###################################################################################### diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 3765fb147..be8c56704 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -48,6 +48,7 @@ my @installSteps = ( doInstallStep => [ __("Install system"), 1, -1 ], miscellaneous => [ __("Miscellaneous"), 1, 1 ], configureNetwork => [ __("Configure networking"), 1, 1, "formatPartitions" ], +#- configureModem => [ __("Configure modem"), 1, 1, "doInstallStep" ], configureTimezone => [ __("Configure timezone"), 1, 1, "doInstallStep" ], #- configureServices => [ __("Configure services"), 0, 0 ], configurePrinter => [ __("Configure printer"), 1, 0, "doInstallStep" ], @@ -364,6 +365,11 @@ sub configureNetwork { $o->configureNetwork($entered == 1 && !$clicked) } #------------------------------------------------------------------------------ +sub configureModem { + my ($clicked, $entered) = @_; + $o->modemConfig($clicked || $entered == 1); +} +#------------------------------------------------------------------------------ sub configureTimezone { my ($clicked) = $_[0]; my $f = "$o->{prefix}/etc/sysconfig/clock"; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 654e703b3..633e9d6c6 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -422,3 +422,23 @@ sub fsck_option() { my $y = $::o->{security} < 3 && $::beginner && "-y "; substInFile { s/^(\s*fsckoptions=)(-y )?/$1$y/ } "$::o->{prefix}/etc/rc.d/rc.sysinit"; } + +sub translate_file($$%) { + my ($inputfile, $outputfile, %toreplace) = @_; + local *OUT; local *IN; + + open IN , $inputfile or die "Can't open $inputfile $!"; + if ($::testing) { + *OUT = *STDOUT; + } else { + open OUT, ">$outputfile" or die "Can't open $outputfile $!"; + } + + while () { + if (/@@@(.*)@@@/) { + my $r = $toreplace{$1}; + s/@@@(.*)@@@/$r/g; + } + print OUT; + } +} diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index ccf47b4c5..3e14faa07 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -245,6 +245,24 @@ sub pcmciaConfig($) { }); } +#------------------------------------------------------------------------------ +sub modemConfig { + my ($o) = @_; + symlinkf($o->{modem}{device}, "$o->{prefix}/dev/modem") if $o->{modem}; +} + +sub pppConfig { + my ($o) = @_; + my %toreplace; + + $toreplace{$_} = $o->{modem}{$_} foreach qw(connection phone login passwd auth domain); + $toreplace{phone} =~ s/[^\d]//g; + $toreplace{dnsserver} = ($o->{modem}{dns1} && "$o->{modem}{dns1},") . ($o->{modem}{dns2} && "$o->{modem}{dns2},"); + $toreplace{exdnsdisabled} = $o->{modem}{exdnsdisabled} ? 1 : 0; + install_any::translate_file("/usr/share/kppprc.in" ,"$o->{prefix}/root/.kde/share/config/kppprc", %toreplace); + install_any::translate_file("/usr/share/kppprc.in" ,"$o->{prefix}/etc/skel/.kde/share/config/kppprc", %toreplace); +} + #------------------------------------------------------------------------------ sub timeConfig { my ($o, $f) = @_; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index e74c78b3c..75bf2a715 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -253,6 +253,7 @@ sub configureNetwork($) { $r ||= "Don't"; } } else { +# $r = $o->ask_from_list(_("Network Configuration"),) $o->ask_yesorno(_("Network Configuration"), _("Do you want to configure LAN (not dialup) networking for your system?")) or $r = "Don't"; } @@ -331,6 +332,55 @@ You may also enter the IP address of the gateway if you have one"), ); } +#------------------------------------------------------------------------------ +sub modemConfig { + my ($o, $clicked) = @_; + return unless $clicked; + + if ($o->ask_yesorno('', _("Do you have a modem?"), 0)) { + my ($device, $desc) = ''; + unless ($::expert && $o->ask_yesorno('', _("Skip modem autodetection?"), 1)) { + foreach (0..3) { + next if readlink("$o->{prefix}/dev/mouse") =~ /ttyS$_/; + $desc = detect_devices::hasModem("$o->{prefix}/dev/ttyS$_"); + $device = "ttyS$_" if $desc; + last if $device; + } + } + $device = mouse::serial_ports_names2dev($o->ask_from_list('', _("Which serial port is your modem connected to?"), + [ mouse::serial_ports_names() ])) unless $device; + log::l("using modem at /dev/$device"); + $o->{modem}{device} = $device; + } else { + $o->{modem} = undef; + } + + install_steps::modemConfig($o); + + $o->pppConfig() if $o->{modem}; +} + +sub pppConfig { + my ($o) = @_; + + my @l = ( +_("Connection name") => \$o->{modem}{connection}, +_("Phone number") => \$o->{modem}{phone}, +_("Login ID") => \$o->{modem}{login}, +_("Password") => { val => \$o->{modem}{passwd}, hidden => 1 }, +_("Authentication") => { val => \$o->{modem}{auth}, list => [ __("PAP"), __("CHAP"), __("Terminal-based"), __("Script-based") ] }, +_("Domain name") => \$o->{modem}{domain}, +_("First DNS Server") => \$o->{modem}{dns1}, +_("Second DNS Server") => \$o->{modem}{dns2}, +_("Disable existing DNS servers during connection") => { val => \$o->{modem}{exdnsdisabled}, type => 'bool', }, + ); + + install_steps::pppConfig($o) if $o->ask_from_entries_ref('', + _("Dial-in options"), + [ grep_index { even($::i) } @l ], + [ grep_index { odd($::i) } @l ]); +} + #------------------------------------------------------------------------------ sub timeConfig { my ($o, $f, $clicked) = @_; diff --git a/perl-install/my_gtk.pm b/perl-install/my_gtk.pm index 5dcd9b4da..733cad611 100644 --- a/perl-install/my_gtk.pm +++ b/perl-install/my_gtk.pm @@ -64,11 +64,16 @@ sub destroy($) { sub DESTROY { goto &destroy } sub sync($) { my ($o) = @_; + + flush(); + show($o); my $h = Gtk->idle_add(sub { Gtk->main_quit; 1 }); map { Gtk->main } (1..4); Gtk->idle_remove($h); + + flush(); } sub flush(;$) { Gtk->main_iteration while Gtk->events_pending; diff --git a/perl-install/printer.pm b/perl-install/printer.pm index d46002c6c..cf7d52cbb 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -354,27 +354,8 @@ sub create_spool_dir($) { #-Doesnt currently catch error exec'ing sed yet #------------------------------------------------------------------------------ sub create_config_file($$%) { - my ($inputfile, $outpufile, %toreplace) = @_; - my ($in, $out) = ("$prefix/$inputfile", "$prefix/$outpufile"); - local *OUT; - local *IN; - - #-TODO my $oldmask = umask 0755; - - open IN , $in or die "Can't open $in $!"; - if ($::testing) { - *OUT = *STDOUT - } else { - open OUT, ">$out" or die "Can't open $out $!"; - } - - while () { - if (/@@@(.*)@@@/) { - my $r = $toreplace{$1}; - s/@@@(.*)@@@/$r/g; - } - print OUT; - } + my ($inputfile, $outputfile, %toreplace) = @_; + install_any::translate_file("$prefix/$inputfile", "$prefix/$outputfile", %toreplace); } diff --git a/perl-install/share/list b/perl-install/share/list index 1368b0c35..cda42dfca 100644 --- a/perl-install/share/list +++ b/perl-install/share/list @@ -12,6 +12,7 @@ /usr/bin/bzip2 /usr/bin/perl /usr/bin/zsh +/usr/lib/libimlib-png.so /usr/lib/gtk/themes/engines/libpixmap.so /usr/lib/gtk/themes/engines/libpixmap.la /usr/lib/libimlib-png.so -- cgit v1.2.1