From 8c7c8f9e1497f80cbe9bbdc1bf0b8552b7dd88cb Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 16 Sep 2001 18:35:07 +0000 Subject: use new mkdir_p, rm_rf and cp_af from MDK::Common --- perl-install/any.pm | 5 ++--- perl-install/bootloader.pm | 5 ++--- perl-install/commands.pm | 16 ++-------------- perl-install/fs.pm | 3 +-- perl-install/install2.pm | 5 ++--- perl-install/install_any.pm | 17 +++++++---------- perl-install/install_steps.pm | 19 +++++++++---------- perl-install/keyboard.pm | 1 - perl-install/lang.pm | 19 ++++++------------- perl-install/loopback.pm | 11 +++++------ perl-install/mouse.pm | 1 - perl-install/network/adsl.pm | 3 +-- perl-install/network/netconnect.pm | 15 +++++++-------- perl-install/pkgs.pm | 7 +++---- perl-install/printer.pm | 1 - perl-install/printerdrake.pm | 1 - perl-install/raid.pm | 3 +-- perl-install/services.pm | 1 - perl-install/timezone.pm | 3 +-- perl-install/tinyfirewall.pm | 5 ++--- 20 files changed, 51 insertions(+), 90 deletions(-) (limited to 'perl-install') 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" && common::usingRamdisk()) { @ENV{qw(LANG LC_ALL LANGUAGE LINGUAS)} = (); - eval { commands::rm("-r", "$ENV{SHARE_PATH}/locale") }; + eval { rm_rf("$ENV{SHARE_PATH}/locale") }; eval { require packdrake; my $packer = new packdrake("$ENV{SHARE_PATH}/locale.cz2", quiet => 1); @@ -424,27 +423,21 @@ sub write { if ($c->[0]) { add2hash $h, { SYSFONT => $c->[0] }; eval { - commands::cp("-f", - "$p/consolefonts/$c->[0].psf.gz", - "$prefix/etc/sysconfig/console/consolefonts"); + cp_af("$p/consolefonts/$c->[0].psf.gz", "$prefix/etc/sysconfig/console/consolefonts"); }; $@ and log::l("missing console font $c->[0]"); } if ($c->[1]) { add2hash $h, { UNIMAP => $c->[1] }; eval { - commands::cp("-f", - glob_("$p/consoletrans/$c->[1]*"), - "$prefix/etc/sysconfig/console/consoletrans"); + cp_af(glob_("$p/consoletrans/$c->[1]*"), "$prefix/etc/sysconfig/console/consoletrans"); }; $@ and log::l("missing console unimap file $c->[1]"); } if ($c->[2]) { add2hash $h, { SYSFONTACM => $c->[2] }; eval { - commands::cp("-f", - glob_("$p/consoletrans/$c->[2]*"), - "$prefix/etc/sysconfig/console/consoletrans"); + cp_af(glob_("$p/consoletrans/$c->[2]*"), "$prefix/etc/sysconfig/console/consoletrans"); }; $@ and log::l("missing console acm file $c->[2]"); } @@ -471,8 +464,8 @@ sub load_mo { if ($::isInstall && common::usingRamdisk()) { # cleanup - eval { commands::rm("-r", $localedir) }; - eval { commands::mkdir_("-p", dirname("$localedir/$_/$suffix")) }; + eval { rm_rf($localedir) }; + eval { mkdir_p(dirname("$localedir/$_/$suffix")) }; install_any::getAndSaveFile ("$localedir/$_/$suffix"); -s $f and return $_; diff --git a/perl-install/loopback.pm b/perl-install/loopback.pm index 89b0072b9..73a00f94a 100644 --- a/perl-install/loopback.pm +++ b/perl-install/loopback.pm @@ -9,7 +9,6 @@ use strict; use MDK::Common::System; use common; use partition_table qw(:types); -use commands; use fs; use fsedit; use log; @@ -49,11 +48,11 @@ sub carryRootCreateSymlink { my $mntpoint = "$prefix$part->{mntpoint}"; unless (-e $mntpoint) { - eval { commands::mkdir_("-p", dirname($mntpoint)) }; + eval { mkdir_p(dirname($mntpoint)) }; #- do non-relative link for install, should be changed to relative link before rebooting symlink "/initrd/loopfs", $mntpoint; - commands::mkdir_("-p", "/initrd/loopfs/lnx4win/boot"); + mkdir_p("/initrd/loopfs/lnx4win/boot"); symlink "/initrd/loopfs/lnx4win/boot", "$prefix/boot"; } #- indicate kernel to keep initrd @@ -73,7 +72,7 @@ sub create { my $f = $part->{device} = "$prefix$part->{loopback_device}{mntpoint}$part->{loopback_file}"; return if -e $f; - eval { commands::mkdir_("-p", dirname($f)) }; + eval { mkdir_p(dirname($f)) }; log::l("creating loopback file $f ($part->{size} sectors)"); @@ -117,8 +116,8 @@ sub save_boot { $loop_boot or return; my @files = glob_("$prefix/boot/*"); - commands::cp("-f", @files, $loop_boot) if @files; - commands::rm("-rf", "$prefix/boot"); + cp_af(@files, $loop_boot) if @files; + rm_rf("$prefix/boot"); symlink $loop_boot, "$prefix/boot"; } diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index eca8df739..4a3753d6e 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -11,7 +11,6 @@ use modules; use detect_devices; use run_program; use devices; -use commands; use modules; use any; use log; diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index 95919ec2c..0d97eb29c 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -1,7 +1,6 @@ package network::adsl; use common; -use commands; use run_program; use network::tools; use network::ethernet; @@ -91,7 +90,7 @@ sub adsl_conf { sub adsl_conf_backend { my ($adsl, $netc, $adsl_type) = @_; - commands::mkdir_("-p", "$prefix/etc/ppp"); + mkdir_p("$prefix/etc/ppp"); output("$prefix/etc/ppp/options", 'lock noipdefault diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 03be12866..1aa068b11 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -13,7 +13,6 @@ use modules; use any; use mouse; use network; -use commands; use network::tools; use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog); @@ -409,7 +408,7 @@ DOMAINNAME2=$netc->{DOMAINNAME2}" ); chmod 0600, "$prefix/etc/sysconfig/network-scripts/draknet_conf"; my $a = $netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default"; - commands::cp("-f", "$prefix/etc/sysconfig/network-scripts/draknet_conf", "$prefix/etc/sysconfig/network-scripts/draknet_conf." . $a); + cp_af("$prefix/etc/sysconfig/network-scripts/draknet_conf", "$prefix/etc/sysconfig/network-scripts/draknet_conf." . $a); chmod 0600, "$prefix/etc/sysconfig/network-scripts/draknet_conf"; chmod 0600, "$prefix/etc/sysconfig/network-scripts/draknet_conf." . $a; foreach ( ["$prefix$connect_file", "up"], @@ -423,7 +422,7 @@ DOMAINNAME2=$netc->{DOMAINNAME2}" ["$prefix/etc/ppp/peers/adsl", "speedtouch"], ) { my $file = "$prefix/etc/sysconfig/network-scripts/net_" . $_->[1] . "." . $a; - -e ($_->[0]) and commands::cp("-f", $_->[0], $file) and chmod 0755, $file; + -e ($_->[0]) and cp_af($_->[0], $file) and chmod 0755, $file; } } @@ -434,7 +433,7 @@ sub set_profile { my $f = "$prefix/etc/sysconfig/network-scripts/draknet_conf"; -e ($f . "." . $profile) or return; $netcnx->{PROFILE}=$profile; - commands::cp("-f", $f . "." . $profile, $f); + cp_af($f . "." . $profile, $f); foreach ( ["$prefix$connect_file", "up"], ["$prefix$disconnect_file", "down"], ["$prefix$connect_prog", "prog"], @@ -446,7 +445,7 @@ sub set_profile { ["$prefix/etc/ppp/peers/adsl", "speedtouch"], ) { my $c = "$prefix/etc/sysconfig/network-scripts/net_" . $_->[1] . "." . $profile; - -e ($c) and commands::cp("-f", $c, $_->[0]); + -e ($c) and cp_af($c, $_->[0]); } } @@ -454,8 +453,8 @@ sub del_profile { my ($netcnx, $profile) = @_; $profile or return; $profile eq "default" and return; - commands::rm("-f", "$prefix/etc/sysconfig/network-scripts/draknet_conf." . $profile); - commands::rm("-f", glob_("$prefix/etc/sysconfig/network-scripts/net_{up,down,prog,iop1B,iop2B,isdn1B,isdn2B,resolv,speedtouch}." . $profile)); + rm_rf("$prefix/etc/sysconfig/network-scripts/draknet_conf." . $profile); + rm_rf(glob_("$prefix/etc/sysconfig/network-scripts/net_{up,down,prog,iop1B,iop2B,isdn1B,isdn2B,resolv,speedtouch}." . $profile)); } sub add_profile { @@ -464,7 +463,7 @@ sub add_profile { $profile eq "default" and return; my $cmd1 = "$prefix/etc/sysconfig/network-scripts/draknet_conf." . ($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default"); my $cmd2 = "$prefix/etc/sysconfig/network-scripts/draknet_conf." . $profile; - commands::cp("-f", $cmd1, $cmd2); + cp_af($cmd1, $cmd2); } sub get_profiles { diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 8258ce9a1..3b14e298b 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -7,7 +7,6 @@ use vars qw(*LOG %preferred $limitMinTrans %compssListDesc); use MDK::Common::System; use common; use install_any; -use commands; use run_program; use detect_devices; use log; @@ -126,7 +125,7 @@ sub packageId { sub cleanHeaders { my ($prefix) = @_; - commands::rm("-rf", "$prefix/tmp/headers") if -e "$prefix/tmp/headers"; + rm_rf("$prefix/tmp/headers") if -e "$prefix/tmp/headers"; } #- get all headers from an hdlist file. @@ -831,7 +830,7 @@ sub rebuild_db_open_for_traversal { } else { log::l("rebuilding rpm database"); my $rebuilddb_dir = "$prefix/var/lib/rpmrebuilddb.$$"; - -d $rebuilddb_dir and log::l("removing stale directory $rebuilddb_dir"), commands::rm("-rf", $rebuilddb_dir); + -d $rebuilddb_dir and log::l("removing stale directory $rebuilddb_dir"), rm_rf($rebuilddb_dir); c::rpmdbRebuild($prefix) or log::l("rebuilding of rpm database failed: ". c::rpmErrorString()), c::_exit(2); @@ -862,7 +861,7 @@ sub clean_old_rpm_db { providesindex.rpm requiredby.rpm triggerindex.rpm)) { -e "$prefix/var/lib/rpm/$_" or next; log::l("removing old rpm file $_"); - commands::rm("-f", "$prefix/var/lib/rpm/$_"); + rm_rf("$prefix/var/lib/rpm/$_"); } } } diff --git a/perl-install/printer.pm b/perl-install/printer.pm index 5754e0be1..92559388f 100644 --- a/perl-install/printer.pm +++ b/perl-install/printer.pm @@ -6,7 +6,6 @@ package printer; use common; -use commands; use run_program; #-if we are in an DrakX config diff --git a/perl-install/printerdrake.pm b/perl-install/printerdrake.pm index 976a1d8df..5cead41cb 100644 --- a/perl-install/printerdrake.pm +++ b/perl-install/printerdrake.pm @@ -6,7 +6,6 @@ use strict; use common; use detect_devices; -use commands; use modules; use network; use log; diff --git a/perl-install/raid.pm b/perl-install/raid.pm index 2732beb34..0d0a8720a 100644 --- a/perl-install/raid.pm +++ b/perl-install/raid.pm @@ -10,7 +10,6 @@ use common; use partition_table qw(:types); use run_program; use devices; -use commands; use modules; use fs; @@ -158,7 +157,7 @@ sub prepare_prefixed { my ($raids, $prefix) = @_; $raids or return; - eval { commands::cp("-f", "/etc/raidtab", "$prefix/etc/raidtab") }; + eval { cp_af("/etc/raidtab", "$prefix/etc/raidtab") }; foreach (grep {$_} @$raids) { devices::make("$prefix/dev/$_->{device}") foreach @{$_->{disks}}; } diff --git a/perl-install/services.pm b/perl-install/services.pm index aedd640e7..46ced1279 100644 --- a/perl-install/services.pm +++ b/perl-install/services.pm @@ -7,7 +7,6 @@ use strict; #- misc imports #-###################################################################################### use common; -use commands; use run_program; use my_gtk qw(:helpers :wrappers); diff --git a/perl-install/timezone.pm b/perl-install/timezone.pm index 2738d2956..de7b93af2 100644 --- a/perl-install/timezone.pm +++ b/perl-install/timezone.pm @@ -5,7 +5,6 @@ use strict; use vars qw($ntp_servers); use common; -use commands; use log; @@ -52,7 +51,7 @@ sub write { ntp_server($prefix, $t->{ntp}); - eval { commands::cp("-f", "$prefix/usr/share/zoneinfo/$t->{timezone}", "$prefix/etc/localtime") }; + eval { cp_af("$prefix/usr/share/zoneinfo/$t->{timezone}", "$prefix/etc/localtime") }; $@ and log::l("installing /etc/localtime failed"); setVarsInSh("$prefix/etc/sysconfig/clock", { ZONE => $t->{timezone}, diff --git a/perl-install/tinyfirewall.pm b/perl-install/tinyfirewall.pm index 014495c07..32a745094 100644 --- a/perl-install/tinyfirewall.pm +++ b/perl-install/tinyfirewall.pm @@ -1,7 +1,6 @@ package tinyfirewall; use diagnostics; use strict; -use commands; use run_program; use network::netconnect; use network; @@ -74,7 +73,7 @@ my %settings; my $config_file = "/etc/Bastille/bastille-firewall.cfg"; my $default_config_file = "/usr/share/Bastille/bastille-firewall.cfg"; # set this later sub ReadConfig { - -e $config_file or commands::cp($default_config_file, $config_file); + -e $config_file or cp_af($default_config_file, $config_file); add2hash(\%settings, { getVarsFromSh("$config_file") }); } sub SaveConfig { @@ -156,7 +155,7 @@ sub DoInterface { $in->exit(0); return; $_[0] or $in->exit(0); - commands::cp("-f", $config_file, $config_file . ".orig"); + cp_af($config_file, $config_file . ".orig"); substInFile { if(/^(.+)\s*\=/) { $a=$settings{$1}; -- cgit v1.2.1