/title>
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-09-16 18:35:07 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-09-16 18:35:07 +0000
commit8c7c8f9e1497f80cbe9bbdc1bf0b8552b7dd88cb (patch)
tree9521630ef9f9857cc3bb5c5ce606a958de4516cf
parentcf616f12521a0f539e4f02f70d0210beb0102320 (diff)
downloaddrakx-8c7c8f9e1497f80cbe9bbdc1bf0b8552b7dd88cb.tar
drakx-8c7c8f9e1497f80cbe9bbdc1bf0b8552b7dd88cb.tar.gz
drakx-8c7c8f9e1497f80cbe9bbdc1bf0b8552b7dd88cb.tar.bz2
drakx-8c7c8f9e1497f80cbe9bbdc1bf0b8552b7dd88cb.tar.xz
drakx-8c7c8f9e1497f80cbe9bbdc1bf0b8552b7dd88cb.zip
use new mkdir_p, rm_rf and cp_af from MDK::Common
-rw-r--r--perl-install/any.pm5
-rw-r--r--perl-install/bootloader.pm5
-rw-r--r--perl-install/commands.pm16
-rw-r--r--perl-install/fs.pm3
-rw-r--r--perl-install/install2.pm5
-rw-r--r--perl-install/install_any.pm17
-rw-r--r--perl-install/install_steps.pm19
-rw-r--r--perl-install/keyboard.pm1
-rw-r--r--perl-install/lang.pm19
-rw-r--r--perl-install/loopback.pm11
-rw-r--r--perl-install/mouse.pm1
-rw-r--r--perl-install/network/adsl.pm3
-rw-r--r--perl-install/network/netconnect.pm15
-rw-r--r--perl-install/pkgs.pm7
-rw-r--r--perl-install/printer.pm1
-rw-r--r--perl-install/printerdrake.pm1
-rw-r--r--perl-install/raid.pm3
-rw-r--r--perl-install/services.pm1
-rw-r--r--perl-install/timezone.pm3
-rw-r--r--perl-install/tinyfirewall.pm5
20 files changed, 51 insertions, 90 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 0d27c8eaa..3fcc19916 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -7,7 +7,6 @@ use strict;
#- misc imports
#-######################################################################################
use common;
-use commands;
use detect_devices;
use partition_table qw(:types);
use fsedit;
@@ -39,7 +38,7 @@ sub facesnames {
sub addKdmIcon {
my ($prefix, $user, $icon) = @_;
my $dest = "$prefix/usr/share/faces/$user.png";
- eval { commands::cp("-f", facesdir($prefix) . $icon . ".png", $dest) } if $icon;
+ eval { cp_af(facesdir($prefix) . $icon . ".png", $dest) } if $icon;
}
sub allocUsers {
@@ -509,7 +508,7 @@ END
}
#- install kppprc file according to used configuration.
- commands::mkdir_("-p", "$prefix/usr/share/config");
+ mkdir_p("$prefix/usr/share/config");
local *KPPPRC;
open KPPPRC, ">$prefix/usr/share/config/kppprc" or die "Can't open $prefix/usr/share/config/kppprc: $!";
#chmod 0600, "$prefix/usr/share/config/kppprc";
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm
index 4929ee59b..2a8b2e2a7 100644
--- a/perl-install/bootloader.pm
+++ b/perl-install/bootloader.pm
@@ -14,7 +14,6 @@ use any;
use fsedit;
use devices;
use loopback;
-use commands;
use detect_devices;
use partition_table_raw;
use run_program;
@@ -875,8 +874,8 @@ sub loadlin_cmd {
my ($prefix, $lilo) = @_;
my $e = get_label("linux", $lilo) || first(grep { $_->{type} eq "image" } @{$lilo->{entries}});
- commands::cp("$prefix$e->{kernel_or_dev}", "$prefix/boot/vmlinuz") unless -e "$prefix/boot/vmlinuz";
- commands::cp("$prefix$e->{initrd}", "$prefix/boot/initrd.img") unless -e "$prefix/boot/initrd.img";
+ cp_af("$prefix$e->{kernel_or_dev}", "$prefix/boot/vmlinuz") unless -e "$prefix/boot/vmlinuz";
+ cp_af("$prefix$e->{initrd}", "$prefix/boot/initrd.img") unless -e "$prefix/boot/initrd.img";
$e->{label}, sprintf"%s %s initrd=%s root=%s $e->{append}",
lnx4win_file($lilo, "/loadlin.exe", "/boot/vmlinuz", "/boot/initrd.img"),
diff --git a/perl-install/commands.pm b/perl-install/commands.pm
index 2a26b46dd..e378ab824 100644
--- a/perl-install/commands.pm
+++ b/perl-install/commands.pm
@@ -91,19 +91,7 @@ sub umount {
sub mkdir_ {
my ($rec) = getopts(\@_, qw(p));
-
- my $mkdir; $mkdir = sub {
- my $root = dirname $_[0];
- if (-e $root) {
- -d $root or die "mkdir: error creating directory $_[0]: $root is a file and i won't delete it\n";
- } else {
- $rec or die "mkdir: $root does not exist (try option -p)\n";
- &$mkdir($root);
- }
- $rec and -d $_[0] and return;
- mkdir $_[0], 0755 or die "mkdir: error creating directory $_: $!\n";
- };
- &$mkdir($_) foreach @_;
+ mkdir_p($_) foreach @_;
}
@@ -406,7 +394,7 @@ sub unpack_ {
print "$filename\n";
my $dir = dirname($filename);
- -d $dir or mkdir_('-p', $dir);
+ -d $dir or mkdir_p($dir);
local *G;
open G, "> $filename" or die "can't write file $filename: $!\n";
diff --git a/perl-install/fs.pm b/perl-install/fs.pm
index 6df2b3005..e047c1611 100644
--- a/perl-install/fs.pm
+++ b/perl-install/fs.pm
@@ -11,7 +11,6 @@ use partition_table qw(:types);
use run_program;
use swap;
use detect_devices;
-use commands;
use modules;
use fsedit;
use loopback;
@@ -556,7 +555,7 @@ sub mount {
my ($dev, $where, $fs, $rdonly) = @_;
log::l("mounting $dev on $where as type $fs");
- -d $where or commands::mkdir_('-p', $where);
+ -d $where or mkdir_p($where);
my @fs_modules = qw(vfat hfs romfs ufs reiserfs xfs jfs ext3);
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index fa26935fd..fb6d0f21c 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -12,7 +12,6 @@ use steps;
use common;
use install_any qw(:all);
use install_steps;
-use commands;
use lang;
use keyboard;
use mouse;
@@ -584,14 +583,14 @@ sub main {
#- make sure failed upgrade will not hurt too much.
install_steps::cleanIfFailedUpgrade($o);
- -e "$o->{prefix}/usr/sbin/urpmi.update" or eval { commands::rm("-rf", "$o->{prefix}/var/lib/urpmi") };
+ -e "$o->{prefix}/usr/sbin/urpmi.update" or eval { rm_rf("$o->{prefix}/var/lib/urpmi") };
#- mainly for auto_install's
run_program::run("bash", "-c", $o->{postInstallNonRooted}) if $o->{postInstallNonRooted};
run_program::rooted($o->{prefix}, "sh", "-c", $o->{postInstall}) if $o->{postInstall};
#- have the really bleeding edge ddebug.log
- eval { commands::cp('-f', "/tmp/ddebug.log", "$o->{prefix}/root") };
+ eval { cp_af("/tmp/ddebug.log", "$o->{prefix}/root") };
#- ala pixel? :-) [fpons]
common::sync(); common::sync();
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index a82ebe5b9..bb1271cab 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -168,11 +168,10 @@ sub setup_postinstall_rpms($$) {
$postinstall_rpms = "$prefix/usr/postinstall-rpm";
require pkgs;
- require commands;
log::l("postinstall rpms directory set to $postinstall_rpms");
clean_postinstall_rpms(); #- make sure in case of previous upgrade problem.
- commands::mkdir_('-p', $postinstall_rpms);
+ mkdir_p($postinstall_rpms);
#- compute closure of unselected package that may be copied,
#- don't complain if package does not exists as it may happen
@@ -191,15 +190,14 @@ sub setup_postinstall_rpms($$) {
#- copy the package files in the postinstall RPMS directory.
#- last arg is default medium '' known as the CD#1.
pkgs::extractHeaders($prefix, \@toCopy, $packages->{mediums}{1});
- commands::cp((map { "/tmp/image/" . relGetFile(pkgs::packageFile($_)) } @toCopy), $postinstall_rpms);
+ cp_af((map { "/tmp/image/" . relGetFile(pkgs::packageFile($_)) } @toCopy), $postinstall_rpms);
log::l("copying Auto Install Floppy");
getAndSaveInstallFloppy($::o, "$postinstall_rpms/auto_install.img");
}
sub clean_postinstall_rpms() {
- require commands;
- $postinstall_rpms and -d $postinstall_rpms and commands::rm('-rf', $postinstall_rpms);
+ $postinstall_rpms and -d $postinstall_rpms and rm_rf($postinstall_rpms);
}
@@ -698,8 +696,7 @@ sub getAndSaveInstallFloppy {
my ($o, $where) = @_;
if ($postinstall_rpms && -d $postinstall_rpms && -r "$postinstall_rpms/auto_install.img") {
log::l("getAndSaveInstallFloppy: using file saved as $postinstall_rpms/auto_install.img");
- require commands;
- commands::cp("-f", "$postinstall_rpms/auto_install.img", $where);
+ cp_af("$postinstall_rpms/auto_install.img", $where);
} else {
my $image = cat_("/proc/cmdline") =~ /pcmcia/ ? "pcmcia" :
${{ disk => 'hd', cdrom => 'cdrom', ftp => 'network', nfs => 'network', http => 'network' }}{$o->{method}};
@@ -722,10 +719,9 @@ sub getAndSaveAutoInstallFloppy {
getAndSaveInstallFloppy($o, $imagefile) or return;
devices::make($_) foreach qw(/dev/loop6 /dev/ram);
- require commands;
run_program::run("losetup", "/dev/loop6", $imagefile);
fs::mount("/dev/loop6", $mountdir, "romfs", 'readonly');
- commands::cp("-f", $mountdir, $workdir);
+ cp_af($mountdir, $workdir);
fs::umount($mountdir);
run_program::run("losetup", "-d", "/dev/loop6");
@@ -744,9 +740,10 @@ sub getAndSaveAutoInstallFloppy {
fs::mount("/dev/ram", $mountdir, 'romfs', 0);
run_program::run("silo", "-r", $mountdir, "-F", "-i", "/fd.b", "-b", "/second.b", "-C", "/silo.conf");
fs::umount($mountdir);
+ require commands;
commands::dd("if=/dev/ram", "of=$where", "bs=1440", "count=1024");
- commands::rm("-rf", $workdir, $mountdir, $imagefile);
+ rm_rf($workdir, $mountdir, $imagefile);
} else {
my $imagefile = "$o->{prefix}/tmp/autoinst.img";
my $mountdir = "$o->{prefix}/tmp/aif-mount"; -d $mountdir or mkdir $mountdir, 0755;
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 080258463..ebf31a10b 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -49,7 +49,7 @@ sub leavingStep {
log::l("step `$step' finished");
if (-d "$o->{prefix}/root") {
- eval { commands::cp('-f', "/tmp/ddebug.log", "$o->{prefix}/root") };
+ eval { cp_af("/tmp/ddebug.log", "$o->{prefix}/root") };
output(install_any::auto_inst_file(), install_any::g_auto_install());
}
@@ -289,7 +289,7 @@ sub beforeInstallPackages {
foreach (@filesToSaveForUpgrade) {
unlink "$o->{prefix}/$_.mdkgisave";
if (-e "$o->{prefix}/$_") {
- eval { commands::cp("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") };
+ eval { cp_af("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") };
}
}
}
@@ -345,7 +345,7 @@ sub installPackages($$) { #- complete REWORK, TODO and TOCHECK!
#- important files and restore them after.
foreach (@{$o->{toSave} || []}) {
if (-e "$o->{prefix}/$_") {
- eval { commands::cp("-f", "$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") };
+ eval { cp_af("$o->{prefix}/$_", "$o->{prefix}/$_.mdkgisave") };
}
}
pkgs::remove($o->{prefix}, $o->{toRemove});
@@ -422,8 +422,8 @@ Consoles 1,3,4,7 may also contain interesting information";
if ($o->{pcmcia}) {
substInFile { s/.*(TaskBarShowAPMStatus).*/$1=1/ } "$o->{prefix}/usr/lib/X11/icewm/preferences";
- eval { commands::cp("$o->{prefix}/usr/share/applnk/System/kapm.kdelnk",
- "$o->{prefix}/etc/skel/Desktop/Autostart/kapm.kdelnk") };
+ eval { cp_af("$o->{prefix}/usr/share/applnk/System/kapm.kdelnk",
+ "$o->{prefix}/etc/skel/Desktop/Autostart/kapm.kdelnk") };
}
my $msec = "$o->{prefix}/etc/security/msec";
@@ -514,7 +514,7 @@ sub copyKernelFromFloppy {
return if $::testing || !$o->{blank};
fs::mount($o->{blank}, "/floppy", "vfat", 0);
- eval { commands::cp("-f", "/floppy/vmlinuz", "$o->{prefix}/boot/vmlinuz-default") };
+ eval { cp_af("/floppy/vmlinuz", "$o->{prefix}/boot/vmlinuz-default") };
if ($@) {
log::l("copying of /floppy/vmlinuz from blank modified disk failed: $@");
}
@@ -539,7 +539,7 @@ sub updateModulesFromFloppy {
my $qsext = quotemeta $sext;
foreach my $target (@dest_files) {
$target =~ /$qsfile/ or next;
- eval { commands::cp("-f", $s, $target) };
+ eval { cp_af($s, $target) };
if ($@) {
log::l("updating module $target by $s failed: $@");
} else {
@@ -676,7 +676,7 @@ sub addUser {
foreach my $u (@$users) {
if (! -d "$p$u->{home}") {
my $mode = $o->{security} < 2 ? 0755 : 0750;
- eval { commands::cp("-f", "$p/etc/skel", "$p$u->{home}") };
+ eval { cp_af("$p/etc/skel", "$p$u->{home}") };
if ($@) {
log::l("copying of skel failed: $@"); mkdir("$p$u->{home}", $mode);
} else {
@@ -818,8 +818,7 @@ sub configureXBefore {
my $xkb = $o->{X}{keyboard}{xkb_keymap} || keyboard::keyboard2xkb($o->{keyboard});
$xkb = '' if !($xkb && $xkb =~ /([^(]*)/ && -e "$o->{prefix}/usr/X11R6/lib/X11/xkb/symbols/$1");
if (!$xkb && (my $f = keyboard::xmodmap_file($o->{keyboard}))) {
- require commands;
- commands::cp("-f", $f, "$o->{prefix}/etc/X11/xinit/Xmodmap");
+ cp_af($f, "$o->{prefix}/etc/X11/xinit/Xmodmap");
$xkb = '';
}
{
diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm
index 83eec4d9e..bbedf76e6 100644
--- a/perl-install/keyboard.pm
+++ b/perl-install/keyboard.pm
@@ -10,7 +10,6 @@ use strict;
use common;
use detect_devices;
use run_program;
-use commands;
use log;
use c;
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index d816144bb..1d335540c 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -7,7 +7,6 @@ use strict;
#- misc imports
#-######################################################################################
use common;
-use commands;
use log;
#-######################################################################################
@@ -329,7 +328,7 @@ sub set {
if (!-e "$ENV{SHARE_PATH}/locale/$lang"