All tests using the rootfs currently modify it with:

  mkdir proc
  mkdir run
  mkdir srv
  mkdir sys
  rm var/run

This is because the rootfs doesn't have the correct top level directories.
Furthermore, dev is currently included when it oughtn't to be.

srv is easy.  It's an empty directory and can be included in PATHS.

dev, proc, run and sys are all mount points, which OpenRC knows how to
populate on boot.  Create only the top level directories in rootfs, without
`find` recursing into them.

Signed-off-by: Andrew Cooper <[email protected]>
---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
 * New
---
 scripts/alpine-rootfs.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/alpine-rootfs.sh b/scripts/alpine-rootfs.sh
index 72c29e0a0a13..53547b5c5282 100755
--- a/scripts/alpine-rootfs.sh
+++ b/scripts/alpine-rootfs.sh
@@ -71,8 +71,11 @@ passwd -d "root" root
 cd /
 case $1 in
     cpio)
-        PATHS="bin dev etc home init lib mnt opt root sbin usr var"
-        find $PATHS -print0 | cpio -0 -H newc -o | gzip > 
"${COPYDIR}/rootfs.cpio.gz"
+        {
+            PATHS="bin etc home init lib mnt opt root sbin srv usr var"
+            find $PATHS -print0
+            echo -ne "dev\0proc\0run\0sys\0"
+        } | cpio -0 -H newc -o | gzip > "${COPYDIR}/rootfs.cpio.gz"
 
         # Print the contents for the build log
         zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
-- 
2.39.5


Reply via email to