1#!/bin/sh
2#
3# SPDX-License-Identifier: GPL-2.0-only
4#
5
6### BEGIN INIT INFO
7# Provides:          umountfs
8# Required-Start:
9# Required-Stop:
10# Default-Start:
11# Default-Stop:      0 6
12# Short-Description: Turn off swap and unmount all local file systems.
13# Description:
14### END INIT INFO
15
16PATH=/sbin:/bin:/usr/sbin:/usr/bin
17
18echo "Deactivating swap..."
19[ -x /sbin/swapoff ] && swapoff -a
20
21# We leave /proc mounted.
22echo "Unmounting local filesystems..."
23grep -q /mnt/ram /proc/mounts && mount -o remount,ro /mnt/ram
24mount -o remount,ro /
25
26umount -f -a -r > /dev/null 2>&1
27
28: exit 0
29