diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-08-27 17:39:58 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2013-08-28 13:37:50 +0200 |
commit | 9c1a65a9c82080dec2e52d03613584bbc1340cf0 (patch) | |
tree | 654fd97d7b24697e25eb91de4be88c1540e4a8eb | |
parent | 60475ade761e85ef2c1b0f2daef569b134d44fc0 (diff) | |
download | mkinitcpio-9c1a65a9c82080dec2e52d03613584bbc1340cf0.tar.gz mkinitcpio-9c1a65a9c82080dec2e52d03613584bbc1340cf0.tar.xz |
mkinitcpio: preserve permissions if run as root
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@archlinux.org>
-rwxr-xr-x | mkinitcpio | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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" |