#!/bin/sh
#
# @(#)preinstall 1.1	 97/11/06 SMI
# Removing S7 redundant directories


EXEC_BASE=/usr

remove_bool=0

for loc in da.ISO8859-15 fi.ISO8859-15 sv.ISO8859-15; do
	if [ -h ${BASEDIR}/openwin/share/locale/${loc}.sav ]; then
	      echo "/usr/openwin/share/locale/${loc}.sav is redundant"
	      unlink ${BASEDIR}/openwin/share/locale/${loc}.sav
	fi
done

for PKG in SUNWdodte SUNWeodte SUNWfodte SUNWiodte SUNWsodte; do
	pkgparam  $PKG ARCH  > /dev/null 2>&1
	exist=$?
	if [ $exist != 0 ] ; then
		remove_bool=1
		continue
	fi
done

if [ $remove_bool = 1 ]; then
	for loc in sv sv.ISO8859-15; do
		if [ -d ${BASEDIR}/openwin/share/locale/${loc} ]; then		
			if [ -d ${BASEDIR}/openwin/share/locale/${loc}/props ]; then
				if [ -f ${BASEDIR}/openwin/share/locale/${loc}/props/basic_setting ]; then
					rm -f ${BASEDIR}/openwin/share/locale/${loc}/props/basic_setting > /dev/null 2>&1
				fi
				rmdir ${BASEDIR}/openwin/share/locale/${loc}/props > /dev/null 2>&1
			fi
			rmdir ${BASEDIR}/openwin/share/locale/${loc} > /dev/null 2>&1
		fi
	done
fi

exit 0
