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