diff options
author | Francois Pons <fpons@mandriva.com> | 1999-11-24 19:20:30 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 1999-11-24 19:20:30 +0000 |
commit | d7c6e8b958a653501f480b1cdc02c5020306669f (patch) | |
tree | 5320f01f21e0e2d68a2b5e5cfab4f73b17d4639d /perl-install/install_any.pm | |
parent | ef80e39ba0bde1a7022c864fc092f1b6575449d8 (diff) | |
download | drakx-d7c6e8b958a653501f480b1cdc02c5020306669f.tar drakx-d7c6e8b958a653501f480b1cdc02c5020306669f.tar.gz drakx-d7c6e8b958a653501f480b1cdc02c5020306669f.tar.bz2 drakx-d7c6e8b958a653501f480b1cdc02c5020306669f.tar.xz drakx-d7c6e8b958a653501f480b1cdc02c5020306669f.zip |
*** empty log message ***
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r-- | perl-install/install_any.pm | 40 |
1 files changed, 40 insertions, 0 deletions
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; |