diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/Makefile | 2 | ||||
-rw-r--r-- | perl-install/Xconfigurator.pm | 7 | ||||
-rw-r--r-- | perl-install/common.pm | 7 | ||||
-rw-r--r-- | perl-install/fs.pm | 15 | ||||
-rw-r--r-- | perl-install/install2.pm | 3 | ||||
-rw-r--r-- | perl-install/install_any.pm | 40 | ||||
-rw-r--r-- | perl-install/modparm.pm | 2 | ||||
-rw-r--r-- | perl-install/printer.pm | 3 |
8 files changed, 68 insertions, 11 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile index 2af54a297..b24f61ceb 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -120,7 +120,7 @@ get_needed_files: $(DIRS) cp -a keymaps $(DEST)/usr/share cp -a consolefonts $(DEST)/usr/share - cp ifcfg-ppp.* chat-ppp.* kppprc.in modparm.lst $(DEST)/usr/share + cp *.in modparm.lst $(DEST)/usr/share cp MonitorsDB $(DEST)/usr/X11R6/lib/X11 cp logo-mandrake.xpm $(DEST)/usr/share cp -a themes $(DEST)/usr/share/gtk diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 7f8749cce..7e9bdb8b6 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -305,14 +305,15 @@ sub testFinalConfig($;$) { do { sleep 1 } until c::Xtest(":9") || waitpid($pid, c::WNOHANG()); my $b = before_leaving { unlink $f_err }; - + + local $_; local *F; open F, $f_err; while (<F>) { if (/\b(error|not supported)\b/i) { - my @msg = !/error/ && $_ ; + my @msg = !/error/ && $_ ; while (<F>) { /^$/ and last; - push @msg, $_; + push @msg, $_; } $in->ask_warn('', [ _("An error occurred:"), " ", @msg, diff --git a/perl-install/common.pm b/perl-install/common.pm index 33999ac11..148011f51 100644 --- a/perl-install/common.pm +++ b/perl-install/common.pm @@ -351,17 +351,14 @@ sub template2file($$%) { my ($inputfile, $outputfile, %toreplace) = @_; local *OUT; local *IN; - open IN , $inputfile or die "Can't open $inputfile $!"; + open IN, $inputfile or die "Can't open $inputfile $!"; if ($::testing) { *OUT = *STDOUT; } else { open OUT, ">$outputfile" or die "Can't open $outputfile $!"; } - while (<IN>) { - s/@@@(.*?)@@@/$toreplace{$1}/g; - print OUT; - } + map { s/@@@(.*?)@@@/$toreplace{$1}/g; print OUT; } <IN>; } sub substInFile(&@) { diff --git a/perl-install/fs.pm b/perl-install/fs.pm index 87eb0c132..5e0bee90d 100644 --- a/perl-install/fs.pm +++ b/perl-install/fs.pm @@ -244,6 +244,21 @@ sub write_fstab($;$$) { } grep { $_->{mntpoint} && type2fs($_->{type}) && ! exists $new{$_->{mntpoint}} && ! exists $new{"/dev/$_->{device}"} } @$fstab; + #- inserts dos/win partitions in fstab. + #- backward compatible win kdeicons script to handle upgrade correctly? + unshift @to_add, + map_index { + my $i = $::i ? $::i + 1 : ''; + my $device = $_->{device} =~ /^\/dev\/(.*)$/ ? $1 : $_->{device}; + + #- keep in mind the new line for fstab. + @new{("/mnt/DOS_$device", "/dev/$device")} = undef; + + mkdir "$prefix/mnt/DOS_$device", 0755 or log::l("failed to mkdir $prefix/mnt/DOS_$device: $!"); + [ "/dev/$device", "/mnt/DOS_$device", "vfat", "user,exec,conv=auto", 0, 0 ]; + } grep { isFat($_) && + ! exists $new{"/dev/$_->{device}"} } @$fstab; + my @current = cat_("$prefix/etc/fstab"); log::l("writing $prefix/etc/fstab"); diff --git a/perl-install/install2.pm b/perl-install/install2.pm index d9b138f21..ef3da4d85 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -351,6 +351,9 @@ sub doInstallStep { $o->beforeInstallPackages; $o->installPackages($o->{packages}); $o->afterInstallPackages; + + #- make icons for KDE. + install_any::kdeicons_postinstall($o->{prefix}); } #------------------------------------------------------------------------------ sub miscellaneous { diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index e08e121aa..2f0911696 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -481,4 +481,44 @@ sub install_urpmi { } } +sub list_home($) { + my ($prefix) = @_; + local *F; open F, "$prefix/etc/passwd"; + map { $_->[5] } grep { $_->[2] > 501 } map { [ split ':' ] } <F>; +} + +sub template2userfile($$$$%) { + my ($prefix, $inputfile, $outputrelfile, $force, %toreplace) = @_; + + foreach ("/etc/skel", "/root", list_home($prefix)) { + my $outputfile = "$prefix/$_/$outputrelfile"; + if (-d dirname($outputfile) && ($force || ! -e $outputfile)) { + log::l("generating $outputfile from template $inputfile"); + template2file($inputfile, $outputfile, %toreplace); + } + } +} + +sub kdeicons_postinstall { + my ($prefix) = @_; + + #- parse etc/fstab file to search for dos/win, zip, cdroms icons. + #- avoid rewriting existing file. + local *F; + open F, "$prefix/etc/fstab" or log::l("failed to read $prefix/etc/fstab"), return; + + foreach (<F>) { + if (/^\/dev\/(\S+)\s+\/mnt\/cdrom (\d*)\s+/x) { + my %toreplace = ( device => $1, id => $2 ); + template2userfile($prefix, "/usr/share/cdrom.kdelnk.in", "Desktop/cdrom$2.kdelnk", 0, %toreplace); + } elsif (/^\/dev\/(\S+)\s+\/mnt\/zip (\d*)\s+/x) { + my %toreplace = ( device => $1, id => $2 ); + template2userfile($prefix, "/usr/share/zip.kdelnk.in", "Desktop/zip$2.kdelnk", 0, %toreplace); + } elsif (/^\/dev\/(\S+)\s+\/mnt\/DOS_ (\S*)\s+/x) { + my %toreplace = ( device => $1, id => $2 ); + template2userfile($prefix, "/usr/share/DOS_.kdelnk.in", "Desktop/DOS_$2.kdelnk", 0, %toreplace); + } + } +} + 1; diff --git a/perl-install/modparm.pm b/perl-install/modparm.pm index b4ae12dc5..652f4aa24 100644 --- a/perl-install/modparm.pm +++ b/perl-install/modparm.pm @@ -24,7 +24,7 @@ sub read_modparm_file($) { local *F; open F, $file or log::l("missing $file: $!"), return; - while (<F>) { + foreach (<F>) { chomp; @line = split ':'; diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 3e8350d45..c414f496d 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -280,7 +280,8 @@ sub read_printer_db(;$) { %thedb and return; - local *DBPATH; #-don't have to do close + local $_; #- use of while (<... + local *DBPATH; #- don't have to do close ... and don't modify globals at least open DBPATH, $dbpath or die "An error has occurred on $dbpath : $!"; while (<DBPATH>) { |