From 4c7d6fcfa8969f37769ccfe518100d120a4a1b3b Mon Sep 17 00:00:00 2001 From: jumperfly Date: Wed, 16 Nov 2016 19:25:57 +0000 Subject: [PATCH] Set root as owner for all files/dirs in the initramfs --- README.md | 2 +- build.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fd96edb..a8410f5 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If the partition is detected, the squashfs module will be loaded from /modules/< This is used as the writeable area of the overlay and consists of three directories which are created if not preset: * /upper: Used for the 'upperdir' of the overlayfs. This is where all deleted/modified/created files are stored. This is cleared on each boot. * /work: Used for the 'workdir' of the overlayfs. -* /persistent: Used as an additional 'lowerdir' of the overlayfs. As the 'upperdir' is cleared, this read-only lower dir allows customisations to be made compared to the read-only OS image. +* /persistent: Used as an additional 'lowerdir' of the overlayfs. As the 'upperdir' is cleared, this read-only lower dir allows customisations to be made compared to the read-only OS image. eg. SSH keys. ### The image partition This must contain a single file, root-squashfs.img which contains the full operating system. diff --git a/build.sh b/build.sh index 2b976a3..ff4cc1c 100755 --- a/build.sh +++ b/build.sh @@ -47,7 +47,7 @@ for arch in ${!BUSYBOX_MD5[@]}; do ln -s busybox $INIT_DIR/bin/$bbcmd done cd $INIT_DIR - find . | cpio -H newc -o | gzip > ../init-$PROJECT_VERSION-$arch.gz + find . | cpio -H newc -o --owner=0:0 | gzip > ../init-$PROJECT_VERSION-$arch.gz cd ../.. # Create debug (start shell before switching root, start shell on error instead of exiting) @@ -56,6 +56,6 @@ for arch in ${!BUSYBOX_MD5[@]}; do sed -i -r '/# End mounting OS filesystems/a sh' $INIT_DIR/init sed -i -r 's/exit 1/sh/' $INIT_DIR/init cd $INIT_DIR - find . | cpio -H newc -o | gzip > ../init-$PROJECT_VERSION-$arch-debug.gz + find . | cpio -H newc --owner=0:0 -o | gzip > ../init-$PROJECT_VERSION-$arch-debug.gz cd ../.. done