[arch-projects] [mkinitcpio] [PATCH 4/4] mkinitcpio: preserve permissions if run as root
Dave Reisner
dreisner at archlinux.org
Wed Aug 28 21:32:07 EDT 2013
Running as non-root is usually for my own dev purposes, but someone
might do this and be surprised when a directory/file that needs
permissions other than root isn't preserved.
Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
mkinitcpio | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mkinitcpio b/mkinitcpio
index 2d8c579..8139ee0 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -203,8 +203,12 @@ build_image() {
;;
esac
- cpio_opts=('-R' '0:0' '-0' '-o' '-H' 'newc')
+ cpio_opts=('-0' '-o' '-H' 'newc')
(( _optquiet )) && cpio_opts+=('--quiet')
+ if (( EUID != 0 )); then
+ warning 'Not building as root, ownership cannot be preserved'
+ cpio_opts+=('-R' '0:0')
+ fi
# write version stamp
printf '%s' "$version" > "$BUILDROOT/VERSION"
--
1.8.4
More information about the arch-projects
mailing list