poky/meta/recipes-core/initscripts/initscripts-1.0/umountfs
Ming Liu f053b5fac3 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 <peter.x.liu@external.atlascopco.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-30 15:58:15 +01:00

540 B
Executable File

#!/bin/sh

BEGIN INIT INFO

Provides: umountfs

Required-Start:

Required-Stop:

Default-Start:

Default-Stop: 0 6

Short-Description: Turn off swap and unmount all local file systems.

Description:

END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

echo "Deactivating swap..." [ -x /sbin/swapoff ] && swapoff -a

We leave /proc mounted.

echo "Unmounting local filesystems..." grep -q /mnt/ram /proc/mounts && mount -o remount,ro /mnt/ram mount -o remount,ro /

umount -f -a -r > /dev/null 2>&1

exit 0