|
|
18971c |
From 286fbebdaf4bc4954a3206ca11f1d14f9267a7fd Mon Sep 17 00:00:00 2001
|
|
|
18971c |
From: Harald Hoyer <harald@redhat.com>
|
|
|
18971c |
Date: Thu, 30 Jan 2014 16:11:40 +0100
|
|
|
18971c |
Subject: [PATCH] dracut.sh: only set the owner of files to 0:0, if generated
|
|
|
18971c |
as non-root
|
|
|
18971c |
|
|
|
18971c |
If the root user generates the initramfs image, preserve the ownership
|
|
|
18971c |
of the files. This of course cannot be done for non-root users
|
|
|
18971c |
generating an initramfs image.
|
|
|
18971c |
---
|
|
|
18971c |
dracut.sh | 7 +++++--
|
|
|
18971c |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
18971c |
|
|
|
18971c |
diff --git a/dracut.sh b/dracut.sh
|
|
|
18971c |
index 58acb647..4e239936 100755
|
|
|
18971c |
--- a/dracut.sh
|
|
|
18971c |
+++ b/dracut.sh
|
|
|
18971c |
@@ -1377,13 +1377,16 @@ fi
|
|
|
18971c |
|
|
|
18971c |
rm -f -- "$outfile"
|
|
|
18971c |
dinfo "*** Creating image file ***"
|
|
|
18971c |
+
|
|
|
18971c |
+[[ "$UID" != 0 ]] && cpio_owner_root="-R 0:0"
|
|
|
18971c |
+
|
|
|
18971c |
if [[ $create_early_cpio = yes ]]; then
|
|
|
18971c |
echo 1 > "$early_cpio_dir/d/early_cpio"
|
|
|
18971c |
# The microcode blob is _before_ the initramfs blob, not after
|
|
|
18971c |
- (cd "$early_cpio_dir/d"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet >../early.cpio)
|
|
|
18971c |
+ (cd "$early_cpio_dir/d"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet >../early.cpio)
|
|
|
18971c |
mv $early_cpio_dir/early.cpio $outfile.$$
|
|
|
18971c |
fi
|
|
|
18971c |
-if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null -R 0:0 -H newc -o --quiet | \
|
|
|
18971c |
+if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
|
|
|
18971c |
$compress >> "$outfile.$$"; ); then
|
|
|
18971c |
dfatal "dracut: creation of $outfile.$$ failed"
|
|
|
18971c |
exit 1
|