Comment 3 for bug 48517

Revision history for this message
In , johannes (qaz99af) wrote : Re: Bug#328582: /etc/init.d/umountfs: swapoff should be called before unmounting localfs and not after?

On Wednesday 28 September 2005 00:59, you wrote:
>
> It already does that, in the (misnamed) umountnfs.sh script which runs
> before umountfs.... read it.
>
> Mike.

hi mike,

i fail to see how umountnfs.sh could call swapoff

johannes

==========================
my umountnfs.sh:

#! /bin/sh
### BEGIN INIT INFO
# Provides: umountnfs
# Required-Start: sendsigs
# Required-Stop:
# Default-Start: 6
# Default-Stop:
# Short-Description: Unmount all network filesystems except the root file
system.
# Description: Also unmounts all virtual filesystems (proc, devfs,
# devpts, usbfs, sysfs) that are not mounted at the
# top-level.
#
# Also unmounts all virtual filesystems (proc,
# devfs, devpts, usbfs, sysfs) that are not mounted
# at the top-level.
### END INIT INFO
#
# Version: @(#)umountnfs 2.85-23 29-Jul-2004 <email address hidden>
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin

. /lib/lsb/init-functions

KERNEL=`uname -s`
RELEASE=`uname -r`

case "${KERNEL}:${RELEASE}" in
 Linux:[01].*|Linux:2.[01].*)
  FLAGS=""
  ;;
 Linux:2.[23].*|Linux:2.4.?|Linux:2.4.?-*|Linux:2.4.10|Linux:2.4.10-*)
  FLAGS="-f"
  ;;
 *)
  FLAGS="-f -l"
  ;;
esac

do_stop () {
 # Write a reboot record to /var/log/wtmp before unmounting
 halt -w

 # Remove any .clean files in auto-clean dirs.
 rm -f /tmp/.clean /var/lock/.clean /var/run/.clean

 log_begin_msg "Unmounting remote and non-toplevel virtual filesystems..."

 #
 # Read mtab file and add the directories we want to
 # unmount in reverse to a list.
 #
 (
 DIRS=""
  while read DEV DIR TYPE REST
  do
   case "$DIR" in
    /|/proc|/dev|/dev/pts|/proc/*|/sys)
     continue
     ;;
   esac
   case "$TYPE" in
    nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs)
     DIRS="$DIR $DIRS"
     ;;
    proc|procfs|linprocfs|devfs|devpts|usbfs|usbdevfs|sysfs)
     DIRS="$DIR $DIRS"
     ;;
   esac
  done
  exec </dev/null
  if [ -n "$DIRS" ]
  then
   umount $FLAGS $DIRS
  fi
 ) </etc/mtab

 log_end_msg 0
}

case "$1" in
    stop)
     do_stop
 ;;
    *)
        ;;
esac

: exit 0