dracut/0003-dracut.sh-only-set-the-owner-of-files-to-0-0-if-gene.patch
Harald Hoyer bcb5fa941d dracut-036-16.git20140206
- version 036
- parse dns information on "ip=" command line arg
- preserve ownership of files, if root creates the initramfs
- parse ibft nameserver settings
- do not run dhcp twice on an interface
- try to not reload systemd
2014-02-06 17:06:12 +01:00

37 lines
1.4 KiB
Diff

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