aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Iurt/DKMS.pm16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Iurt/DKMS.pm b/lib/Iurt/DKMS.pm
index 637aeea..2acad93 100644
--- a/lib/Iurt/DKMS.pm
+++ b/lib/Iurt/DKMS.pm
@@ -283,8 +283,20 @@ sub dkms_compile {
-d "$dkms_spool/$media" or mkdir_p "$dkms_spool/$media";
- system("cp $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm $dkms_spool/$media/ &>/dev/null") && system("cp $chroot_tmp/usr/src/rpm/RPMS/*/*.rpm $dkms_spool/$media/ &>/dev/null") and $run->{LOG}->("ERROR: could not copy dkms packages from $chroot_tmp/usr/src/rpm/RPMS/*/*.rpm or $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm to $dkms_spool/$media ($!)\n");
- !sudo($run, $config, '--rm', "$chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm") || !sudo($run, $config, '--rm', "$chroot_tmp/usr/src/rpm/RPMS/*/*.rpm") and $run->{LOG}->("ERROR: could not delete dkms packages from $chroot_tmp/usr/src/rpm/RPMS/*/*.rpm or $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm ($!)\n");
+ my @dkms_rpm_dirs = ("/home/$luser/rpm/RPMS/*", "/usr/src/rpm/RPMS/*");
+ my $copied;
+ foreach (@dkms_rpm_dirs) {
+ my $rpms = "$chroot_tmp$_/*.rpm";
+ if (system("cp $rpms $dkms_spool/$media/ &>/dev/null") == 0) {
+ $copied = 1;
+ sudo($run, $config, '--rm', $rpms)
+ or $run->{LOG}->("ERROR: could not delete dkms packages from $rpms ($!)\n");
+ last;
+ }
+ }
+ $run->{LOG}->("ERROR: could not copy dkms packages from " .
+ join(" or ", map { "$chroot_tmp$_/*.rpm" } @dkms_rpm_dirs) .
+ " to $dkms_spool/$media ($!)\n") if !$copied;
if ($kerver ne $modulesdir) {
system("sudo rm -f $chroot_tmp/lib/modules/$kerver");