From 2a7978ae5c95dbd240b8527585f72d629c8d9ac4 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 14 Jan 2018 01:05:20 +0000 Subject: draklive: ensure files copied to root filesystem are owned by root. --- lib/MGA/DrakISO/BuildRoot.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/MGA/DrakISO/BuildRoot.pm b/lib/MGA/DrakISO/BuildRoot.pm index 903a65e..177d5af 100644 --- a/lib/MGA/DrakISO/BuildRoot.pm +++ b/lib/MGA/DrakISO/BuildRoot.pm @@ -697,7 +697,7 @@ sub copy_to_root { # TODO: support source files in remote repositories - run_as_root('cp', '-af', @files, $root . $dest) + run_as_root('cp', '-af', '--no-preserve=ownership', @files, $root . $dest) or die "ERROR: failed to copy file to $dest in Live system root\n"; return if !defined $mode; @@ -711,10 +711,8 @@ sub output_to_root { my $temp_file = tmpnam(); output($temp_file, map { "$_\n" } @text); - chmod($mode, $temp_file) if $mode; - - run_as_root('mv', $temp_file, $root . $file) - or die "ERROR: failed to write $file in Live system root\n"; + copy_to_root($root, $file, $mode, $temp_file); + unlink($temp_file); } sub rm_in_root { -- cgit v1.2.1