diff options
author | Olivier Blin <blino@mageia.org> | 2010-11-02 06:34:10 +0000 |
---|---|---|
committer | Olivier Blin <blino@mageia.org> | 2010-11-02 06:34:10 +0000 |
commit | b9d2b09db2fa1a75a7806851e836fd43d3fa1275 (patch) | |
tree | a913cdd64079a388ab6400960aac72f57421469e /lib | |
parent | 3028dd876e14b25242185b8cca4122bd83cc5d1f (diff) | |
download | iurt-b9d2b09db2fa1a75a7806851e836fd43d3fa1275.tar iurt-b9d2b09db2fa1a75a7806851e836fd43d3fa1275.tar.gz iurt-b9d2b09db2fa1a75a7806851e836fd43d3fa1275.tar.bz2 iurt-b9d2b09db2fa1a75a7806851e836fd43d3fa1275.tar.xz iurt-b9d2b09db2fa1a75a7806851e836fd43d3fa1275.zip |
use iurt_root_command --cp to write rpmmacros file
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/Chroot.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index 91ff0f1..8148169 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -149,8 +149,9 @@ sub dump_rpmmacros { #plog("adding rpmmacros to $file"); - if (!open $f, qq(| $sudo sh -c "cat > $file")) { - plog("ERROR: could not open $file ($!)"); + my $tmpfile = "/tmp/rpmmacros"; + if (!open $f, ">$tmpfile") { + plog("ERROR: could not open $tmpfile ($!)"); return 0; } my $packager = $run->{packager} || $config->{packager}; @@ -160,7 +161,16 @@ sub dump_rpmmacros { \%distribution $config->{distribution} \%vendor $config->{vendor} \%packager $packager); - # need to be root for permission + + my $ret = sudo($run, $config, '--cp', $tmpfile, $file); + unlink $tmpfile; + + if (!$ret) { + plog("ERROR: could not write $file ($!)"); + return 0; + } + + 1; } sub add_local_user { |