]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
initscripts: don't read /proc/cmdline in populate-volatile during build
authorRoss Burton <ross.burton@arm.com>
Thu, 13 Nov 2025 16:34:38 +0000 (16:34 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 17 Nov 2025 11:09:03 +0000 (11:09 +0000)
The populate-volatile script will check for "clearcache" in the kernel
command line and wipe the caches if it has been set. This is useful at
boot, but we shouldn't be checking the kernel commandline when being
ran on the build machine at rootfs-time.

[ YOCTO #16056 ]

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initscripts/initscripts-1.0/populate-volatile.sh

index bc630e871c1cfc65c984b54703f7c58358522e3d..8b0139c094fb5d4bd037b09cb5cdf7967b86e2c8 100755 (executable)
@@ -220,17 +220,19 @@ apply_cfgfile() {
 }
 
 clearcache=0
-exec 9</proc/cmdline
-while read -r line <&9
-do
-       case "$line" in
-               *clearcache*)  clearcache=1
-                              ;;
-               *)             continue
-                              ;;
-       esac
-done
-exec 9>&-
+if test -z "$ROOT_DIR"; then
+       exec 9</proc/cmdline
+       while read -r line <&9
+       do
+               case "$line" in
+                       *clearcache*)  clearcache=1
+                                       ;;
+                       *)             continue
+                                       ;;
+               esac
+       done
+       exec 9>&-
+fi
 
 if test -e "${ROOT_DIR}/etc/volatile.cache" -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0"
 then