From f053b5fac3c3b48439934ce75789d2e94e84957a Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Thu, 26 May 2016 23:14:33 +0200 Subject: initscripts: check if swapon/swapoff exists before executing them Not all built images contain swapon/swapoff, for instance, it is configurable with or without them in busybox. So it'd better to check if they exist or not before executing them. Redirecting the potential errors to /dev/null is not good enough, which might suppress the *real* errors. (From OE-Core rev: 2cb1142710cc2beb762c4c2b8edd44d3a97dafa0) Signed-off-by: Ming Liu Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh') diff --git a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh index dfee2afaad..02f0351fcb 100755 --- a/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +++ b/meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh @@ -69,7 +69,7 @@ fi # before fsck, since fsck can be quite memory-hungry. # test "$VERBOSE" != no && echo "Activating swap" -swapon -a 2> /dev/null +[ -x /sbin/swapon ] && swapon -a # # Check the root filesystem. -- cgit v1.2.3-54-g00ecf