blob: b91fa05eedeb15e7bfd376f0ad139b0717feb5f6 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001#!/bin/sh
Patrick Williams45852732022-04-02 08:58:32 -05002#
3# SPDX-License-Identifier: GPL-2.0-only
4#
5
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006### 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