xref: /openbmc/openbmc/poky/meta/recipes-core/initscripts/initscripts-1.0/umountnfs.sh (revision c124f4f2e04dca16a428a76c89677328bc7bf908)
1#!/bin/sh
2#
3# SPDX-License-Identifier: GPL-2.0-only
4#
5
6### BEGIN INIT INFO
7# Provides:          umountnfs
8# Required-Start:
9# Required-Stop:     umountfs
10# Should-Stop:       $network $portmap
11# Default-Start:
12# Default-Stop:      0 6
13# Short-Description: Unmount all network filesystems
14### END INIT INFO
15
16PATH=/sbin:/bin:/usr/sbin:/usr/bin
17
18# Write a reboot record to /var/log/wtmp before unmounting
19halt -w
20
21echo "Unmounting remote filesystems..."
22
23test -f /etc/fstab && (
24
25#
26#	Read through fstab line by line and unount network file systems
27#
28while read device mountpt fstype options
29do
30	if test "$fstype" = nfs ||  test "$fstype" = smbfs ||  test "$fstype" = ncpfs || test "$fstype" = cifs
31	then
32		umount -f $mountpt
33	fi
34done
35) < /etc/fstab
36
37: exit 0
38