system: don't attempt swapon/swapoff in inittab if not available
authorThomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Wed, 5 Feb 2020 12:55:18 +0000 (13:55 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Wed, 5 Feb 2020 14:57:56 +0000 (15:57 +0100)
commitc4dce0ae0f5d5d7fecb6f493e974e131a6df43da
treea63a08ee80e159d08ec1d3875b19cb3cde919b81
parentca328f80da2da66c0c6940cd4908ab868025f670
system: don't attempt swapon/swapoff in inittab if not available

The default inittab files added by busybox and sysvinit run 'swapon -a'
during init and 'swapoff -a' during shutdown.

But, the swapon/swapoff programs are not guaranteed to be
available. For the busybox versions, it is steered by
CONFIG_SWAPON/CONFIG_SWAPOFF. For the util-linux versions, it is steered by
BR2_PACKAGE_UTIL_LINUX_BINARIES.

In a case where swapon/swapoff is not available but the inittab tries to
execute them, the boot log would be polluted by error messages like:

    swapon: not found

Avoid this by commenting out the swapon/swapoff lines if the swapon/swapoff
binaries are not available.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
[Peter: test with -x]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/busybox/busybox.mk
package/sysvinit/sysvinit.mk
system/system.mk