Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/sh |
Patrick Williams | 4585273 | 2022-04-02 08:58:32 -0500 | [diff] [blame] | 2 | # |
| 3 | # SPDX-License-Identifier: GPL-2.0-only |
| 4 | # |
| 5 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | |
| 16 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
| 17 | |
| 18 | # Write a reboot record to /var/log/wtmp before unmounting |
| 19 | halt -w |
| 20 | |
| 21 | echo "Unmounting remote filesystems..." |
| 22 | |
| 23 | test -f /etc/fstab && ( |
| 24 | |
| 25 | # |
| 26 | # Read through fstab line by line and unount network file systems |
| 27 | # |
| 28 | while read device mountpt fstype options |
| 29 | do |
| 30 | if test "$fstype" = nfs || test "$fstype" = smbfs || test "$fstype" = ncpfs || test "$fstype" = cifs |
| 31 | then |
| 32 | umount -f $mountpt |
| 33 | fi |
| 34 | done |
| 35 | ) < /etc/fstab |
| 36 | |
| 37 | : exit 0 |