#!/bin/sh
#
# remove-efs.sh
# remove ALL the SKIP and SunScreen EFS 3.0/3.1 packages.
#

# list is union of sparc/x86 pkgs;
# try to order pkgs so dependent pkgs are last,
# so pkgrm's dependency checking doesn't ask user
# "are you sure" (although perhaps admin file overrides that);
# list all skip pkgs -- even those not currently in build
# or non-exportable -- so any installation with them,
# regardless of how they got there, gets cleaned up

SKIPPKGS="SUNW3desx SUNW3des SUNWdes SUNWdesx \
    SUNWideax SUNWidea SUNWsafex SUNWsafe \
    SUNWrc4sx SUNWrc4s \
    SUNWrc2 SUNWrc4x SUNWrc4 SUNWbdcx SUNWbdc \
    SUNWkisup SUNWkdsup SUNWkusup \
    SUNWsman SUNWesx SUNWes SUNWkeymg"

SUNSCREENPKGS="SUNWfwcnv SUNWicgSM SUNWicgSA SUNWicgSS \
    SUNWicgSD SUNWicgSF"

OTHERPKGS="SUNWhttp"

# might want to delete special config files...maybe
#echo "Deleting directories"
#rm -rf /etc/opt/SUNWicg /var/opt/SUNWicg /opt/SUNWicg

cat > /tmp/noask << EOF
mail=
instance=overwrite
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=nocheck
setuid=nocheck
conflict=nocheck
action=nocheck
basedir=default
EOF


echo "### removing installed SKIP, SunScreen, and Sun web server packages"

for package in $SKIPPKGS $SUNSCREENPKGS $OTHERPKGS
do
	if pkginfo -q $package ; then
		echo "### removing $package"
		echo "y" | pkgrm -a /tmp/noask "$package.*"
		echo "### package $package removed"
		echo ""
	fi
done

echo "### Done: all SKIP, SunScreen, and Sun web server packages have been removed."
