#! /sbin/sh

# $Source: /usr/local/kcs/sys.DAVIS_800/filesets.info/JournalFS/VXFS-BASE-KRN/RCS/checkremove,v $
# $Revision: 1.2.98.2 $	$Author: bracken $
# $State: Exp $   	$Locker:  $
# $Date: 96/02/06 19:12:09 $

########
#  Product: JournalFS
#  Fileset: VXFS-BASE-KRN
# checkremove
# @(#) $Revision: 1.2.98.2 $
#########
#
# (c) Copyright Hewlett-Packard Company, 1993
#
#########

# The global variables SUCCESS, FAILURE, WARNING, EXCLUDE, PATH, ROOT,
# SW_CTL_SCRIPT_NAME, _pf, PRODUCT, and FILESET are all set by control_utils.

UTILS=/usr/lbin/sw/control_utils
if [[ ! -f $UTILS ]]
then
    print "ERROR:   Cannot find the sh functions library $UTILS."
    exit 1
fi

. $UTILS

fs_type="vxfs"

if [[ $SW_SESSION_IS_KERNEL = "TRUE" ]]; then
    #check if JFS filesystems exist.  Do not want to lose access
    if [[ -f /etc/fstab ]] then
      FS=$(grep -v -E '^[[:space:]]*#|^$' /etc/fstab | awk '{print $3}' | \
	grep $fs_type)
      if [[ -n "$FS" ]] then
	print "ERROR:   Removal of the $FILESET fileset not allowed, JournalFS ($fs_type)"
	print "         entries exist in /etc/fstab."
	exit $FAILURE
      fi
    fi
    print "WARNING: Removal of the $FILESET fileset will make it impossible to"
    print "         access any Journal Filesystems."
else
    print "WARNING: Removal of the $FILESET fileset will make it impossible"
    print "         to build a new kernel.  This precludes changing certain"
    print "         system parameters and installing products that modify or"
    print "         add to the kernel."
fi
exit $WARNING
