Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | ### BEGIN INIT INFO |
| 3 | # Provides: umountnfs |
| 4 | # Required-Start: |
| 5 | # Required-Stop: umountfs |
| 6 | # Should-Stop: $network $portmap |
| 7 | # Default-Start: |
| 8 | # Default-Stop: 0 6 |
| 9 | # Short-Description: Unmount all network filesystems |
| 10 | ### END INIT INFO |
| 11 | |
| 12 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
| 13 | |
| 14 | # Write a reboot record to /var/log/wtmp before unmounting |
| 15 | halt -w |
| 16 | |
| 17 | echo "Unmounting remote filesystems..." |
| 18 | |
| 19 | test -f /etc/fstab && ( |
| 20 | |
| 21 | # |
| 22 | # Read through fstab line by line and unount network file systems |
| 23 | # |
| 24 | while read device mountpt fstype options |
| 25 | do |
| 26 | if test "$fstype" = nfs || test "$fstype" = smbfs || test "$fstype" = ncpfs || test "$fstype" = cifs |
| 27 | then |
| 28 | umount -f $mountpt |
| 29 | fi |
| 30 | done |
| 31 | ) < /etc/fstab |
| 32 | |
| 33 | : exit 0 |